<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/sequencer.c, branch v2.42.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.42.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.42.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2023-11-02T07:53:24Z</updated>
<entry>
<title>Merge branch 'ob/sequencer-remove-dead-code' into maint-2.42</title>
<updated>2023-11-02T07:53:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-11-02T07:53:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cd41f66b9dc6b12038e7669e591ad3c593144563'/>
<id>urn:sha1:cd41f66b9dc6b12038e7669e591ad3c593144563</id>
<content type='text'>
Code clean-up.

* ob/sequencer-remove-dead-code:
  sequencer: remove unreachable exit condition in pick_commits()
</content>
</entry>
<entry>
<title>Merge branch 'ob/sequencer-reword-error-message' into maint-2.42</title>
<updated>2023-11-02T07:53:23Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-11-02T07:53:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=18e0648b9b9cc61f4b4bff12c97bf9ef2737b5d5'/>
<id>urn:sha1:18e0648b9b9cc61f4b4bff12c97bf9ef2737b5d5</id>
<content type='text'>
Update an error message (which would probably never been seen).

* ob/sequencer-reword-error-message:
  sequencer: fix error message on failure to copy SQUASH_MSG
</content>
</entry>
<entry>
<title>Merge branch 'pw/rebase-i-after-failure' into maint-2.42</title>
<updated>2023-11-02T07:53:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-11-02T07:53:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a70f725c06bb28c1f79c8e30ea9cdb30c45383d0'/>
<id>urn:sha1:a70f725c06bb28c1f79c8e30ea9cdb30c45383d0</id>
<content type='text'>
Various fixes to the behaviour of "rebase -i" when the command got
interrupted by conflicting changes.
cf. &lt;6b927687-cf6e-d73e-78fb-bd4f46736928@gmx.de&gt;

* pw/rebase-i-after-failure:
  rebase -i: fix adding failed command to the todo list
  rebase --continue: refuse to commit after failed command
  rebase: fix rewritten list for failed pick
  sequencer: factor out part of pick_commits()
  sequencer: use rebase_path_message()
  rebase -i: remove patch file after conflict resolution
  rebase -i: move unlink() calls
</content>
</entry>
<entry>
<title>Merge branch 'ob/sequencer-empty-hint-fix' into maint-2.42</title>
<updated>2023-11-02T07:53:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-11-02T07:53:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a00b1127ce09bb963590faaef342618f719e7cc4'/>
<id>urn:sha1:a00b1127ce09bb963590faaef342618f719e7cc4</id>
<content type='text'>
The use of API between two calls to require_clean_work_tree() from
the sequencer code has been cleaned up for consistency.

* ob/sequencer-empty-hint-fix:
  sequencer: rectify empty hint in call of require_clean_work_tree()
</content>
</entry>
<entry>
<title>Merge branch 'mp/rebase-label-length-limit' into maint-2.42</title>
<updated>2023-11-02T07:53:14Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-11-02T07:53:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=396a167bd4e68f496981345c3d89459abb910b7e'/>
<id>urn:sha1:396a167bd4e68f496981345c3d89459abb910b7e</id>
<content type='text'>
Overly long label names used in the sequencer machinery are now
chopped to fit under filesystem limitation.

* mp/rebase-label-length-limit:
  rebase: allow overriding the maximal length of the generated labels
  sequencer: truncate labels to accommodate loose refs
</content>
</entry>
<entry>
<title>sequencer: remove unreachable exit condition in pick_commits()</title>
<updated>2023-09-13T00:32:09Z</updated>
<author>
<name>Oswald Buddenhagen</name>
<email>oswald.buddenhagen@gmx.de</email>
</author>
<published>2023-09-12T10:55:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=63642d58b4b28c3caba6d5ab0c3aa98c4ce54eaa'/>
<id>urn:sha1:63642d58b4b28c3caba6d5ab0c3aa98c4ce54eaa</id>
<content type='text'>
This was introduced by 56dc3ab04 ("sequencer (rebase -i): implement the
'edit' command", 2017-01-02), and was pointless from the get-go: all
early exits from the loop above are returns, so todo_list-&gt;current ==
todo_list-&gt;nr is an invariant after the loop.

Signed-off-by: Oswald Buddenhagen &lt;oswald.buddenhagen@gmx.de&gt;
Acked-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase -i: fix adding failed command to the todo list</title>
<updated>2023-09-06T17:29:44Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2023-09-06T15:22:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=203573b024610d7e50cc83a6d06867880ed8cc4f'/>
<id>urn:sha1:203573b024610d7e50cc83a6d06867880ed8cc4f</id>
<content type='text'>
When rebasing commands are moved from the todo list in "git-rebase-todo"
to the "done" file (which is used by "git status" to show the recently
executed commands) just before they are executed. This means that if a
command fails because it would overwrite an untracked file it has to be
added back into the todo list before the rebase stops for the user to
fix the problem.

Unfortunately when a failed command is added back into the todo list the
command preceding it is erroneously appended to the "done" file.  This
means that when rebase stops after "pick B" fails the "done" file
contains

	pick A
	pick B
	pick A

instead of

	pick A
	pick B

This happens because save_todo() updates the "done" file with the
previous command whenever "git-rebase-todo" is updated. When we add the
failed pick back into "git-rebase-todo" we do not want to update
"done". Fix this by adding a "reschedule" parameter to save_todo() which
prevents the "done" file from being updated when adding a failed command
back into the "git-rebase-todo" file. A couple of the existing tests are
modified to improve their coverage as none of them trigger this bug or
check the "done" file.

Reported-by: Stefan Haller &lt;lists@haller-berlin.de&gt;
Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase --continue: refuse to commit after failed command</title>
<updated>2023-09-06T17:29:44Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2023-09-06T15:22:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=405509cbd66b2149fcce6e71c0eb0704c241a826'/>
<id>urn:sha1:405509cbd66b2149fcce6e71c0eb0704c241a826</id>
<content type='text'>
If a commit cannot be picked because it would overwrite an untracked
file then "git rebase --continue" should refuse to commit any staged
changes as the commit was not picked. This is implemented by refusing to
commit if the message file is missing. The message file is chosen for
this check because it is only written when "git rebase" stops for the
user to resolve merge conflicts.

Existing commands that refuse to commit staged changes when continuing
such as a failed "exec" rely on checking for the absence of the author
script in run_git_commit(). This prevents the staged changes from being
committed but prints

    error: could not open '.git/rebase-merge/author-script' for
    reading

before the message about not being able to commit. This is confusing to
users and so checking for the message file instead improves the user
experience. The existing test for refusing to commit after a failed exec
is updated to check that we do not print the error message about a
missing author script anymore.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase: fix rewritten list for failed pick</title>
<updated>2023-09-06T17:29:43Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2023-09-06T15:22:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e032abd5a0bec40a700527f71073f3ba21fce7d6'/>
<id>urn:sha1:e032abd5a0bec40a700527f71073f3ba21fce7d6</id>
<content type='text'>
git rebase keeps a list that maps the OID of each commit before it was
rebased to the OID of the equivalent commit after the rebase.  This list
is used to drive the "post-rewrite" hook that is called at the end of a
successful rebase. When a rebase stops for the user to resolve merge
conflicts the OID of the commit being picked is written to
".git/rebase-merge/stopped-sha". Then when the rebase is continued that
OID is added to the list of rewritten commits. Unfortunately if a commit
cannot be picked because it would overwrite an untracked file we still
write the "stopped-sha1" file. This means that when the rebase is
continued the commit is added into the list of rewritten commits even
though it has not been picked yet.

Fix this by not calling error_with_patch() for failed commands. The pick
has failed so there is nothing to commit and therefore we do not want to
set up the state files for committing staged changes when the rebase
continues. This change means we no-longer write a patch for the failed
command or display the error message printed by error_with_patch(). As
the command has failed the patch isn't really useful and in any case the
user can inspect the commit associated with the failed command by
inspecting REBASE_HEAD. Unless the user has disabled it we already print
an advice message that is more helpful than the message from
error_with_patch() which the user will still see. Even if the advice is
disabled the user will see the messages from the merge machinery
detailing the problem.

The code to add a failed command back into the todo list is duplicated
between pick_one_commit() and the loop in pick_commits(). Both sites
print advice about the command being rescheduled, decrement the current
item and save the todo list. To avoid duplicating this code
pick_one_commit() is modified to set a flag to indicate that the command
should be rescheduled in the main loop. This simplifies things as only
the remaining copy of the code needs to be modified to set REBASE_HEAD
rather than calling error_with_patch().

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sequencer: factor out part of pick_commits()</title>
<updated>2023-09-06T17:29:43Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2023-09-06T15:22:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f2b5f41eda52416d29fade2f823d3b5bd7aa2205'/>
<id>urn:sha1:f2b5f41eda52416d29fade2f823d3b5bd7aa2205</id>
<content type='text'>
This simplifies the next commit. If a pick fails we now return the error
at the end of the loop body rather than returning early, a successful
"edit" command continues to return early. There are three things to
check to ensure that removing the early return for an error does not
change the behavior of the code:

(1) We could enter the block guarded by "if (reschedule)". This block
    is not entered because "reschedlue" is always zero when picking a
    commit.

(2) We could enter the block guarded by
    "else if (is_rebase_i(opts) &amp;&amp;  check_todo &amp;&amp; !res)". This block is
    not entered when returning an error because "res" is non-zero in
    that case.

(3) todo_list-&gt;current could be incremented before returning. That is
    avoided by moving the increment which is of course a potential
    change in behavior itself. The move is safe because none of the
    callers look at todo_list after this function returns. Moving the
    increment makes it clear we only want to advance the current item
    if the command was successful.

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
