rebase --merge: fix reflog message after skipping
The reflog message for every pick after running "rebase --skip" looks like rebase (skip) (pick): commit subject line Fix this by not appending " (skip)" to the reflog action. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood committed
Oct 12, 2022 at 09:35 UTC
1f2d5dc4d2bbcae87736fcd7b7c0e6542008c5f7
2 files changed
+24
-2
builtin/rebase.c
-2
@@ -1297,8 +1297,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1297
struct string_list merge_rr = STRING_LIST_INIT_DUP;
1298
1299
options.action = "skip";
1300
- set_reflog_action(&options);
1301
-
1300
rerere_clear(the_repository, &merge_rr);
1301
string_list_clear(&merge_rr, 1);
1302
ropts.flags = RESET_HEAD_HARD;
t/t3406-rebase-message.sh
+24
@@ -163,6 +163,30 @@ test_reflog () {
163
# check there is only one new entry in the branch reflog
164
test_cmp_rev fast-forward@{1} X
165
'
166
+
167
+ test_expect_success "rebase $mode --skip reflog${reflog_action:+ GIT_REFLOG_ACTION=$reflog_action}" '
168
+ git checkout conflicts &&
169
+ test_when_finished "git reset --hard Q" &&
170
+
171
+ (
172
+ if test -n "$reflog_action"
173
+ then
174
+ GIT_REFLOG_ACTION="$reflog_action" &&
175
+ export GIT_REFLOG_ACTION
176
+ fi &&
177
+ test_must_fail git rebase $mode main &&
178
+ git rebase --skip
179
+ ) &&
180
+
181
+ git log -g --format=%gs -4 >actual &&
182
+ write_reflog_expect <<-EOF &&
183
+ ${reflog_action:-rebase} (finish): returning to refs/heads/conflicts
184
+ ${reflog_action:-rebase} (pick): Q
185
+ ${reflog_action:-rebase} (pick): P
186
+ ${reflog_action:-rebase} (start): checkout main
187
+ EOF
188
+ test_cmp expect actual
189
+ '
190
}
191
192
test_reflog --merge