git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Neal Kreitzinger <nkreitzinger@gmail.com>
Cc: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>, git@vger.kernel.org
Subject: Re: How to commit incomplete changes?
Date: Thu, 15 Dec 2011 16:21:15 -0800	[thread overview]
Message-ID: <7v8vmdl62s.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4EEA79E0.4070700@gmail.com> (Neal Kreitzinger's message of "Thu, 15 Dec 2011 16:51:12 -0600")

Neal Kreitzinger <nkreitzinger@gmail.com> writes:

> A main purpose for the squash and fixup options is ...
> "To make it look like you
> did it all perfectly without making any mistakes" (or a reasonable
> facsimile thereof).  You insights on the cherry-picking of fixes is
> interesting, but makes no sense in the context of unpublished work.
> Why would you need to cherry-pick fixes to mistakes that have not yet
> been propagated (published)?
> ...
> I assume by 'generated changes' you mean the automerge in git...

My reading of the "need to split" example was not "bulk of work plus fixes
to mistakes". Imagine you are working on somebody else's code and for some
reason you want to do

	s/setenv/xsetenv/g

all over the code, and also add a wrapper to implement xsetenv() function.

You _could_ do it in one single commit, but what happens when you try to
adjust to the updated upstream code, which may have added new callsites to
setenv()?

If you keep it as two patches, one is mechanical (i.e. s/setenv/xsetenv/g)
and the other is manual (i.e. implementation of xsetenv()), then you can
discard the text of the "mechanical" one from the old series and instead
run the substitution on the updated code, and then cherry-pick the
"manual" one.

If you did the mechanical one first, the resulting code would not compile
(lacks xsetenv() implementation), and then the second "manual" one would
"fix" it. In this simplified example, it is easy to flip the orders and
keep things work, but then you would get a complaint from clever compiler
or linker that xsetenv() implementation is defined but nobody uses it,
which is another kind of breakage. So it _is_ possible that you cannot
avoid breaking the system inside two patches, making them "all-or-none"
series.

  reply	other threads:[~2011-12-16  0:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 23:24 How to commit incomplete changes? Hallvard B Furuseth
2011-12-15  6:44 ` Alexey Shumkin
2011-12-15  7:11   ` Hallvard B Furuseth
2011-12-15  8:22     ` Alexey Shumkin
2011-12-15  8:39       ` Alexey Shumkin
2011-12-15 22:51 ` Neal Kreitzinger
2011-12-16  0:21   ` Junio C Hamano [this message]
2011-12-16 12:15     ` Hallvard Breien Furuseth
2011-12-16 12:58       ` Hallvard Breien Furuseth
2011-12-16  1:49 ` Tomas Carnecky

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v8vmdl62s.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=h.b.furuseth@usit.uio.no \
    --cc=nkreitzinger@gmail.com \
    /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.
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 NNTP newsgroup(s).