You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pre-push should forbid unrelated staged changes while pushing #2486
pre-commit installed at .git/hooks/pre-commit
pre-commit installed at .git/hooks/pre-push
Create a file with some whitespaces at end
spacestotrail
Add and commit the file
git add spaces.txt
git commit -m "Add spaces"
Output
check for added large files..............................................Passed
check for case conflicts.................................................Passed
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
check yaml...........................................(no files to check)Skipped
detect private key.......................................................Passed
fix end of files.........................................................Passed
mixed line ending........................................................Passed
[features/pre-commit-issue 9768261] Add spaces
1 file changed, 1 insertion(+)
create mode 100644 spaces.txt
Try to git push
fix end of files.........................................................Passed
trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook
Fixing spaces.txt
error: failed to push some refs to '*****'
Add the spaces.txt in staged to commit but don't commit anything
git add spaces.txt
Try to git push
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 295 bytes | 98.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Analyzing objects... (3/3) (91 ms)
remote: Storing packfile... done (86 ms)
remote: Storing index... done (48 ms)
To ****
52c39c7..9768261 features/pre-commit-issue -> features/pre-commit-issue
hmmm interesting -- the "unstaged changes" check I guess really only makes sense for commit -- it should additionally reject push if there's staged things
changed the title [-]dotnet format pre-push hook allow push when correct file is in staged changes[/-][+]pre-push should forbid unrelated staged changes while pushing[/+]on Aug 17, 2022
Activity
asottile commentedon Aug 16, 2022
you'll have to provide more information and a reproduction
asottile commentedon Aug 16, 2022
also show the full output, do not redact anything
bnchou commentedon Aug 16, 2022
Not related to dotnet format
.pre-commit-config.yaml
Installation
Output:
Create a file with some whitespaces at end
Add and commit the file
Output
Try to
git pushAdd the spaces.txt in staged to commit but don't commit anything
Try to
git pushIt succeeds to push with spaces at the end
asottile commentedon Aug 17, 2022
hmmm interesting -- the "unstaged changes" check I guess really only makes sense for
commit-- it should additionally rejectpushif there's staged things[-]dotnet format pre-push hook allow push when correct file is in staged changes[/-][+]pre-push should forbid unrelated staged changes while pushing[/+]asottile commentedon Oct 25, 2022
JosephRangel commentedon Mar 28, 2023
is this issue solved?
asottile commentedon Mar 28, 2023
is the issue closed?