<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/sequencer.c, branch v2.25.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.25.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.25.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-03-17T22:02:21Z</updated>
<entry>
<title>Merge branch 'js/rebase-i-with-colliding-hash' into maint</title>
<updated>2020-03-17T22:02:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-03-17T22:02:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fa24bbe8645281b66213b47909864495fc5f7536'/>
<id>urn:sha1:fa24bbe8645281b66213b47909864495fc5f7536</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>
<entry>
<title>avoid computing zero offsets from NULL pointer</title>
<updated>2020-01-29T07:12:48Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2020-01-29T05:46:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d20bc01a51f7899deb7a04bdd7c2495789185297'/>
<id>urn:sha1:d20bc01a51f7899deb7a04bdd7c2495789185297</id>
<content type='text'>
The Undefined Behavior Sanitizer in clang-11 seems to have learned a new
trick: it complains about computing offsets from a NULL pointer, even if
that offset is 0. This causes numerous test failures. For example, from
t1090:

  unpack-trees.c:1355:41: runtime error: applying zero offset to null pointer
  ...
  not ok 6 - in partial clone, sparse checkout only fetches needed blobs

The code in question looks like this:

  struct cache_entry **cache_end = cache + nr;
  ...
  while (cache != cache_end)

and we sometimes pass in a NULL and 0 for "cache" and "nr". This is
conceptually fine, as "cache_end" would be equal to "cache" in this
case, and we wouldn't enter the loop at all. But computing even a zero
offset violates the C standard. And given the fact that UBSan is
noticing this behavior, this might be a potential problem spot if the
compiler starts making unexpected assumptions based on undefined
behavior.

So let's just avoid it, which is pretty easy. In some cases we can just
switch to iterating with a numeric index (as we do in sequencer.c here).
In other cases (like the cache_end one) the use of an end pointer is
more natural; we can keep that by just explicitly checking for the
NULL/0 case when assigning the end pointer.

Note that there are two ways you can write this latter case, checking
for the pointer:

  cache_end = cache ? cache + nr : cache;

or the size:

  cache_end = nr ? cache + nr : cache;

For the case of a NULL/0 ptr/len combo, they are equivalent. But writing
it the second way (as this patch does) has the property that if somebody
were to incorrectly pass a NULL pointer with a non-zero length, we'd
continue to notice and segfault, rather than silently pretending the
length was zero.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>rebase -i: re-fix short SHA-1 collision</title>
<updated>2020-01-23T20:48:11Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-01-23T12:28:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b6992261deb1c32e11998b19467ecd4d328ba049'/>
<id>urn:sha1:b6992261deb1c32e11998b19467ecd4d328ba049</id>
<content type='text'>
In 66ae9a57b88 (t3404: rebase -i: demonstrate short SHA-1 collision,
2013-08-23), we added a test case that demonstrated how it is possible
that a previously unambiguous short commit ID could become ambiguous
*during* a rebase.

In 75c69766554 (rebase -i: fix short SHA-1 collision, 2013-08-23), we
fixed that problem simply by writing out the todo list with expanded
commit IDs (except *right* before letting the user edit the todo list,
in which case we shorten them, but we expand them right after the file
was edited).

However, the bug resurfaced as a side effect of 393adf7a6f6 (sequencer:
directly call pick_commits() from complete_action(), 2019-11-24): as of
this commit, the sequencer no longer re-reads the todo list after
writing it out with expanded commit IDs.

The only redeeming factor is that the todo list is already parsed at
that stage, including all the commits corresponding to the commands,
therefore the sequencer can continue even if the internal todo list has
short commit IDs.

That does not prevent problems, though: the sequencer writes out the
`done` and `git-rebase-todo` files incrementally (i.e. overwriting the
todo list with a version that has _short_ commit IDs), and if a merge
conflict happens, or if an `edit` or a `break` command is encountered, a
subsequent `git rebase --continue` _will_ re-read the todo list, opening
an opportunity for the "short SHA-1 collision" bug again.

To avoid that, let's make sure that we do expand the commit IDs in the
todo list as soon as we have parsed it after letting the user edit it.

Additionally, we improve the 'short SHA-1 collide' test case in t3404 to
test specifically for the case where the rebase is resumed. We also
hard-code the expected colliding short SHA-1s, to document the
expectation (and to make it easier on future readers).

Note that we specifically test that the short commit ID is used in the
`git-rebase-todo.tmp` file: this file is created by the fake editor in
the test script and reflects the state that would have been presented to
the user to edit.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>parse_insn_line(): improve error message when parsing failed</title>
<updated>2020-01-23T20:48:05Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-01-23T12:28:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d859dcad945755ad7d3ada843eecf2843b3c5470'/>
<id>urn:sha1:d859dcad945755ad7d3ada843eecf2843b3c5470</id>
<content type='text'>
In the case that a `get_oid()` call failed, we showed some rather bogus
part of the line instead of the precise string we sent to said function.
That makes it rather hard for users to understand what is going wrong,
so let's fix that.

While at it, return a negative value from `parse_insn_line()` in case of
an error, as per our convention. This function's only caller,
`todo_list_parse_insn_buffer()`, cares only whether that return value is
non-zero or not, i.e. does not need to be changed.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Revert "Merge branch 'ra/rebase-i-more-options'"</title>
<updated>2020-01-12T21:25:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-01-12T20:27:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4d924528d8bfe947abfc54ee9bd3892ab509c8cd'/>
<id>urn:sha1:4d924528d8bfe947abfc54ee9bd3892ab509c8cd</id>
<content type='text'>
This reverts commit 5d9324e0f4210bb7d52bcb79efe3935703083f72, reversing
changes made to c58ae96fc4bb11916b62a96940bb70bb85ea5992.

The topic turns out to be too buggy for real use.

cf. &lt;f2fe7437-8a48-3315-4d3f-8d51fe4bb8f1@gmail.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ag/sequencer-todo-updates'</title>
<updated>2019-12-16T21:08:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-12-16T21:08:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=37c2619d91aa63d4c7c07b6f8de5ff2e1c2472b2'/>
<id>urn:sha1:37c2619d91aa63d4c7c07b6f8de5ff2e1c2472b2</id>
<content type='text'>
Reduce unnecessary reading of state variables back from the disk
during sequencer operation.

* ag/sequencer-todo-updates:
  sequencer: directly call pick_commits() from complete_action()
  rebase: fill `squash_onto' in get_replay_opts()
  sequencer: move the code writing total_nr on the disk to a new function
  sequencer: update `done_nr' when skipping commands in a todo list
  sequencer: update `total_nr' when adding an item to a todo list
</content>
</entry>
<entry>
<title>Merge branch 'ag/sequencer-continue-leakfix'</title>
<updated>2019-12-10T21:11:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-12-10T21:11:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7cc5f890882214c12c08067404321043fb93e048'/>
<id>urn:sha1:7cc5f890882214c12c08067404321043fb93e048</id>
<content type='text'>
Leakfix.

* ag/sequencer-continue-leakfix:
  sequencer: fix a memory leak in sequencer_continue()
</content>
</entry>
<entry>
<title>Merge branch 'ra/rebase-i-more-options'</title>
<updated>2019-12-10T21:11:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-12-10T21:11:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5d9324e0f4210bb7d52bcb79efe3935703083f72'/>
<id>urn:sha1:5d9324e0f4210bb7d52bcb79efe3935703083f72</id>
<content type='text'>
"git rebase -i" learned a few options that are known by "git
rebase" proper.

* ra/rebase-i-more-options:
  rebase -i: finishing touches to --reset-author-date
  rebase: add --reset-author-date
  rebase -i: support --ignore-date
  sequencer: rename amend_author to author_to_rename
  rebase -i: support --committer-date-is-author-date
  sequencer: allow callers of read_author_script() to ignore fields
  rebase -i: add --ignore-whitespace flag
</content>
</entry>
<entry>
<title>Merge branch 'sg/assume-no-todo-update-in-cherry-pick'</title>
<updated>2019-12-06T23:09:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-12-06T23:09:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f233c9f4550a831a69892e0a38db2a7654beb995'/>
<id>urn:sha1:f233c9f4550a831a69892e0a38db2a7654beb995</id>
<content type='text'>
While running "revert" or "cherry-pick --edit" for multiple
commits, a recent regression incorrectly detected "nothing to
commit, working tree clean", instead of replaying the commits,
which has been corrected.

* sg/assume-no-todo-update-in-cherry-pick:
  sequencer: don't re-read todo for revert and cherry-pick
</content>
</entry>
<entry>
<title>Merge branch 'pw/sequencer-compare-with-right-parent-to-check-empty-commits'</title>
<updated>2019-12-05T20:52:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-12-05T20:52:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c9208597a986509e6ce9b3c7936fd7a2b3bb3e43'/>
<id>urn:sha1:c9208597a986509e6ce9b3c7936fd7a2b3bb3e43</id>
<content type='text'>
The sequencer machinery compared the HEAD and the state it is
attempting to commit to decide if the result would be a no-op
commit, even when amending a commit, which was incorrect, and
has been corrected.

* pw/sequencer-compare-with-right-parent-to-check-empty-commits:
  sequencer: fix empty commit check when amending
</content>
</entry>
</feed>
