BUG: `git commit` adding unstaged chunks of files to commits on 2.33.0

2 messages, 2 authors, 2021-09-01 · open the first message on its own page

BUG: `git commit` adding unstaged chunks of files to commits on 2.33.0

From: Andrew Thorp <hidden>
Date: 2021-08-31 17:15:31

Hello all,

As described in the subject line, it seems like git commit is
committing entire files when chunks of the files are staged using `git
add -p`, in spite of leaving chunks out of the stage. See below for
the bug-report template questionnaire. Please let me know if there is
anything I can do to help resolve this issue or if there is anything
needed.

Thanks,

Andrew Thorp

What did you do before the bug happened? (Steps to reproduce your issue)
Edit a checked-in file, adding multiple chunks of lines to the file.
Using `git add -p <file>`, stage one of the chunks, leave some chunks unstaged.
After running `git status` the file should both in the section
`Changes to be committed:` and `Changes not staged for commit`.
Commit the changes.
What did you expect to happen? (Expected behavior)
I expected all staged changes to be committed and unstaged changes to
remain unstaged.
What happened instead? (Actual behavior)
The entire file was committed, including the unstaged chunks of changes.
What's different between what you expected and what actually happened?
It appears as though the remaining file lines were both checked in and
committed, when only the later should have happened.

[System Info]
git version:
git version 2.33.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Darwin 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47
PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64 x86_64
compiler info: clang: 12.0.5 (clang-1205.0.22.9)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/zsh

Re: BUG: `git commit` adding unstaged chunks of files to commits on 2.33.0

From: Philippe Blain <hidden>
Date: 2021-09-01 14:03:48

Hi Andrew,

Le 2021-08-31 à 13:15, Andrew Thorp a écrit :
Hello all,



[System Info]
git version:
git version 2.33.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Darwin 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47
PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64 x86_64
compiler info: clang: 12.0.5 (clang-1205.0.22.9)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/zsh
As I read downthread, the behaviour was due to your pre-commit hook.

Normally below the "System Info" section in the 'git bugreport' template
there should be an "Enabled Hooks" section, which does not appear above.
I would be curious to know why; I'm guessing you ran 'git bugreport' from
outside your repo and so it said:

[Enabled Hooks]
not run from a git repository - no hooks to show

and you deleted that section ?

I'm thinking that maybe if the 'git bugreport' template mentioned upfront that the
command should be run in the repo where you observed a bug, maybe it would lead to
fewer back and forth like in this thread ? (CC'ing Emily who implemented 'git bugreport').

I've sent a PR [1] for the web site so that this is also mentioned at https://git-scm.com/community.

Cheers,
Philippe.

[1] https://github.com/git/git-scm.com/pull/1629
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help