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
This commit is contained in:
Junio C Hamano 2020-08-19 16:14:48 -07:00
Родитель 6cceea19eb 5da69c0dac
Коммит 4499a42d0c
2 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -5178,13 +5178,14 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
struct string_list *commands, unsigned autosquash,
struct todo_list *todo_list)
{
const char *shortonto, *todo_file = rebase_path_todo();
char shortonto[GIT_MAX_HEXSZ + 1];
const char *todo_file = rebase_path_todo();
struct todo_list new_todo = TODO_LIST_INIT;
struct strbuf *buf = &todo_list->buf, buf2 = STRBUF_INIT;
struct object_id oid = onto->object.oid;
int res;
shortonto = find_unique_abbrev(&oid, DEFAULT_ABBREV);
find_unique_abbrev_r(shortonto, &oid, DEFAULT_ABBREV);
if (buf->len == 0) {
struct todo_item *item = append_new_todo(todo_list);

Просмотреть файл

@ -1791,6 +1791,12 @@ test_expect_success 'correct error message for commit --amend after empty pick'
test_i18ngrep "middle of a rebase -- cannot amend." err
'
test_expect_success 'todo has correct onto hash' '
GIT_SEQUENCE_EDITOR=cat git rebase -i no-conflict-branch~4 no-conflict-branch >actual &&
onto=$(git rev-parse --short HEAD~4) &&
test_i18ngrep "^# Rebase ..* onto $onto" actual
'
# This must be the last test in this file
test_expect_success '$EDITOR and friends are unchanged' '
test_editor_unchanged