git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
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 10:56:42 -0700	[thread overview]
Message-ID: <xmqq4kb5v6p1.fsf@gitster.g> (raw)
In-Reply-To: <CAHBARKezrkKAs0ACbJ_fnxR-qWacQ5KKuVLwn0WyT7aR+4++pQ@mail.gmail.com> (Andrew Thorp's message of "Tue, 31 Aug 2021 13:15:18 -0400")

Andrew Thorp <andrew.thorp.dev@gmail.com> writes:

>> 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.

How was the last "commit the changes" done exactly?  

If either "git commit -a" or "git commit <file>" was done, that
would explain the symptom of having the entire up-to-date contents
of <file> in the working tree recorded in the resulting commit.  The
former tells "take all changes in the working tree", the latter
tells "take the version of <file> in the working tree as a whole",
to Git to create a commit out of.

"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.

  reply	other threads:[~2021-08-31 17:56 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 [this message]
2021-08-31 18:01   ` Andrew Thorp
2021-08-31 18:01     ` Andrew Thorp
2021-08-31 19:25       ` Junio C Hamano
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=xmqq4kb5v6p1.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).