Skip to content

Commit c757aa2

Browse files
committed
Merge branch 'js/pull-rebase-type-shorthand'
"git pull --rebase=interactive" learned "i" as a short-hand for "interactive". * js/pull-rebase-type-shorthand: pull --rebase=<type>: allow single-letter abbreviations for the type
2 parents f74e7b8 + 46af44b commit c757aa2

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

builtin/pull.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ static enum rebase_type parse_config_rebase(const char *key, const char *value,
4848
return REBASE_FALSE;
4949
else if (v > 0)
5050
return REBASE_TRUE;
51-
else if (!strcmp(value, "preserve"))
51+
else if (!strcmp(value, "preserve") || !strcmp(value, "p"))
5252
return REBASE_PRESERVE;
53-
else if (!strcmp(value, "merges"))
53+
else if (!strcmp(value, "merges") || !strcmp(value, "m"))
5454
return REBASE_MERGES;
55-
else if (!strcmp(value, "interactive"))
55+
else if (!strcmp(value, "interactive") || !strcmp(value, "i"))
5656
return REBASE_INTERACTIVE;
5757

5858
if (fatal)

t/t5520-pull.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,22 @@ test_expect_success 'pull.rebase=interactive' '
475475
false
476476
EOF
477477
test_set_editor "$TRASH_DIRECTORY/fake-editor" &&
478+
test_when_finished "test_might_fail git rebase --abort" &&
478479
test_must_fail git pull --rebase=interactive . copy &&
479480
test "I was here" = "$(cat fake.out)"
480481
'
481482

483+
test_expect_success 'pull --rebase=i' '
484+
write_script "$TRASH_DIRECTORY/fake-editor" <<-\EOF &&
485+
echo I was here, too >fake.out &&
486+
false
487+
EOF
488+
test_set_editor "$TRASH_DIRECTORY/fake-editor" &&
489+
test_when_finished "test_might_fail git rebase --abort" &&
490+
test_must_fail git pull --rebase=i . copy &&
491+
test "I was here, too" = "$(cat fake.out)"
492+
'
493+
482494
test_expect_success 'pull.rebase=invalid fails' '
483495
git reset --hard before-preserve-rebase &&
484496
test_config pull.rebase invalid &&

0 commit comments

Comments
 (0)