Re: [PATCH 4/8] rebase-helper --make-script: introduce a flag to recreate merges
From: Eric Sunshine <hidden>
Date: 2018-01-19 10:34:27
On Thu, Jan 18, 2018 at 10:35 AM, Johannes Schindelin [off-list ref] wrote:
The sequencer just learned a new commands intended to recreate branch
s/a //
quoted hunk ↗ jump to hunk
structure (similar in spirit to --preserve-merges, but with a substantially less-broken design). [...] Signed-off-by: Johannes Schindelin <redacted> ---diff --git a/sequencer.c b/sequencer.c@@ -2785,6 +2787,335 @@ void append_signoff(struct strbuf *msgbuf, int ignore_footer, unsigned flag) +static const char *label_oid(struct object_id *oid, const char *label, + struct label_state *state) +{ + [...] + } else if (((len = strlen(label)) == GIT_SHA1_RAWSZ && + !get_oid_hex(label, &dummy)) || + hashmap_get_from_hash(&state->labels, + strihash(label), label)) { + /* + * If the label already exists, or if the label is a valid full + * OID, we append a dash and a number to make it unique. + */ + [...] + for (i = 2; ; i++) {
Why '2'? Is there some non-obvious significance to this value?
+ strbuf_setlen(buf, len);
+ strbuf_addf(buf, "-%d", i);
+ if (!hashmap_get_from_hash(&state->labels,
+ strihash(buf->buf),
+ buf->buf))
+ break;
+ }
+
+static int make_script_with_merges(struct pretty_print_context *pp,
+ struct rev_info *revs, FILE *out,
+ unsigned flags)
+{
+ [...]
+ is_octopus = to_merge && to_merge->next;
+
+ if (is_octopus)
+ BUG("Octopus merges not yet supported");Is this a situation which the end-user can trigger by specifying a merge with more than two parents? If so, shouldn't this be just a normal error message rather than a (developer) bug message? Or, am I misunderstanding?