git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Alban Gruin <alban.gruin@gmail.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH v2 0/3] Re-fix rebase -i with SHA-1 collisions
Date: Fri, 17 Jan 2020 23:38:00 +0000	[thread overview]
Message-ID: <pull.529.v2.git.1579304283.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.529.git.1579209506.gitgitgadget@gmail.com>

Triggered by one of brian's SHA-256 patch series, I looked at the reason why
the SHA-1 collision test case passed when it shouldn't. Turns out that the
regression test was not quite thorough enough, and the interactive rebase 
did regress recently.

While in the area, I realized that the same bug exists in the code backing
the rebase.missingCommitsCheck feature: the backed-up todo list uses
shortened commit IDs that may very well become ambiguous during the rebase.
For good measure, this patch series fixes that, too.

Finally, I saw that git rebase --edit-todo reported the line in an awkward,
maybe even incorrect, way when there was an ambiguous commit ID, and I also
fixed that.

To make sure that the code can be easily adapted to SHA-256 after these
patches, I actually already made those adjustments on top and offered them
up at https://github.com/bk2204/git/pull/1.

Changes since v1:

 * Turned the error condition when parsing the todo list with just-expanded
   commit IDs failed into a BUG().

Johannes Schindelin (3):
  parse_insn_line(): improve error message when parsing failed
  rebase -i: re-fix short SHA-1 collision
  rebase -i: also avoid SHA-1 collisions with missingCommitsCheck

 rebase-interactive.c          |  8 +++++---
 sequencer.c                   | 18 ++++++++++++++----
 t/t3404-rebase-interactive.sh | 17 +++++++++++++++--
 3 files changed, 34 insertions(+), 9 deletions(-)


base-commit: d0654dc308b0ba76dd8ed7bbb33c8d8f7aacd783
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-529%2Fdscho%2Fre-fix-rebase-i-with-sha-collisions-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-529/dscho/re-fix-rebase-i-with-sha-collisions-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/529

Range-diff vs v1:

 1:  2ae2e435b0 = 1:  2ae2e435b0 parse_insn_line(): improve error message when parsing failed
 2:  ad50cd1b92 ! 2:  102fa568dc rebase -i: re-fix short SHA-1 collision
     @@ -66,12 +66,9 @@
      +	strbuf_swap(&new_todo.buf, &buf2);
      +	strbuf_release(&buf2);
      +	new_todo.total_nr -= new_todo.nr;
     -+	if (todo_list_parse_insn_buffer(r, new_todo.buf.buf, &new_todo) < 0) {
     -+		fprintf(stderr, _(edit_todo_list_advice));
     -+		checkout_onto(r, opts, onto_name, &onto->object.oid, orig_head);
     -+		todo_list_release(&new_todo);
     -+		return error(_("invalid todo list after expanding IDs"));
     -+	}
     ++	if (todo_list_parse_insn_buffer(r, new_todo.buf.buf, &new_todo) < 0)
     ++		BUG("invalid todo list after expanding IDs:\n%s",
     ++		    new_todo.buf.buf);
      +
       	if (opts->allow_ff && skip_unnecessary_picks(r, &new_todo, &oid)) {
       		todo_list_release(&new_todo);
 3:  e7d9ea8992 = 3:  486e9413a6 rebase -i: also avoid SHA-1 collisions with missingCommitsCheck

-- 
gitgitgadget

  parent reply	other threads:[~2020-01-17 23:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16 21:18 [PATCH 0/3] Re-fix rebase -i with SHA-1 collisions Johannes Schindelin via GitGitGadget
2020-01-16 21:18 ` [PATCH 1/3] parse_insn_line(): improve error message when parsing failed Johannes Schindelin via GitGitGadget
2020-01-17 18:00   ` Junio C Hamano
2020-01-16 21:18 ` [PATCH 2/3] rebase -i: re-fix short SHA-1 collision Johannes Schindelin via GitGitGadget
2020-01-17 18:30   ` Junio C Hamano
2020-01-17 21:31     ` Johannes Schindelin
2020-01-16 21:18 ` [PATCH 3/3] rebase -i: also avoid SHA-1 collisions with missingCommitsCheck Johannes Schindelin via GitGitGadget
2020-01-16 23:54 ` [PATCH 0/3] Re-fix rebase -i with SHA-1 collisions brian m. carlson
2020-01-17  9:51   ` Johannes Schindelin
2020-01-17 22:37     ` brian m. carlson
2020-01-21 18:00       ` Junio C Hamano
2020-01-17 23:38 ` Johannes Schindelin via GitGitGadget [this message]
2020-01-17 23:38   ` [PATCH v2 1/3] parse_insn_line(): improve error message when parsing failed Johannes Schindelin via GitGitGadget
2020-01-21 22:04     ` Junio C Hamano
2020-01-23 12:26       ` Johannes Schindelin
2020-01-17 23:38   ` [PATCH v2 2/3] rebase -i: re-fix short SHA-1 collision Johannes Schindelin via GitGitGadget
2020-01-20 16:49     ` Eric Sunshine
2020-01-20 20:04       ` Johannes Schindelin
2020-01-20 20:08         ` Eric Sunshine
2020-01-21 11:49           ` Johannes Schindelin
2020-01-21 22:02           ` Junio C Hamano
2020-01-22 14:10             ` Johannes Schindelin
2020-01-22 18:15               ` Junio C Hamano
2020-01-17 23:38   ` [PATCH v2 3/3] rebase -i: also avoid SHA-1 collisions with missingCommitsCheck Johannes Schindelin via GitGitGadget
2020-01-23 12:28   ` [PATCH v3 0/3] Re-fix rebase -i with SHA-1 collisions Johannes Schindelin via GitGitGadget
2020-01-23 12:28     ` [PATCH v3 1/3] parse_insn_line(): improve error message when parsing failed Johannes Schindelin via GitGitGadget
2020-01-23 12:28     ` [PATCH v3 2/3] rebase -i: re-fix short SHA-1 collision Johannes Schindelin via GitGitGadget
2020-01-23 12:28     ` [PATCH v3 3/3] rebase -i: also avoid SHA-1 collisions with missingCommitsCheck Johannes Schindelin via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.529.v2.git.1579304283.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=alban.gruin@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=sandals@crustytoothpaste.net \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).