git pull . second:third 2>err &&
test_i18ngrep "fetch updated the current branch head" err &&
test "$(cat file)" = modified &&
- test "$(git rev-parse third)" = "$(git rev-parse second)"
+ test_cmp_rev third second
'
test_expect_success 'fast-forward fails with conflicting work tree' '
test_must_fail git pull . second:third 2>err &&
test_i18ngrep "Cannot fast-forward your working tree" err &&
test "$(cat file)" = conflict &&
- test "$(git rev-parse third)" = "$(git rev-parse second)"
+ test_cmp_rev third second
'
test_expect_success '--rebase' '
git commit -m "new file" &&
git tag before-rebase &&
git pull --rebase . copy &&
- test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^ copy &&
test new = "$(git show HEAD:file2)"
'
git checkout to-rebase &&
git pull --rebase . ff &&
- test "$(git rev-parse HEAD)" = "$(git rev-parse ff)" &&
+ test_cmp_rev HEAD ff &&
# The above only validates the result. Did we actually bypass rebase?
git reflog -1 >reflog.actual &&
git checkout behind &&
echo dirty >file &&
git pull --rebase --autostash . to-rebase-ff &&
- test "$(git rev-parse HEAD)" = "$(git rev-parse to-rebase-ff)"
+ test_cmp_rev HEAD to-rebase-ff
'
test_expect_success '--rebase with conflicts shows advice' '
test_expect_success '--rebase fails with multiple branches' '
git reset --hard before-rebase &&
test_must_fail git pull --rebase . copy master 2>err &&
- test "$(git rev-parse HEAD)" = "$(git rev-parse before-rebase)" &&
+ test_cmp_rev HEAD before-rebase &&
test_i18ngrep "Cannot rebase onto multiple branches" err &&
test modified = "$(git show HEAD:file)"
'
git reset --hard before-rebase &&
test_config pull.rebase true &&
git pull . copy &&
- test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^ copy &&
test new = "$(git show HEAD:file2)"
'
git reset --hard before-rebase &&
test_config branch.to-rebase.rebase true &&
git pull . copy &&
- test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^ copy &&
test new = "$(git show HEAD:file2)"
'
test_config pull.rebase true &&
test_config branch.to-rebase.rebase false &&
git pull . copy &&
- test "$(git rev-parse HEAD^)" != "$(git rev-parse copy)" &&
+ test_cmp_rev ! HEAD^ copy &&
test new = "$(git show HEAD:file2)"
'
test_expect_success 'pull --rebase warns on --verify-signatures' '
git reset --hard before-rebase &&
git pull --rebase --verify-signatures . copy 2>err &&
- test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^ copy &&
test new = "$(git show HEAD:file2)" &&
test_i18ngrep "ignoring --verify-signatures for rebase" err
'
test_expect_success 'pull --rebase does not warn on --no-verify-signatures' '
git reset --hard before-rebase &&
git pull --rebase --no-verify-signatures . copy 2>err &&
- test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^ copy &&
test new = "$(git show HEAD:file2)" &&
test_i18ngrep ! "verify-signatures" err
'
git reset --hard before-preserve-rebase &&
test_config pull.rebase false &&
git pull . copy &&
- test "$(git rev-parse HEAD^1)" = "$(git rev-parse before-preserve-rebase)" &&
- test "$(git rev-parse HEAD^2)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^1 before-preserve-rebase &&
+ test_cmp_rev HEAD^2 copy &&
test file3 = "$(git show HEAD:file3.t)"
'
git reset --hard before-preserve-rebase &&
test_config pull.rebase true &&
git pull . copy &&
- test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^^ copy &&
test file3 = "$(git show HEAD:file3.t)"
'
git reset --hard before-preserve-rebase &&
test_config pull.rebase 1 &&
git pull . copy &&
- test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^^ copy &&
test file3 = "$(git show HEAD:file3.t)"
'
git reset --hard before-preserve-rebase &&
test_config pull.rebase preserve &&
git pull . copy &&
- test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
- test "$(git rev-parse HEAD^2)" = "$(git rev-parse keep-merge)"
+ test_cmp_rev HEAD^^ copy &&
+ test_cmp_rev HEAD^2 keep-merge
'
test_expect_success 'pull.rebase=interactive' '
git reset --hard before-preserve-rebase &&
test_config pull.rebase true &&
git pull --rebase=false . copy &&
- test "$(git rev-parse HEAD^1)" = "$(git rev-parse before-preserve-rebase)" &&
- test "$(git rev-parse HEAD^2)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^1 before-preserve-rebase &&
+ test_cmp_rev HEAD^2 copy &&
test file3 = "$(git show HEAD:file3.t)"
'
git reset --hard before-preserve-rebase &&
test_config pull.rebase preserve &&
git pull --rebase=true . copy &&
- test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^^ copy &&
test file3 = "$(git show HEAD:file3.t)"
'
git reset --hard before-preserve-rebase &&
test_config pull.rebase true &&
git pull --rebase=preserve . copy &&
- test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
- test "$(git rev-parse HEAD^2)" = "$(git rev-parse keep-merge)"
+ test_cmp_rev HEAD^^ copy &&
+ test_cmp_rev HEAD^2 keep-merge
'
test_expect_success '--rebase=invalid fails' '
git reset --hard before-preserve-rebase &&
test_config pull.rebase preserve &&
git pull --rebase . copy &&
- test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
+ test_cmp_rev HEAD^^ copy &&
test file3 = "$(git show HEAD:file3.t)"
'
echo dirty >>file &&
git add file &&
test_must_fail git pull &&
- test "$COPY" = "$(git rev-parse --verify me/copy)" &&
+ test_cmp_rev "$COPY" me/copy &&
git checkout HEAD -- file &&
git pull &&
- test "$COPY" != "$(git rev-parse --verify me/copy)"
+ test_cmp_rev ! "$COPY" me/copy
'
test_expect_success 'pull --rebase works on branch yet to be born' '