diff options
author | Alex Henrie <alexhenrie24@gmail.com> | 2020-03-10 03:54:20 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-03-10 20:06:41 (GMT) |
commit | d18c950a69f3a24e1e3add3d9fc427641f53e12b (patch) | |
tree | cbaf69e10bf4d7397748baa56d47bc7e3e5844f8 /t/t7601-merge-pull-config.sh | |
parent | 2d2118b814c11f509e1aa76cb07110f7231668dc (diff) | |
download | git-d18c950a69f3a24e1e3add3d9fc427641f53e12b.zip git-d18c950a69f3a24e1e3add3d9fc427641f53e12b.tar.gz git-d18c950a69f3a24e1e3add3d9fc427641f53e12b.tar.bz2 |
pull: warn if the user didn't say whether to rebase or to merge
Often novice Git users forget to say "pull --rebase" and end up with an
unnecessary merge from upstream. What they usually want is either "pull
--rebase" in the simpler cases, or "pull --ff-only" to update the copy
of main integration branches, and rebase their work separately. The
pull.rebase configuration variable exists to help them in the simpler
cases, but there is no mechanism to make these users aware of it.
Issue a warning message when no --[no-]rebase option from the command
line and no pull.rebase configuration variable is given. This will
inconvenience those who never want to "pull --rebase", who haven't had
to do anything special, but the cost of the inconvenience is paid only
once per user, which should be a reasonable cost to help a number of new
users.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7601-merge-pull-config.sh')
-rwxr-xr-x | t/t7601-merge-pull-config.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh index c6c44ec..0f97828 100755 --- a/t/t7601-merge-pull-config.sh +++ b/t/t7601-merge-pull-config.sh @@ -27,6 +27,44 @@ test_expect_success 'setup' ' git tag c3 ' +test_expect_success 'pull.rebase not set' ' + git reset --hard c0 && + git pull . c1 2>err && + test_i18ngrep "Pulling without specifying how to reconcile" err +' + +test_expect_success 'pull.rebase not set and pull.ff=false' ' + git reset --hard c0 && + test_config pull.ff false && + git pull . c1 2>err && + test_i18ngrep "Pulling without specifying how to reconcile" err +' + +test_expect_success 'pull.rebase not set and pull.ff=only' ' + git reset --hard c0 && + test_config pull.ff only && + git pull . c1 2>err && + test_i18ngrep ! "Pulling without specifying how to reconcile" err +' + +test_expect_success 'pull.rebase not set and --rebase given' ' + git reset --hard c0 && + git pull --rebase . c1 2>err && + test_i18ngrep ! "Pulling without specifying how to reconcile" err +' + +test_expect_success 'pull.rebase not set and --no-rebase given' ' + git reset --hard c0 && + git pull --no-rebase . c1 2>err && + test_i18ngrep ! "Pulling without specifying how to reconcile" err +' + +test_expect_success 'pull.rebase not set and --ff-only given' ' + git reset --hard c0 && + git pull --ff-only . c1 2>err && + test_i18ngrep ! "Pulling without specifying how to reconcile" err +' + test_expect_success 'merge c1 with c2' ' git reset --hard c1 && test -f c0.c && |