about summary refs log tree commit diff
path: root/third_party/git/t/t5520-pull.sh
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/git/t/t5520-pull.sh')
-rwxr-xr-xthird_party/git/t/t5520-pull.sh366
1 files changed, 142 insertions, 224 deletions
diff --git a/third_party/git/t/t5520-pull.sh b/third_party/git/t/t5520-pull.sh
index 2f86fca042..cf4cc32fd0 100755
--- a/third_party/git/t/t5520-pull.sh
+++ b/third_party/git/t/t5520-pull.sh
@@ -5,7 +5,7 @@ test_description='pulling into void'
 . ./test-lib.sh
 
 modify () {
-	sed -e "$1" "$2" >"$2.x" &&
+	sed -e "$1" <"$2" >"$2.x" &&
 	mv "$2.x" "$2"
 }
 
@@ -15,10 +15,8 @@ test_pull_autostash () {
 	git add new_file &&
 	git pull "$@" . copy &&
 	test_cmp_rev HEAD^ copy &&
-	echo dirty >expect &&
-	test_cmp expect new_file &&
-	echo "modified again" >expect &&
-	test_cmp expect file
+	test "$(cat new_file)" = dirty &&
+	test "$(cat file)" = "modified again"
 }
 
 test_pull_autostash_fail () {
@@ -41,8 +39,8 @@ test_expect_success 'pulling into void' '
 		cd cloned &&
 		git pull ..
 	) &&
-	test_path_is_file file &&
-	test_path_is_file cloned/file &&
+	test -f file &&
+	test -f cloned/file &&
 	test_cmp file cloned/file
 '
 
@@ -52,8 +50,8 @@ test_expect_success 'pulling into void using master:master' '
 		cd cloned-uho &&
 		git pull .. master:master
 	) &&
-	test_path_is_file file &&
-	test_path_is_file cloned-uho/file &&
+	test -f file &&
+	test -f cloned-uho/file &&
 	test_cmp file cloned-uho/file
 '
 
@@ -101,7 +99,7 @@ test_expect_success 'pulling into void must not create an octopus' '
 	(
 		cd cloned-octopus &&
 		test_must_fail git pull .. master master &&
-		test_path_is_missing file
+		! test -f file
 	)
 '
 
@@ -112,11 +110,9 @@ test_expect_success 'test . as a remote' '
 	echo updated >file &&
 	git commit -a -m updated &&
 	git checkout copy &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	git pull &&
-	echo updated >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = updated &&
 	git reflog -1 >reflog.actual &&
 	sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy &&
 	echo "OBJID HEAD@{0}: pull: Fast-forward" >reflog.expected &&
@@ -129,11 +125,9 @@ test_expect_success 'the default remote . should not break explicit pull' '
 	git commit -a -m modified &&
 	git checkout copy &&
 	git reset --hard HEAD^ &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	git pull . second &&
-	echo modified >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = modified &&
 	git reflog -1 >reflog.actual &&
 	sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy &&
 	echo "OBJID HEAD@{0}: pull . second: Fast-forward" >reflog.expected &&
@@ -143,11 +137,10 @@ test_expect_success 'the default remote . should not break explicit pull' '
 test_expect_success 'fail if wildcard spec does not match any refs' '
 	git checkout -b test copy^ &&
 	test_when_finished "git checkout -f copy && git branch -D test" &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	test_must_fail git pull . "refs/nonexisting1/*:refs/nonexisting2/*" 2>err &&
 	test_i18ngrep "no candidates for merging" err &&
-	test_cmp expect file
+	test "$(cat file)" = file
 '
 
 test_expect_success 'fail if no branches specified with non-default remote' '
@@ -155,12 +148,11 @@ test_expect_success 'fail if no branches specified with non-default remote' '
 	test_when_finished "git remote remove test_remote" &&
 	git checkout -b test copy^ &&
 	test_when_finished "git checkout -f copy && git branch -D test" &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	test_config branch.test.remote origin &&
 	test_must_fail git pull test_remote 2>err &&
 	test_i18ngrep "specify a branch on the command line" err &&
-	test_cmp expect file
+	test "$(cat file)" = file
 '
 
 test_expect_success 'fail if not on a branch' '
@@ -168,11 +160,10 @@ test_expect_success 'fail if not on a branch' '
 	test_when_finished "git remote remove origin" &&
 	git checkout HEAD^ &&
 	test_when_finished "git checkout -f copy" &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	test_must_fail git pull 2>err &&
 	test_i18ngrep "not currently on a branch" err &&
-	test_cmp expect file
+	test "$(cat file)" = file
 '
 
 test_expect_success 'fail if no configuration for current branch' '
@@ -181,11 +172,10 @@ test_expect_success 'fail if no configuration for current branch' '
 	git checkout -b test copy^ &&
 	test_when_finished "git checkout -f copy && git branch -D test" &&
 	test_config branch.test.remote test_remote &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	test_must_fail git pull 2>err &&
 	test_i18ngrep "no tracking information" err &&
-	test_cmp expect file
+	test "$(cat file)" = file
 '
 
 test_expect_success 'pull --all: fail if no configuration for current branch' '
@@ -194,11 +184,10 @@ test_expect_success 'pull --all: fail if no configuration for current branch' '
 	git checkout -b test copy^ &&
 	test_when_finished "git checkout -f copy && git branch -D test" &&
 	test_config branch.test.remote test_remote &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	test_must_fail git pull --all 2>err &&
 	test_i18ngrep "There is no tracking information" err &&
-	test_cmp expect file
+	test "$(cat file)" = file
 '
 
 test_expect_success 'fail if upstream branch does not exist' '
@@ -206,31 +195,26 @@ test_expect_success 'fail if upstream branch does not exist' '
 	test_when_finished "git checkout -f copy && git branch -D test" &&
 	test_config branch.test.remote . &&
 	test_config branch.test.merge refs/heads/nonexisting &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	test_must_fail git pull 2>err &&
 	test_i18ngrep "no such ref was fetched" err &&
-	test_cmp expect file
+	test "$(cat file)" = file
 '
 
 test_expect_success 'fail if the index has unresolved entries' '
 	git checkout -b third second^ &&
 	test_when_finished "git checkout -f copy && git branch -D third" &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	test_commit modified2 file &&
-	git ls-files -u >unmerged &&
-	test_must_be_empty unmerged &&
+	test -z "$(git ls-files -u)" &&
 	test_must_fail git pull . second &&
-	git ls-files -u >unmerged &&
-	test_file_not_empty unmerged &&
+	test -n "$(git ls-files -u)" &&
 	cp file expected &&
 	test_must_fail git pull . second 2>err &&
 	test_i18ngrep "Pulling is not possible because you have unmerged files." err &&
 	test_cmp expected file &&
 	git add file &&
-	git ls-files -u >unmerged &&
-	test_must_be_empty unmerged &&
+	test -z "$(git ls-files -u)" &&
 	test_must_fail git pull . second 2>err &&
 	test_i18ngrep "You have not concluded your merge" err &&
 	test_cmp expected file
@@ -239,66 +223,47 @@ test_expect_success 'fail if the index has unresolved entries' '
 test_expect_success 'fast-forwards working tree if branch head is updated' '
 	git checkout -b third second^ &&
 	test_when_finished "git checkout -f copy && git branch -D third" &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	git pull . second:third 2>err &&
 	test_i18ngrep "fetch updated the current branch head" err &&
-	echo modified >expect &&
-	test_cmp expect file &&
-	test_cmp_rev third second
+	test "$(cat file)" = modified &&
+	test "$(git rev-parse third)" = "$(git rev-parse second)"
 '
 
 test_expect_success 'fast-forward fails with conflicting work tree' '
 	git checkout -b third second^ &&
 	test_when_finished "git checkout -f copy && git branch -D third" &&
-	echo file >expect &&
-	test_cmp expect file &&
+	test "$(cat file)" = file &&
 	echo conflict >file &&
 	test_must_fail git pull . second:third 2>err &&
 	test_i18ngrep "Cannot fast-forward your working tree" err &&
-	echo conflict >expect &&
-	test_cmp expect file &&
-	test_cmp_rev third second
+	test "$(cat file)" = conflict &&
+	test "$(git rev-parse third)" = "$(git rev-parse second)"
 '
 
 test_expect_success '--rebase' '
 	git branch to-rebase &&
-	echo modified again >file &&
+	echo modified again > file &&
 	git commit -m file file &&
 	git checkout to-rebase &&
-	echo new >file2 &&
+	echo new > file2 &&
 	git add file2 &&
 	git commit -m "new file" &&
 	git tag before-rebase &&
 	git pull --rebase . copy &&
-	test_cmp_rev HEAD^ copy &&
-	echo new >expect &&
-	git show HEAD:file2 >actual &&
-	test_cmp expect actual
+	test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
+	test new = "$(git show HEAD:file2)"
 '
 
-test_expect_success '--rebase (merge) fast forward' '
+test_expect_success '--rebase fast forward' '
 	git reset --hard before-rebase &&
 	git checkout -b ff &&
 	echo another modification >file &&
 	git commit -m third file &&
 
 	git checkout to-rebase &&
-	git -c rebase.backend=merge pull --rebase . ff &&
-	test_cmp_rev HEAD ff &&
-
-	# The above only validates the result.  Did we actually bypass rebase?
-	git reflog -1 >reflog.actual &&
-	sed "s/^[0-9a-f][0-9a-f]*/OBJID/" reflog.actual >reflog.fuzzy &&
-	echo "OBJID HEAD@{0}: pull --rebase . ff: Fast-forward" >reflog.expected &&
-	test_cmp reflog.expected reflog.fuzzy
-'
-
-test_expect_success '--rebase (am) fast forward' '
-	git reset --hard before-rebase &&
-
-	git -c rebase.backend=apply pull --rebase . ff &&
-	test_cmp_rev HEAD ff &&
+	git pull --rebase . ff &&
+	test "$(git rev-parse HEAD)" = "$(git rev-parse ff)" &&
 
 	# The above only validates the result.  Did we actually bypass rebase?
 	git reflog -1 >reflog.actual &&
@@ -322,7 +287,7 @@ test_expect_success '--rebase --autostash fast forward' '
 	git checkout behind &&
 	echo dirty >file &&
 	git pull --rebase --autostash . to-rebase-ff &&
-	test_cmp_rev HEAD to-rebase-ff
+	test "$(git rev-parse HEAD)" = "$(git rev-parse to-rebase-ff)"
 '
 
 test_expect_success '--rebase with conflicts shows advice' '
@@ -340,7 +305,7 @@ test_expect_success '--rebase with conflicts shows advice' '
 	test_tick &&
 	git commit -m "Create conflict" seq.txt &&
 	test_must_fail git pull --rebase . seq 2>err >out &&
-	test_i18ngrep "Resolve all conflicts manually" err
+	test_i18ngrep "Resolve all conflicts manually" out
 '
 
 test_expect_success 'failed --rebase shows advice' '
@@ -354,17 +319,15 @@ test_expect_success 'failed --rebase shows advice' '
 	git checkout -f -b fails-to-rebase HEAD^ &&
 	test_commit v2-without-cr file "2" file2-lf &&
 	test_must_fail git pull --rebase . diverging 2>err >out &&
-	test_i18ngrep "Resolve all conflicts manually" err
+	test_i18ngrep "Resolve all conflicts manually" out
 '
 
 test_expect_success '--rebase fails with multiple branches' '
 	git reset --hard before-rebase &&
 	test_must_fail git pull --rebase . copy master 2>err &&
-	test_cmp_rev HEAD before-rebase &&
+	test "$(git rev-parse HEAD)" = "$(git rev-parse before-rebase)" &&
 	test_i18ngrep "Cannot rebase onto multiple branches" err &&
-	echo modified >expect &&
-	git show HEAD:file >actual &&
-	test_cmp expect actual
+	test modified = "$(git show HEAD:file)"
 '
 
 test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '
@@ -414,10 +377,8 @@ test_expect_success 'pull.rebase' '
 	git reset --hard before-rebase &&
 	test_config pull.rebase true &&
 	git pull . copy &&
-	test_cmp_rev HEAD^ copy &&
-	echo new >expect &&
-	git show HEAD:file2 >actual &&
-	test_cmp expect actual
+	test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
+	test new = "$(git show HEAD:file2)"
 '
 
 test_expect_success 'pull --autostash & pull.rebase=true' '
@@ -434,10 +395,8 @@ test_expect_success 'branch.to-rebase.rebase' '
 	git reset --hard before-rebase &&
 	test_config branch.to-rebase.rebase true &&
 	git pull . copy &&
-	test_cmp_rev HEAD^ copy &&
-	echo new >expect &&
-	git show HEAD:file2 >actual &&
-	test_cmp expect actual
+	test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
+	test new = "$(git show HEAD:file2)"
 '
 
 test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '
@@ -445,29 +404,23 @@ test_expect_success 'branch.to-rebase.rebase should override pull.rebase' '
 	test_config pull.rebase true &&
 	test_config branch.to-rebase.rebase false &&
 	git pull . copy &&
-	test_cmp_rev ! HEAD^ copy &&
-	echo new >expect &&
-	git show HEAD:file2 >actual &&
-	test_cmp expect actual
+	test "$(git rev-parse HEAD^)" != "$(git rev-parse copy)" &&
+	test new = "$(git show HEAD:file2)"
 '
 
-test_expect_success 'pull --rebase warns on --verify-signatures' '
+test_expect_success "pull --rebase warns on --verify-signatures" '
 	git reset --hard before-rebase &&
 	git pull --rebase --verify-signatures . copy 2>err &&
-	test_cmp_rev HEAD^ copy &&
-	echo new >expect &&
-	git show HEAD:file2 >actual &&
-	test_cmp expect actual &&
+	test "$(git rev-parse HEAD^)" = "$(git rev-parse 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' '
+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_cmp_rev HEAD^ copy &&
-	echo new >expect &&
-	git show HEAD:file2 >actual &&
-	test_cmp expect actual &&
+	test "$(git rev-parse HEAD^)" = "$(git rev-parse copy)" &&
+	test new = "$(git show HEAD:file2)" &&
 	test_i18ngrep ! "verify-signatures" err
 '
 
@@ -487,31 +440,25 @@ test_expect_success 'pull.rebase=false create a new merge commit' '
 	git reset --hard before-preserve-rebase &&
 	test_config pull.rebase false &&
 	git pull . copy &&
-	test_cmp_rev HEAD^1 before-preserve-rebase &&
-	test_cmp_rev HEAD^2 copy &&
-	echo file3 >expect &&
-	git show HEAD:file3.t >actual &&
-	test_cmp expect actual
+	test "$(git rev-parse HEAD^1)" = "$(git rev-parse before-preserve-rebase)" &&
+	test "$(git rev-parse HEAD^2)" = "$(git rev-parse copy)" &&
+	test file3 = "$(git show HEAD:file3.t)"
 '
 
 test_expect_success 'pull.rebase=true flattens keep-merge' '
 	git reset --hard before-preserve-rebase &&
 	test_config pull.rebase true &&
 	git pull . copy &&
-	test_cmp_rev HEAD^^ copy &&
-	echo file3 >expect &&
-	git show HEAD:file3.t >actual &&
-	test_cmp expect actual
+	test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
+	test file3 = "$(git show HEAD:file3.t)"
 '
 
 test_expect_success 'pull.rebase=1 is treated as true and flattens keep-merge' '
 	git reset --hard before-preserve-rebase &&
 	test_config pull.rebase 1 &&
 	git pull . copy &&
-	test_cmp_rev HEAD^^ copy &&
-	echo file3 >expect &&
-	git show HEAD:file3.t >actual &&
-	test_cmp expect actual
+	test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
+	test file3 = "$(git show HEAD:file3.t)"
 '
 
 test_expect_success REBASE_P \
@@ -519,8 +466,8 @@ test_expect_success REBASE_P \
 	git reset --hard before-preserve-rebase &&
 	test_config pull.rebase preserve &&
 	git pull . copy &&
-	test_cmp_rev HEAD^^ copy &&
-	test_cmp_rev HEAD^2 keep-merge
+	test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
+	test "$(git rev-parse HEAD^2)" = "$(git rev-parse keep-merge)"
 '
 
 test_expect_success 'pull.rebase=interactive' '
@@ -531,8 +478,7 @@ test_expect_success 'pull.rebase=interactive' '
 	test_set_editor "$TRASH_DIRECTORY/fake-editor" &&
 	test_when_finished "test_might_fail git rebase --abort" &&
 	test_must_fail git pull --rebase=interactive . copy &&
-	echo "I was here" >expect &&
-	test_cmp expect fake.out
+	test "I was here" = "$(cat fake.out)"
 '
 
 test_expect_success 'pull --rebase=i' '
@@ -543,35 +489,30 @@ test_expect_success 'pull --rebase=i' '
 	test_set_editor "$TRASH_DIRECTORY/fake-editor" &&
 	test_when_finished "test_might_fail git rebase --abort" &&
 	test_must_fail git pull --rebase=i . copy &&
-	echo "I was here, too" >expect &&
-	test_cmp expect fake.out
+	test "I was here, too" = "$(cat fake.out)"
 '
 
 test_expect_success 'pull.rebase=invalid fails' '
 	git reset --hard before-preserve-rebase &&
 	test_config pull.rebase invalid &&
-	test_must_fail git pull . copy
+	! git pull . copy
 '
 
 test_expect_success '--rebase=false create a new merge commit' '
 	git reset --hard before-preserve-rebase &&
 	test_config pull.rebase true &&
 	git pull --rebase=false . copy &&
-	test_cmp_rev HEAD^1 before-preserve-rebase &&
-	test_cmp_rev HEAD^2 copy &&
-	echo file3 >expect &&
-	git show HEAD:file3.t >actual &&
-	test_cmp expect actual
+	test "$(git rev-parse HEAD^1)" = "$(git rev-parse before-preserve-rebase)" &&
+	test "$(git rev-parse HEAD^2)" = "$(git rev-parse copy)" &&
+	test file3 = "$(git show HEAD:file3.t)"
 '
 
 test_expect_success '--rebase=true rebases and flattens keep-merge' '
 	git reset --hard before-preserve-rebase &&
 	test_config pull.rebase preserve &&
 	git pull --rebase=true . copy &&
-	test_cmp_rev HEAD^^ copy &&
-	echo file3 >expect &&
-	git show HEAD:file3.t >actual &&
-	test_cmp expect actual
+	test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
+	test file3 = "$(git show HEAD:file3.t)"
 '
 
 test_expect_success REBASE_P \
@@ -579,62 +520,58 @@ test_expect_success REBASE_P \
 	git reset --hard before-preserve-rebase &&
 	test_config pull.rebase true &&
 	git pull --rebase=preserve . copy &&
-	test_cmp_rev HEAD^^ copy &&
-	test_cmp_rev HEAD^2 keep-merge
+	test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
+	test "$(git rev-parse HEAD^2)" = "$(git rev-parse keep-merge)"
 '
 
 test_expect_success '--rebase=invalid fails' '
 	git reset --hard before-preserve-rebase &&
-	test_must_fail git pull --rebase=invalid . copy
+	! git pull --rebase=invalid . copy
 '
 
 test_expect_success '--rebase overrides pull.rebase=preserve and flattens keep-merge' '
 	git reset --hard before-preserve-rebase &&
 	test_config pull.rebase preserve &&
 	git pull --rebase . copy &&
-	test_cmp_rev HEAD^^ copy &&
-	echo file3 >expect &&
-	git show HEAD:file3.t >actual &&
-	test_cmp expect actual
+	test "$(git rev-parse HEAD^^)" = "$(git rev-parse copy)" &&
+	test file3 = "$(git show HEAD:file3.t)"
 '
 
 test_expect_success '--rebase with rebased upstream' '
+
 	git remote add -f me . &&
 	git checkout copy &&
 	git tag copy-orig &&
 	git reset --hard HEAD^ &&
-	echo conflicting modification >file &&
+	echo conflicting modification > file &&
 	git commit -m conflict file &&
 	git checkout to-rebase &&
-	echo file >file2 &&
+	echo file > file2 &&
 	git commit -m to-rebase file2 &&
 	git tag to-rebase-orig &&
 	git pull --rebase me copy &&
-	echo "conflicting modification" >expect &&
-	test_cmp expect file &&
-	echo file >expect &&
-	test_cmp expect file2
+	test "conflicting modification" = "$(cat file)" &&
+	test file = "$(cat file2)"
+
 '
 
 test_expect_success '--rebase -f with rebased upstream' '
 	test_when_finished "test_might_fail git rebase --abort" &&
 	git reset --hard to-rebase-orig &&
 	git pull --rebase -f me copy &&
-	echo "conflicting modification" >expect &&
-	test_cmp expect file &&
-	echo file >expect &&
-	test_cmp expect file2
+	test "conflicting modification" = "$(cat file)" &&
+	test file = "$(cat file2)"
 '
 
 test_expect_success '--rebase with rebased default upstream' '
+
 	git update-ref refs/remotes/me/copy copy-orig &&
 	git checkout --track -b to-rebase2 me/copy &&
 	git reset --hard to-rebase-orig &&
 	git pull --rebase &&
-	echo "conflicting modification" >expect &&
-	test_cmp expect file &&
-	echo file >expect &&
-	test_cmp expect file2
+	test "conflicting modification" = "$(cat file)" &&
+	test file = "$(cat file2)"
+
 '
 
 test_expect_success 'rebased upstream + fetch + pull --rebase' '
@@ -645,14 +582,13 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '
 	git reset --hard to-rebase-orig &&
 	git fetch &&
 	git pull --rebase &&
-	echo "conflicting modification" >expect &&
-	test_cmp expect file &&
-	echo file >expect &&
-	test_cmp expect file2
+	test "conflicting modification" = "$(cat file)" &&
+	test file = "$(cat file2)"
 
 '
 
 test_expect_success 'pull --rebase dies early with dirty working directory' '
+
 	git checkout to-rebase &&
 	git update-ref refs/remotes/me/copy copy^ &&
 	COPY="$(git rev-parse --verify me/copy)" &&
@@ -660,23 +596,23 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '
 	test_config branch.to-rebase.remote me &&
 	test_config branch.to-rebase.merge refs/heads/copy &&
 	test_config branch.to-rebase.rebase true &&
-	echo dirty >>file &&
+	echo dirty >> file &&
 	git add file &&
 	test_must_fail git pull &&
-	test_cmp_rev "$COPY" me/copy &&
+	test "$COPY" = "$(git rev-parse --verify me/copy)" &&
 	git checkout HEAD -- file &&
 	git pull &&
-	test_cmp_rev ! "$COPY" me/copy
+	test "$COPY" != "$(git rev-parse --verify me/copy)"
+
 '
 
 test_expect_success 'pull --rebase works on branch yet to be born' '
 	git rev-parse master >expect &&
 	mkdir empty_repo &&
-	(
-		cd empty_repo &&
-		git init &&
-		git pull --rebase .. master &&
-		git rev-parse HEAD >../actual
+	(cd empty_repo &&
+	 git init &&
+	 git pull --rebase .. master &&
+	 git rev-parse HEAD >../actual
 	) &&
 	test_cmp expect actual
 '
@@ -688,14 +624,10 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' '
 		cd empty_repo2 &&
 		echo staged-file >staged-file &&
 		git add staged-file &&
-		echo staged-file >expect &&
-		git ls-files >actual &&
-		test_cmp expect actual &&
+		test "$(git ls-files)" = staged-file &&
 		test_must_fail git pull --rebase .. master 2>err &&
-		git ls-files >actual &&
-		test_cmp expect actual &&
-		git show :staged-file >actual &&
-		test_cmp expect actual &&
+		test "$(git ls-files)" = staged-file &&
+		test "$(git show :staged-file)" = staged-file &&
 		test_i18ngrep "unborn branch with changes added to the index" err
 	)
 '
@@ -706,8 +638,7 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '
 	(
 		cd corrupt &&
 		test_commit one &&
-		git rev-parse --verify HEAD >head &&
-		obj=$(sed "s#^..#&/#" head) &&
+		obj=$(git rev-parse --verify HEAD | sed "s#^..#&/#") &&
 		rm -f .git/objects/$obj &&
 		test_must_fail git pull --rebase
 	)
@@ -715,79 +646,66 @@ test_expect_success 'pull --rebase fails on corrupt HEAD' '
 
 test_expect_success 'setup for detecting upstreamed changes' '
 	mkdir src &&
-	(
-		cd src &&
-		git init &&
-		printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff &&
-		git add stuff &&
-		git commit -m "Initial revision"
+	(cd src &&
+	 git init &&
+	 printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" > stuff &&
+	 git add stuff &&
+	 git commit -m "Initial revision"
 	) &&
 	git clone src dst &&
-	(
-		cd src &&
-		modify s/5/43/ stuff &&
-		git commit -a -m "5->43" &&
-		modify s/6/42/ stuff &&
-		git commit -a -m "Make it bigger"
+	(cd src &&
+	 modify s/5/43/ stuff &&
+	 git commit -a -m "5->43" &&
+	 modify s/6/42/ stuff &&
+	 git commit -a -m "Make it bigger"
 	) &&
-	(
-		cd dst &&
-		modify s/5/43/ stuff &&
-		git commit -a -m "Independent discovery of 5->43"
+	(cd dst &&
+	 modify s/5/43/ stuff &&
+	 git commit -a -m "Independent discovery of 5->43"
 	)
 '
 
 test_expect_success 'git pull --rebase detects upstreamed changes' '
-	(
-		cd dst &&
-		git pull --rebase &&
-		git ls-files -u >untracked &&
-		test_must_be_empty untracked
+	(cd dst &&
+	 git pull --rebase &&
+	 test -z "$(git ls-files -u)"
 	)
 '
 
 test_expect_success 'setup for avoiding reapplying old patches' '
-	(
-		cd dst &&
-		test_might_fail git rebase --abort &&
-		git reset --hard origin/master
+	(cd dst &&
+	 test_might_fail git rebase --abort &&
+	 git reset --hard origin/master
 	) &&
 	git clone --bare src src-replace.git &&
 	rm -rf src &&
 	mv src-replace.git src &&
-	(
-		cd dst &&
-		modify s/2/22/ stuff &&
-		git commit -a -m "Change 2" &&
-		modify s/3/33/ stuff &&
-		git commit -a -m "Change 3" &&
-		modify s/4/44/ stuff &&
-		git commit -a -m "Change 4" &&
-		git push &&
-
-		modify s/44/55/ stuff &&
-		git commit --amend -a -m "Modified Change 4"
+	(cd dst &&
+	 modify s/2/22/ stuff &&
+	 git commit -a -m "Change 2" &&
+	 modify s/3/33/ stuff &&
+	 git commit -a -m "Change 3" &&
+	 modify s/4/44/ stuff &&
+	 git commit -a -m "Change 4" &&
+	 git push &&
+
+	 modify s/44/55/ stuff &&
+	 git commit --amend -a -m "Modified Change 4"
 	)
 '
 
 test_expect_success 'git pull --rebase does not reapply old patches' '
-	(
-		cd dst &&
-		test_must_fail git pull --rebase &&
-		cat .git/rebase-merge/done .git/rebase-merge/git-rebase-todo >work &&
-		grep -v -e \# -e ^$ work >patches &&
-		test_line_count = 1 patches &&
-		rm -f work
+	(cd dst &&
+	 test_must_fail git pull --rebase &&
+	 test 1 = $(find .git/rebase-apply -name "000*" | wc -l)
 	)
 '
 
 test_expect_success 'git pull --rebase against local branch' '
 	git checkout -b copy2 to-rebase-orig &&
 	git pull --rebase . to-rebase &&
-	echo "conflicting modification" >expect &&
-	test_cmp expect file &&
-	echo file >expect &&
-	test_cmp expect file2
+	test "conflicting modification" = "$(cat file)" &&
+	test file = "$(cat file2)"
 '
 
 test_done