Skip to content

Commit 3e1dbfa

Browse files
committed
Merge branch 'en/rebase-x-fix'
"git rebase -x" added an unnecessary 'exec' instructions before 'noop', which has been corrected. * en/rebase-x-fix: sequencer: avoid adding exec commands for non-commit creating commands
2 parents 7d53ff4 + cc9dcde commit 3e1dbfa

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5502,7 +5502,7 @@ static void todo_list_add_exec_commands(struct todo_list *todo_list,
55025502
}
55035503

55045504
/* insert or append final <commands> */
5505-
if (insert || nr == todo_list->nr) {
5505+
if (insert) {
55065506
ALLOC_GROW(items, nr + commands->nr, alloc);
55075507
COPY_ARRAY(items + nr, base_items, commands->nr);
55085508
nr += commands->nr;

t/t3429-rebase-edit-todo.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@ test_expect_success 'setup' '
1313

1414
test_expect_success 'rebase exec modifies rebase-todo' '
1515
todo=.git/rebase-merge/git-rebase-todo &&
16-
git rebase HEAD -x "echo exec touch F >>$todo" &&
16+
git rebase HEAD~1 -x "echo exec touch F >>$todo" &&
1717
test -e F
1818
'
1919

20+
test_expect_success 'rebase exec with an empty list does not exec anything' '
21+
git rebase HEAD -x "true" 2>output &&
22+
! grep "Executing: true" output
23+
'
24+
2025
test_expect_success 'loose object cache vs re-reading todo list' '
2126
GIT_REBASE_TODO=.git/rebase-merge/git-rebase-todo &&
2227
export GIT_REBASE_TODO &&

0 commit comments

Comments
 (0)