Re: [PATCH 23/33] notes-merge: convert merge_from_diffs to struct object_id
- From
Stefan Beller <sbeller@google.com>
- Date
- May 31, 2017, 18:04 UTC
- Message-ID
- <CAGZ79kajzJGdN1uu5kni3AB31joP5hdnsWp1NBGkX3Rs-BkPpw@mail.gmail.com>
- In-Reply-To
- <20170530173109.54904-24-bmwill@google.com>
Show 20 quoted lines
> @@ -505,16 +505,17 @@ static int merge_changes(struct notes_merge_options *o,
> }
>
> static int merge_from_diffs(struct notes_merge_options *o,
> - const unsigned char *base,
> - const unsigned char *local,
> - const unsigned char *remote, struct notes_tree *t)
> + const struct object_id *base,
> + const struct object_id *local,
> + const struct object_id *remote,
> + struct notes_tree *t)
> {
> struct notes_merge_pair *changes;
> int num_changes, conflicts;
>
> trace_printf("\tmerge_from_diffs(base = %.7s, local = %.7s, "
> - "remote = %.7s)\n", sha1_to_hex(base), sha1_to_hex(local),
> - sha1_to_hex(remote));
> + "remote = %.7s)\n", oid_to_hex(base), oid_to_hex(local),
> + oid_to_hex(remote));This part is interesting.
7 used to be the default abbreviation length for sha1s (see e6c587c733 (abbrev: auto size the default abbreviation, 2016-09-30) for details) and this may have been a left over from the conversion to variable length abbreviated hashes. This could be a reminder we want to fix these, too. (Though not in this series?).
Roughly like
trace_printf("\tmerge_from_diffs(base = %s, local = %s, remote = %s)\n",
find_unique_abbrev(base.hash, DEFAULT_ABBREV),
find_unique_abbrev(local.hash, DEFAULT_ABBREV)
find_unique_abbrev(remote.hash, DEFAULT_ABBREV));