<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/sequencer.h, branch v2.37.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.37.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.37.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-05-27T06:05:03Z</updated>
<entry>
<title>revert: optionally refer to commit in the "reference" format</title>
<updated>2022-05-27T06:05:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-05-27T06:01:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=43966ab3156a082067bf9930351e96e9488da735'/>
<id>urn:sha1:43966ab3156a082067bf9930351e96e9488da735</id>
<content type='text'>
A typical "git revert" commit uses the full title of the original
commit in its title, and starts its body of the message with:

    This reverts commit 8fa7f667cf61386257c00d6e954855cc3215ae91.

This does not encourage the best practice of describing not just
"what" (i.e. "Revert X" on the title says what we did) but "why"
(i.e. and it does not say why X was undesirable).

We can instead phrase this first line of the body to be more like

    This reverts commit 8fa7f667 (do this and that, 2022-04-25)

so that the title does not have to be

    Revert "do this and that"

We can instead use the title to describe "why" we are reverting the
original commit.

Introduce the "--reference" option to "git revert", and also the
revert.reference configuration variable, which defaults to false, to
tweak the title and the first line of the draft commit message for
when creating a "revert" commit.

When this option is in use, the first line of the pre-filled editor
buffer becomes a comment line that tells the user to say _why_.  If
the user exits the editor without touching this line by mistake,
what we prepare to become the first line of the body, i.e. "This
reverts commit 8fa7f667 (do this and that, 2022-04-25)", ends up to
be the title of the resulting commit.  This behaviour is designed to
help such a user to identify such a revert in "git log --oneline"
easily so that it can be further reworded with "git rebase -i" later.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>create_autostash(): remove unneeded parameter</title>
<updated>2022-01-26T20:08:53Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2022-01-26T13:05:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b7de153bd9332a992baa6f937372f0b1833f61e5'/>
<id>urn:sha1:b7de153bd9332a992baa6f937372f0b1833f61e5</id>
<content type='text'>
The default_reflog parameter of create_autostash() is passed to
reset_head(). However as creating a stash does not involve updating
any refs the parameter is not used by reset_head(). Removing the
parameter from create_autostash() simplifies the callers.

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>Merge branch 'js/retire-preserve-merges'</title>
<updated>2021-10-18T22:47:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-10-18T22:47:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=223a1bfb5821387981c700654e4edd2443c5a7fc'/>
<id>urn:sha1:223a1bfb5821387981c700654e4edd2443c5a7fc</id>
<content type='text'>
The "--preserve-merges" option of "git rebase" has been removed.

* js/retire-preserve-merges:
  sequencer: restrict scope of a formerly public function
  rebase: remove a no-longer-used function
  rebase: stop mentioning the -p option in comments
  rebase: remove obsolete code comment
  rebase: drop the internal `rebase--interactive` command
  git-svn: drop support for `--preserve-merges`
  rebase: drop support for `--preserve-merges`
  pull: remove support for `--rebase=preserve`
  tests: stop testing `git rebase --preserve-merges`
  remote: warn about unhandled branch.&lt;name&gt;.rebase values
  t5520: do not use `pull.rebase=preserve`
</content>
</entry>
<entry>
<title>Merge branch 'ab/designated-initializers'</title>
<updated>2021-10-11T17:21:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-10-11T17:21:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=404c4a54624c3e0ea9066809344a6269c16de69f'/>
<id>urn:sha1:404c4a54624c3e0ea9066809344a6269c16de69f</id>
<content type='text'>
Code clean-up.

* ab/designated-initializers:
  cbtree.h: define cb_init() in terms of CBTREE_INIT
  *.h: move some *_INIT to designated initializers
  *.h _INIT macros: don't specify fields equal to 0
  *.[ch] *_INIT macros: use { 0 } for a "zero out" idiom
  submodule-config.h: remove unused SUBMODULE_INIT macro
</content>
</entry>
<entry>
<title>Merge branch 'pw/rebase-reread-todo-after-editing'</title>
<updated>2021-10-06T20:40:12Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-10-06T20:40:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5a5ea9763c9fcce82e60a2183e8ffc4989a291d5'/>
<id>urn:sha1:5a5ea9763c9fcce82e60a2183e8ffc4989a291d5</id>
<content type='text'>
The code to re-read the edited todo list in "git rebase -i" was
made more robust.

* pw/rebase-reread-todo-after-editing:
  rebase: fix todo-list rereading
  sequencer.c: factor out a function
</content>
</entry>
<entry>
<title>*.h: move some *_INIT to designated initializers</title>
<updated>2021-09-27T21:48:00Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-09-27T12:54:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f69a6e4f076ec9ec89d94a6d960d0c161381a597'/>
<id>urn:sha1:f69a6e4f076ec9ec89d94a6d960d0c161381a597</id>
<content type='text'>
Move various *_INIT macros to use designated initializers. This helps
readability. I've only picked those leftover macros that were not
touched by another in-flight series of mine which changed others, but
also how initialization was done.

In the case of SUBMODULE_ALTERNATE_SETUP_INIT I've left an explicit
initialization of "error_mode", even though
SUBMODULE_ALTERNATE_ERROR_IGNORE itself is defined as "0". Let's not
peek under the hood and assume that enum fields we know the value of
will stay at "0".

The change to "TESTSUITE_INIT" in "t/helper/test-run-command.c" was
part of an earlier on-list version[1] of c90be786da9 (test-tool
run-command: fix flip-flop init pattern, 2021-09-11).

1. https://lore.kernel.org/git/patch-1.1-0aa4523ab6e-20210909T130849Z-avarab@gmail.com/

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase: fix todo-list rereading</title>
<updated>2021-09-24T15:56:28Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2021-09-23T15:26:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2b88fe0603a93314b96f94b22e197b7b1b838c80'/>
<id>urn:sha1:2b88fe0603a93314b96f94b22e197b7b1b838c80</id>
<content type='text'>
54fd3243da ("rebase -i: reread the todo list if `exec` touched it",
2017-04-26) sought to reread the todo list after running an exec
command only if it had been changed. To accomplish this it checks the
stat data of the todo list after running an exec command to see if it
has changed. Unfortunately there are two problems, firstly the
implementation is buggy we actually reread the list after each exec
which is quadratic in the number of commit lookups and secondly the
design is predicated on using nanosecond time stamps which are not the
default.

The implementation bug stems from the fact that we write a new todo
list to disk before running each command but do not update the stat
data to reflect this[1].

The design problem is that it is possible for the user to edit the
todo list without changing its size or inode which means we have to
rely on the mtime to tell us if it has changed. Unfortunately unless
git is built with USE_NSEC it is possible for the original and edited
list to share the same mtime.

Ideally "git rebase --edit-todo" would set a flag that we would then
check in sequencer.c. Unfortunately this is approach will not work as
there are scripts in the wild that write to the todo list directly
without running "git rebase --edit-todo". Instead of relying on stat
data this patch simply reads the possibly edited todo list and
compares it to the original with memcmp(). This is much faster than
reparsing the todo list each time. This patch reduces the time to run

   git rebase -r -xtrue v2.32.0~100 v2.32.0

which runs 419 exec commands by 6.6%. For comparison fixing the
implementation bug in stat based approach reduces the time by a
further 1.4% and is indistinguishable from never rereading the todo
list.

[1] https://lore.kernel.org/git/20191125131833.GD23183@szeder.dev/

Reported-by: SZEDER Gábor &lt;szeder.dev@gmail.com&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>sequencer: restrict scope of a formerly public function</title>
<updated>2021-09-08T04:45:33Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2021-09-07T21:05:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=17919c3585ba9df9c65ea4a5f7300543dfba5f9f'/>
<id>urn:sha1:17919c3585ba9df9c65ea4a5f7300543dfba5f9f</id>
<content type='text'>
The function to add the `exec` commands to the todo list only needed to
be public API because it was not only used internally by the sequencer,
but also by `git rebase --preserve-merges`.

Now that that mode has been removed, we no longer need that function to
be scoped publicly.

Helped-by: Alban Gruin &lt;alban.gruin@gmail.com&gt;
Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Reviewed-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sequencer: advise if skipping cherry-picked commit</title>
<updated>2021-08-30T23:35:36Z</updated>
<author>
<name>Josh Steadmon</name>
<email>steadmon@google.com</email>
</author>
<published>2021-08-30T21:46:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=767a4ca648f8791c1fb623bd9f79fd8d7f026499'/>
<id>urn:sha1:767a4ca648f8791c1fb623bd9f79fd8d7f026499</id>
<content type='text'>
Silently skipping commits when rebasing with --no-reapply-cherry-picks
(currently the default behavior) can cause user confusion. Issue
warnings when this happens, as well as advice on how to preserve the
skipped commits.

These warnings and advice are displayed only when using the (default)
"merge" rebase backend.

Update the git-rebase docs to mention the warnings and advice.

Signed-off-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sequencer: fix edit handling for cherry-pick and revert messages</title>
<updated>2021-03-31T21:10:50Z</updated>
<author>
<name>Elijah Newren</name>
<email>newren@gmail.com</email>
</author>
<published>2021-03-31T06:52:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=39edfd5cbc4d168db19ec1bc867d78ec7211ec39'/>
<id>urn:sha1:39edfd5cbc4d168db19ec1bc867d78ec7211ec39</id>
<content type='text'>
save_opts() should save any non-default values.  It was intended to do
this, but since most options in struct replay_opts default to 0, it only
saved non-zero values.  Unfortunately, this does not always work for
options.edit.  Roughly speaking, options.edit had a default value of 0
for cherry-pick but a default value of 1 for revert.  Make save_opts()
record a value whenever it differs from the default.

options.edit was also overly simplistic; we had more than two cases.
The behavior that previously existed was as follows:

                       Non-conflict commits    Right after Conflict
    revert             Edit iff isatty(0)      Edit (ignore isatty(0))
    cherry-pick        No edit                 See above
    Specify --edit     Edit (ignore isatty(0)) See above
    Specify --no-edit  (*)                     See above

    (*) Before stopping for conflicts, No edit is the behavior.  After
        stopping for conflicts, the --no-edit flag is not saved so see
        the first two rows.

However, the expected behavior is:

                       Non-conflict commits    Right after Conflict
    revert             Edit iff isatty(0)      Edit iff isatty(0)
    cherry-pick        No edit                 Edit iff isatty(0)
    Specify --edit     Edit (ignore isatty(0)) Edit (ignore isatty(0))
    Specify --no-edit  No edit                 No edit

In order to get the expected behavior, we need to change options.edit
to a tri-state: unspecified, false, or true.  When specified, we follow
what it says.  When unspecified, we need to check whether the current
commit being created is resolving a conflict as well as consulting
options.action and isatty(0).  While at it, add a should_edit() utility
function that compresses options.edit down to a boolean based on the
additional information for the non-conflict case.

continue_single_pick() is the function responsible for resuming after
conflict cases, regardless of whether there is one commit being picked
or many.  Make this function stop assuming edit behavior in all cases,
so that it can correctly handle !isatty(0) and specific requests to not
edit the commit message.

Reported-by: Renato Botelho &lt;garga@freebsd.org&gt;
Signed-off-by: Elijah Newren &lt;newren@gmail.com&gt;
Reviewed-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
