rebase -i: simplify get_revision_ranges()

Now that all the external users of head_hash have been converted to use a opts->orig_head instead we can stop returning head_hash from get_revision_ranges(). Because we want to pass the full object names back to the caller in `revisions` the find_unique_abbrev_r() call that was used to initialize `head_hash` is replaced with oid_to_hex(). Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Phillip Wood committed Nov 4, 2020 at 15:29 UTC 8843302307bb7d652f5adde759cd6a3c1a7fb1ea
1 file changed +4 -6
builtin/rebase.c
+4 -6
@@ -270,15 +270,14 @@ static int edit_todo_file(unsigned flags)
270 }
271
272 static int get_revision_ranges(struct commit *upstream, struct commit *onto,
273 - struct object_id *orig_head, char *head_hash,
274 - char **revisions, char **shortrevisions)
273 + struct object_id *orig_head, char **revisions,
274 + char **shortrevisions)
275 {
276 struct commit *base_rev = upstream ? upstream : onto;
277 const char *shorthead;
278
279 - find_unique_abbrev_r(head_hash, orig_head, GIT_MAX_HEXSZ);
279 *revisions = xstrfmt("%s...%s", oid_to_hex(&base_rev->object.oid),
281 - head_hash);
280 + oid_to_hex(orig_head));
281
282 shorthead = find_unique_abbrev(orig_head, DEFAULT_ABBREV);
283
@@ -328,7 +327,6 @@ static void split_exec_commands(const char *cmd, struct string_list *commands)
327 static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
328 {
329 int ret;
331 - char head_hash[GIT_MAX_HEXSZ];
330 char *revisions = NULL, *shortrevisions = NULL;
331 struct strvec make_script_args = STRVEC_INIT;
332 struct todo_list todo_list = TODO_LIST_INIT;
@@ -336,7 +334,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
334 struct string_list commands = STRING_LIST_INIT_DUP;
335
336 if (get_revision_ranges(opts->upstream, opts->onto, &opts->orig_head,
339 - head_hash, &revisions, &shortrevisions))
337 + &revisions, &shortrevisions))
338 return -1;
339
340 if (init_basic_state(&replay,