Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: How to commit incomplete changes?

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:39

Neal Kreitzinger [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help