From: Junio C Hamano <gitster@pobox.com>
To: Andrew Thorp <andrew.thorp.dev@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: BUG: `git commit` adding unstaged chunks of files to commits on 2.33.0
Date: Tue, 31 Aug 2021 12:25:51 -0700 [thread overview]
Message-ID: <xmqqczptto00.fsf@gitster.g> (raw)
In-Reply-To: <CAHBARKcKL8h-zHcyCHRAMCj8=-PghopTPkH9o-_8UYRJYNZFmQ@mail.gmail.com> (Andrew Thorp's message of "Tue, 31 Aug 2021 14:01:57 -0400")
Andrew Thorp <andrew.thorp.dev@gmail.com> writes:
>> git commit" without pathspec would have made a partial commit that
> records only the changes that were added with "git add -p" to the
> index, though.
>
> Yeah, that was the expected behavior, but not what I experienced.
Sorry but it does not reproduce for me.
Here is my "reproduction recipe", designed to be followable by
anybody who has a copy of git and this piece of e-mail without
referencing anything else.
$ edit Makefile ; git diff Makefile
diff --git i/Makefile w/Makefile
index 9573190f1d..6bf8f3147b 100644
--- i/Makefile
+++ w/Makefile
@@ -1,4 +1,4 @@
-# The default target of this Makefile is...
+# The default target of this Makefile is.....
all::
# Define V=1 to have a more verbose compile.
@@ -30,7 +30,7 @@ all::
# Define USE_LIBPCRE if you have and want to use libpcre. Various
# commands such as log and grep offer runtime options to use
# Perl-compatible regular expressions instead of standard or extended
-# POSIX regular expressions.
+# POSIX regular expressions...
#
# Only libpcre version 2 is supported. USE_LIBPCRE2 is a synonym for
# USE_LIBPCRE, support for the old USE_LIBPCRE1 has been removed.
... You can see that we have two changes to a single file now ...
$ printf "y\nn\n" | git add -p >/dev/null
$ git status -uno
On branch test
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: Makefile
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Makefile
Untracked files not listed (use -u option to show untracked files)
... And tell "add -p" to add the first but not the second hunk.
$ git commit -m test
... And commit.
$ git status -uno
On branch test
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: Makefile
no changes added to commit (use "git add" and/or "git commit -a")
... Then the working tree file stays dirty because the second hunk
was not added.
$ git diff
diff --git i/Makefile w/Makefile
index fe6d649c27..6bf8f3147b 100644
--- i/Makefile
+++ w/Makefile
@@ -30,7 +30,7 @@ all::
# Define USE_LIBPCRE if you have and want to use libpcre. Various
# commands such as log and grep offer runtime options to use
# Perl-compatible regular expressions instead of standard or extended
-# POSIX regular expressions.
+# POSIX regular expressions...
#
# Only libpcre version 2 is supported. USE_LIBPCRE2 is a synonym for
# USE_LIBPCRE, support for the old USE_LIBPCRE1 has been removed.
... just as we can see here. Of course, the first hunk is in the
commit, as can be seen ehre
$ git diff HEAD^ HEAD
diff --git a/Makefile b/Makefile
index 9573190f1d..fe6d649c27 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# The default target of this Makefile is...
+# The default target of this Makefile is.....
all::
# Define V=1 to have a more verbose compile.
next prev parent reply other threads:[~2021-08-31 19:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-31 17:15 BUG: `git commit` adding unstaged chunks of files to commits on 2.33.0 Andrew Thorp
2021-08-31 17:56 ` Junio C Hamano
2021-08-31 18:01 ` Andrew Thorp
2021-08-31 18:01 ` Andrew Thorp
2021-08-31 19:25 ` Junio C Hamano [this message]
2021-08-31 19:45 ` Andrew Thorp
2021-09-01 14:03 ` Philippe Blain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqczptto00.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=andrew.thorp.dev@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).