Skip to content

Commit 8843302

Browse files
phillipwoodgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a2bb10d commit 8843302

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

builtin/rebase.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,14 @@ static int edit_todo_file(unsigned flags)
270270
}
271271

272272
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)
275275
{
276276
struct commit *base_rev = upstream ? upstream : onto;
277277
const char *shorthead;
278278

279-
find_unique_abbrev_r(head_hash, orig_head, GIT_MAX_HEXSZ);
280279
*revisions = xstrfmt("%s...%s", oid_to_hex(&base_rev->object.oid),
281-
head_hash);
280+
oid_to_hex(orig_head));
282281

283282
shorthead = find_unique_abbrev(orig_head, DEFAULT_ABBREV);
284283

@@ -328,15 +327,14 @@ static void split_exec_commands(const char *cmd, struct string_list *commands)
328327
static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
329328
{
330329
int ret;
331-
char head_hash[GIT_MAX_HEXSZ];
332330
char *revisions = NULL, *shortrevisions = NULL;
333331
struct strvec make_script_args = STRVEC_INIT;
334332
struct todo_list todo_list = TODO_LIST_INIT;
335333
struct replay_opts replay = get_replay_opts(opts);
336334
struct string_list commands = STRING_LIST_INIT_DUP;
337335

338336
if (get_revision_ranges(opts->upstream, opts->onto, &opts->orig_head,
339-
head_hash, &revisions, &shortrevisions))
337+
&revisions, &shortrevisions))
340338
return -1;
341339

342340
if (init_basic_state(&replay,

0 commit comments

Comments
 (0)