<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/sequencer.c, branch v2.26.1</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.26.1</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.26.1'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-03-12T21:28:01Z</updated>
<entry>
<title>Merge branch 'en/rebase-backend'</title>
<updated>2020-03-12T21:28:01Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-03-12T21:28:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b4f0038525623e0e5aa3b35d520de909618cae98'/>
<id>urn:sha1:b4f0038525623e0e5aa3b35d520de909618cae98</id>
<content type='text'>
Band-aid fixes for two fallouts from switching the default "rebase"
backend.

* en/rebase-backend:
  git-rebase.txt: highlight backend differences with commit rewording
  sequencer: clear state upon dropping a become-empty commit
  i18n: unmark a message in rebase.c
</content>
</entry>
<entry>
<title>sequencer: clear state upon dropping a become-empty commit</title>
<updated>2020-03-11T19:11:05Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2020-03-11T15:30:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9a1b7474d6babad5fabed9a2926a57d875f3820b'/>
<id>urn:sha1:9a1b7474d6babad5fabed9a2926a57d875f3820b</id>
<content type='text'>
In commit e98c4269c8 ("rebase (interactive-backend): fix handling of
commits that become empty", 2020-02-15), the merge backend was changed
to drop commits that did not start empty but became so after being
applied (because their changes were a subset of what was already
upstream).  This new code path did not need to go through the process of
creating a commit, since we were dropping the commit instead.
Unfortunately, this also means we bypassed the clearing of the
CHERRY_PICK_HEAD and MERGE_MSG files, which if there were no further
commits to cherry-pick would mean that the rebase would end but assume
there was still an operation in progress.  Ensure that we clear such
state files when we decide to drop the commit.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'en/rebase-backend'</title>
<updated>2020-03-02T23:07:19Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-03-02T23:07:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8c22bd9ff9d4a355d3546181698307a797fd2bd2'/>
<id>urn:sha1:8c22bd9ff9d4a355d3546181698307a797fd2bd2</id>
<content type='text'>
"git rebase" has learned to use the merge backend (i.e. the
machinery that drives "rebase -i") by default, while allowing
"--apply" option to use the "apply" backend (e.g. the moral
equivalent of "format-patch piped to am").  The rebase.backend
configuration variable can be set to customize.

* en/rebase-backend:
  rebase: rename the two primary rebase backends
  rebase: change the default backend from "am" to "merge"
  rebase: make the backend configurable via config setting
  rebase tests: repeat some tests using the merge backend instead of am
  rebase tests: mark tests specific to the am-backend with --am
  rebase: drop '-i' from the reflog for interactive-based rebases
  git-prompt: change the prompt for interactive-based rebases
  rebase: add an --am option
  rebase: move incompatibility checks between backend options a bit earlier
  git-rebase.txt: add more details about behavioral differences of backends
  rebase: allow more types of rebases to fast-forward
  t3432: make these tests work with either am or merge backends
  rebase: fix handling of restrict_revision
  rebase: make sure to pass along the quiet flag to the sequencer
  rebase, sequencer: remove the broken GIT_QUIET handling
  t3406: simplify an already simple test
  rebase (interactive-backend): fix handling of commits that become empty
  rebase (interactive-backend): make --keep-empty the default
  t3404: directly test the behavior of interest
  git-rebase.txt: update description of --allow-empty-message
</content>
</entry>
<entry>
<title>rebase: drop '-i' from the reflog for interactive-based rebases</title>
<updated>2020-02-16T23:40:42Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2020-02-15T21:36:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c2417d3af7574adc1fb14f7df31b862aa9551e2e'/>
<id>urn:sha1:c2417d3af7574adc1fb14f7df31b862aa9551e2e</id>
<content type='text'>
A large variety of rebase types are supported by the interactive
machinery, not just the explicitly interactive ones.  These all share
the same code and write the same reflog messages, but the "-i" moniker
in those messages doesn't really have much meaning.  It also becomes
somewhat distracting once we switch the default from the am-backend to
the interactive one.  Just remove the "-i" from these messages.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase, sequencer: remove the broken GIT_QUIET handling</title>
<updated>2020-02-16T23:40:42Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2020-02-15T21:36:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8a997ed132f7b8709d1752b64779566600345375'/>
<id>urn:sha1:8a997ed132f7b8709d1752b64779566600345375</id>
<content type='text'>
The GIT_QUIET environment variable was used to signal the non-am
backends that the rebase should perform quietly.  The preserve-merges
backend does not make use of the quiet flag anywhere (other than to
write out its state whenever it writes state), and this mechanism was
broken in the conversion from shell to C.  Since this environment
variable was specifically designed for scripts and the only backend that
would still use it is no longer a script, just gut this code.

A subsequent commit will fix --quiet for the interactive/merge backend
in a different way.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase (interactive-backend): fix handling of commits that become empty</title>
<updated>2020-02-16T23:40:42Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2020-02-15T21:36:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e98c4269c86019bfe057a91b4305f784365b6f0b'/>
<id>urn:sha1:e98c4269c86019bfe057a91b4305f784365b6f0b</id>
<content type='text'>
As established in the previous commit and commit b00bf1c9a8dd
(git-rebase: make --allow-empty-message the default, 2018-06-27), the
behavior for rebase with different backends in various edge or corner
cases is often more happenstance than design.  This commit addresses
another such corner case: commits which "become empty".

A careful reader may note that there are two types of commits which would
become empty due to a rebase:

  * [clean cherry-pick] Commits which are clean cherry-picks of upstream
    commits, as determined by `git log --cherry-mark ...`.  Re-applying
    these commits would result in an empty set of changes and a
    duplicative commit message; i.e. these are commits that have
    "already been applied" upstream.

  * [become empty] Commits which are not empty to start, are not clean
    cherry-picks of upstream commits, but which still become empty after
    being rebased.  This happens e.g. when a commit has changes which
    are a strict subset of the changes in an upstream commit, or when
    the changes of a commit can be found spread across or among several
    upstream commits.

Clearly, in both cases the changes in the commit in question are found
upstream already, but the commit message may not be in the latter case.

When cherry-mark can determine a commit is already upstream, then
because of how cherry-mark works this means the upstream commit message
was about the *exact* same set of changes.  Thus, the commit messages
can be assumed to be fully interchangeable (and are in fact likely to be
completely identical).  As such, the clean cherry-pick case represents a
case when there is no information to be gained by keeping the extra
commit around.  All rebase types have always dropped these commits, and
no one to my knowledge has ever requested that we do otherwise.

For many of the become empty cases (and likely even most), we will also
be able to drop the commit without loss of information -- but this isn't
quite always the case.  Since these commits represent cases that were
not clean cherry-picks, there is no upstream commit message explaining
the same set of changes.  Projects with good commit message hygiene will
likely have the explanation from our commit message contained within or
spread among the relevant upstream commits, but not all projects run
that way.  As such, the commit message of the commit being rebased may
have reasoning that suggests additional changes that should be made to
adapt to the new base, or it may have information that someone wants to
add as a note to another commit, or perhaps someone even wants to create
an empty commit with the commit message as-is.

Junio commented on the "become-empty" types of commits as follows[1]:

    WRT a change that ends up being empty (as opposed to a change that
    is empty from the beginning), I'd think that the current behaviour
    is desireable one.  "am" based rebase is solely to transplant an
    existing history and want to stop much less than "interactive" one
    whose purpose is to polish a series before making it publishable,
    and asking for confirmation ("this has become empty--do you want to
    drop it?") is more appropriate from the workflow point of view.

[1] https://lore.kernel.org/git/xmqqfu1fswdh.fsf@gitster-ct.c.googlers.com/

I would simply add that his arguments for "am"-based rebases actually
apply to all non-explicitly-interactive rebases.  Also, since we are
stating that different cases should have different defaults, it may be
worth providing a flag to allow users to select which behavior they want
for these commits.

Introduce a new command line flag for selecting the desired behavior:
    --empty={drop,keep,ask}
with the definitions:
    drop: drop commits which become empty
    keep: keep commits which become empty
    ask:  provide the user a chance to interact and pick what to do with
          commits which become empty on a case-by-case basis

In line with Junio's suggestion, if the --empty flag is not specified,
pick defaults as follows:
    explicitly interactive: ask
    otherwise: drop

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase (interactive-backend): make --keep-empty the default</title>
<updated>2020-02-16T23:40:42Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2020-02-15T21:36:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d48e5e21da980c6d439655a1292d0332b341c7d1'/>
<id>urn:sha1:d48e5e21da980c6d439655a1292d0332b341c7d1</id>
<content type='text'>
Different rebase backends have different treatment for commits which
start empty (i.e. have no changes relative to their parent), and the
--keep-empty option was added at some point to allow adjusting behavior.
The handling of commits which start empty is actually quite similar to
commit b00bf1c9a8dd (git-rebase: make --allow-empty-message the default,
2018-06-27), which pointed out that the behavior for various backends is
often more happenstance than design.  The specific change made in that
commit is actually quite relevant as well and much of the logic there
directly applies here.

It makes a lot of sense in 'git commit' to error out on the creation of
empty commits, unless an override flag is provided.  However, once
someone determines that there is a rare case that merits using the
manual override to create such a commit, it is somewhere between
annoying and harmful to have to take extra steps to keep such
intentional commits around.  Granted, empty commits are quite rare,
which is why handling of them doesn't get considered much and folks tend
to defer to existing (accidental) behavior and assume there was a reason
for it, leading them to just add flags (--keep-empty in this case) that
allow them to override the bad defaults.  Fix the interactive backend so
that --keep-empty is the default, much like we did with
--allow-empty-message.  The am backend should also be fixed to have
--keep-empty semantics for commits that start empty, but that is not
included in this patch other than a testcase documenting the failure.

Note that there was one test in t3421 which appears to have been written
expecting --keep-empty to not be the default as correct behavior.  This
test was introduced in commit 00b8be5a4d38 ("add tests for rebasing of
empty commits", 2013-06-06), which was part of a series focusing on
rebase topology and which had an interesting original cover letter at
https://lore.kernel.org/git/1347949878-12578-1-git-send-email-martinvonz@gmail.com/
which noted
    Your input especially appreciated on whether you agree with the
    intent of the test cases.
and then went into a long example about how one of the many tests added
had several questions about whether it was correct.  As such, I believe
most the tests in that series were about testing rebase topology with as
many different flags as possible and were not trying to state in general
how those flags should behave otherwise.

Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ag/edit-todo-drop-check'</title>
<updated>2020-02-14T20:54:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-02-14T20:54:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4dbeecba27983a86c17383280856bbbe385ceb8d'/>
<id>urn:sha1:4dbeecba27983a86c17383280856bbbe385ceb8d</id>
<content type='text'>
Allow the rebase.missingCommitsCheck configuration to kick in when
"rebase --edit-todo" and "rebase --continue" restarts the procedure.

* ag/edit-todo-drop-check:
  rebase-interactive: warn if commit is dropped with `rebase --edit-todo'
  sequencer: move check_todo_list_from_file() to rebase-interactive.c
</content>
</entry>
<entry>
<title>Merge branch 'ag/rebase-avoid-unneeded-checkout'</title>
<updated>2020-02-14T20:54:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-02-14T20:54:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d8b8d59054ed5ba2f79d3cb2fad0b5f0bfeb3ac1'/>
<id>urn:sha1:d8b8d59054ed5ba2f79d3cb2fad0b5f0bfeb3ac1</id>
<content type='text'>
"git rebase -i" (and friends) used to unnecessarily check out the
tip of the branch to be rebased, which has been corrected.

* ag/rebase-avoid-unneeded-checkout:
  rebase -i: stop checking out the tip of the branch to rebase
</content>
</entry>
<entry>
<title>Merge branch 'js/rebase-i-with-colliding-hash'</title>
<updated>2020-02-14T20:54:20Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-02-14T20:54:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=251187084d5ebdb3ba898ba4a8f9b005b7626655'/>
<id>urn:sha1:251187084d5ebdb3ba898ba4a8f9b005b7626655</id>
<content type='text'>
"git rebase -i" identifies existing commits in its todo file with
their abbreviated object name, which could become ambigous as it
goes to create new commits, and has a mechanism to avoid ambiguity
in the main part of its execution.  A few other cases however were
not covered by the protection against ambiguity, which has been
corrected.

* js/rebase-i-with-colliding-hash:
  rebase -i: also avoid SHA-1 collisions with missingCommitsCheck
  rebase -i: re-fix short SHA-1 collision
  parse_insn_line(): improve error message when parsing failed
</content>
</entry>
</feed>
