Skip to content

Commit 4499a42

Browse files
committed
Merge branch 'ak/sequencer-fix-find-uniq-abbrev'
Ring buffer with size 4 used for bin-hex translation resulted in a wrong object name in the sequencer's todo output, which has been corrected. * ak/sequencer-fix-find-uniq-abbrev: rebase -i: fix possibly wrong onto hash in todo
2 parents 6cceea1 + 5da69c0 commit 4499a42

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

sequencer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5178,13 +5178,14 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
51785178
struct string_list *commands, unsigned autosquash,
51795179
struct todo_list *todo_list)
51805180
{
5181-
const char *shortonto, *todo_file = rebase_path_todo();
5181+
char shortonto[GIT_MAX_HEXSZ + 1];
5182+
const char *todo_file = rebase_path_todo();
51825183
struct todo_list new_todo = TODO_LIST_INIT;
51835184
struct strbuf *buf = &todo_list->buf, buf2 = STRBUF_INIT;
51845185
struct object_id oid = onto->object.oid;
51855186
int res;
51865187

5187-
shortonto = find_unique_abbrev(&oid, DEFAULT_ABBREV);
5188+
find_unique_abbrev_r(shortonto, &oid, DEFAULT_ABBREV);
51885189

51895190
if (buf->len == 0) {
51905191
struct todo_item *item = append_new_todo(todo_list);

t/t3404-rebase-interactive.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,12 @@ test_expect_success 'correct error message for commit --amend after empty pick'
17911791
test_i18ngrep "middle of a rebase -- cannot amend." err
17921792
'
17931793

1794+
test_expect_success 'todo has correct onto hash' '
1795+
GIT_SEQUENCE_EDITOR=cat git rebase -i no-conflict-branch~4 no-conflict-branch >actual &&
1796+
onto=$(git rev-parse --short HEAD~4) &&
1797+
test_i18ngrep "^# Rebase ..* onto $onto" actual
1798+
'
1799+
17941800
# This must be the last test in this file
17951801
test_expect_success '$EDITOR and friends are unchanged' '
17961802
test_editor_unchanged

0 commit comments

Comments
 (0)