<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/rebase-interactive.c, branch v2.40.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.40.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.40.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-07-19T19:49:04Z</updated>
<entry>
<title>sequencer: rewrite update-refs as user edits todo list</title>
<updated>2022-07-19T19:49:04Z</updated>
<author>
<name>Derrick Stolee</name>
<email>derrickstolee@github.com</email>
</author>
<published>2022-07-19T18:33:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b3b1a21d1a5df87e81fa8b53c6c3cf9760ca12d4'/>
<id>urn:sha1:b3b1a21d1a5df87e81fa8b53c6c3cf9760ca12d4</id>
<content type='text'>
An interactive rebase provides opportunities for the user to edit the
todo list. The --update-refs option initializes the list with some
'update-ref &lt;ref&gt;' steps, but the user could add these manually.
Further, the user could add or remove these steps during pauses in the
interactive rebase.

Add a new method, todo_list_filter_update_refs(), that scans a todo_list
and compares it to the stored update-refs file. There are two actions
that can happen at this point:

1. If a '&lt;ref&gt;/&lt;before&gt;/&lt;after&gt;' triple in the update-refs file does not
   have a matching 'update-ref &lt;ref&gt;' command in the todo-list _and_ the
   &lt;after&gt; value is the null OID, then remove that triple. Here, the
   user removed the 'update-ref &lt;ref&gt;' command before it was executed,
   since if it was executed then the &lt;after&gt; value would store the
   commit at that position.

2. If a 'update-ref &lt;ref&gt;' command in the todo-list does not have a
   matching '&lt;ref&gt;/&lt;before&gt;/&lt;after&gt;' triple in the update-refs file,
   then insert a new one. Store the &lt;before&gt; value to be the current
   OID pointed at by &lt;ref&gt;. This is handled inside of the
   init_update_ref_record() helper method.

We can test that this works by rewriting the todo-list several times in
the course of a rebase. Check that each ref is locked or unlocked for
updates after each todo-list update. We can also verify that the ref
update fails if a concurrent process updates one of the refs after the
rebase process records the "locked" ref location.

To help these tests, add a new 'set_replace_editor' helper that will
replace the todo-list with an exact file.

Reported-by: Phillip Wood &lt;phillip.wood123@gmail.com&gt;
Signed-off-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sequencer: add update-ref command</title>
<updated>2022-07-19T19:49:03Z</updated>
<author>
<name>Derrick Stolee</name>
<email>derrickstolee@github.com</email>
</author>
<published>2022-07-19T18:33:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a97d79163e16e2d3777ab4d86c8f006f260c2836'/>
<id>urn:sha1:a97d79163e16e2d3777ab4d86c8f006f260c2836</id>
<content type='text'>
Add the boilerplate for an "update-ref" command in the sequencer. This
connects to the current no-op do_update_ref() which will be filled in
after more connections are created.

The syntax in the todo list will be "update-ref &lt;ref-name&gt;" to signal
that we should store the current commit as the value for updating
&lt;ref-name&gt; at the end of the rebase.

Signed-off-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase-interactive: update 'merge' description</title>
<updated>2022-07-19T19:49:03Z</updated>
<author>
<name>Derrick Stolee</name>
<email>derrickstolee@github.com</email>
</author>
<published>2022-07-19T18:33:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f57fd48d56864ed9a09d65cffe2c70b86ca7b652'/>
<id>urn:sha1:f57fd48d56864ed9a09d65cffe2c70b86ca7b652</id>
<content type='text'>
The 'merge' command description for the todo list documentation in an
interactive rebase has multiple lines. The lines other than the first
one start with dots ('.') while the similar multi-line documentation for
'fixup' does not. This description only appears in the comment text of
the todo file during an interactive rebase.

The 'merge' command was documented when interactive rebase was first
ported to C in 145e05ac44b (rebase -i: rewrite append_todo_help() in C,
2018-08-10). These dots might have been carried over from the previous
shell implementation.

The 'fixup' command was documented more recently in 9e3cebd97cb (rebase
-i: add fixup [-C | -c] command, 2021-01-29).

Looking at the output in an editor, my personal opinion is that the dots
are unnecessary and noisy. Remove them now before adding more commands
with multi-line documentation.

Signed-off-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase: remove a no-longer-used 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:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=06aa5e4ea4f2c5bbf5ae80f31b0dbd5df267ba74'/>
<id>urn:sha1:06aa5e4ea4f2c5bbf5ae80f31b0dbd5df267ba74</id>
<content type='text'>
With the `--preserve-merges` option going away, we no longer need this
function.

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>rebase -i: clarify and fix 'fixup -c' rebase-todo help</title>
<updated>2021-02-10T21:58:19Z</updated>
<author>
<name>Charvi Mendiratta</name>
<email>charvi077@gmail.com</email>
</author>
<published>2021-02-10T11:36:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f07871d302c32777de25b3fde3c621be3b2e32c3'/>
<id>urn:sha1:f07871d302c32777de25b3fde3c621be3b2e32c3</id>
<content type='text'>
When `-c` says "edit the commit message" it's not clear what will be
edited. The original's commit message or the replacement's message or a
combination of the two. Word it such that it states more precisely what
exactly will be edited. While at it, also drop the jarring period and
capitalization, neither of which is otherwise present in the message.

Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Mentored-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Helped-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Charvi Mendiratta &lt;charvi077@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase -i: add fixup [-C | -c] command</title>
<updated>2021-01-29T23:21:56Z</updated>
<author>
<name>Charvi Mendiratta</name>
<email>charvi077@gmail.com</email>
</author>
<published>2021-01-29T18:20:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9e3cebd97cbd47909e683e617d5ffa2781f0adaa'/>
<id>urn:sha1:9e3cebd97cbd47909e683e617d5ffa2781f0adaa</id>
<content type='text'>
Add options to `fixup` command to fixup both the commit contents and
message. `fixup -C` command is used to replace the original commit
message and `fixup -c`, additionally allows to edit the commit message.

Original-patch-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Mentored-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Charvi Mendiratta &lt;charvi077@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rt/format-zero-length-fix'</title>
<updated>2020-03-09T18:21:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-03-09T18:21:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6125104b88e8bb0539b5d8a43bd0788922402724'/>
<id>urn:sha1:6125104b88e8bb0539b5d8a43bd0788922402724</id>
<content type='text'>
Recently we inadvertently added a few instances of using 0-width
format string to functions that we mark as printf-like without any
developers noticing.  The root cause was that the compiler warning
that is triggered by this is almost always useless and we disabled
the warning in our developer builds, but not for general public.
The new instances have been corrected, and the warning has been
resurrected in the developer builds.

* rt/format-zero-length-fix:
  config.mak.dev: re-enable -Wformat-zero-length
  rebase-interactive.c: silence format-zero-length warnings
</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-interactive.c: silence format-zero-length warnings</title>
<updated>2020-02-28T16:39:09Z</updated>
<author>
<name>Ralf Thielow</name>
<email>ralf.thielow@gmail.com</email>
</author>
<published>2020-02-27T20:25:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7daf4f2ac7b8fdddf6d8e128dc30e7daec7abad2'/>
<id>urn:sha1:7daf4f2ac7b8fdddf6d8e128dc30e7daec7abad2</id>
<content type='text'>
Fixes the following warnings:

rebase-interactive.c: In function ‘edit_todo_list’:
rebase-interactive.c:137:38: warning: zero-length gnu_printf format string [-Wformat-zero-length]
    write_file(rebase_path_dropped(), "");
rebase-interactive.c:144:37: warning: zero-length gnu_printf format string [-Wformat-zero-length]
   write_file(rebase_path_dropped(), "");

Signed-off-by: Ralf Thielow &lt;ralf.thielow@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>
</feed>
