Skip to contentSkip to conversation

Add a test case for rerere

PATCH In review Uwe Zeisberger 1 participant 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add a test case for rerere

Currently this test fails because rerere is not able to record resolves for a file that don't exist in the merge base but in both branches to merge.

---

 t/t8003-rerere.sh |   66 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 t/t8003-rerere.sh

It's the last command that fails because rerere didn't record the conflict between branch1:file-common and master:file-common.

Please feel free to change the filename as I don't know/see the naming scheme of the tests.

Best regards
Uwe

ff012a80cafa3fe905de72d0db8b616ff76d0038

t/t8003-rerere.sh new file +66 -0
new file mode 100644
index 0000000..1bb66ff
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+test_description='git-rerere'
+. ./test-lib.sh
+
+
+test_expect_success 'prepare repository' \
+'mkdir .git/rr-cache &&
+echo "content" > file-base &&
+git add file-base &&
+git commit -m "Initial commit" &&
+git branch branch &&
+echo "added after branch" >> file-base &&
+echo "added after branch" >> file-common &&
+git add file-common &&
+git commit -m "master1" -i file-base file-common &&
+git checkout branch &&
+echo "added in branch" >> file-base &&
+echo "only in branch" > file-branch &&
+echo "added in branch" >> file-common &&
+git add file-branch file-common &&
+git commit -m "branch1" -i file-base file-branch file-common &&
+git branch branch1'
+
+test_expect_failure 'pull master' \
+'git pull . master'
+
+cat >> file-base-expect << EOF
+content
+<<<<<<< HEAD/file-base
+added in branch
+=======
+added after branch
+>>>>>>> `git rev-parse master`/file-base
+EOF
+
+test_expect_success 'merge result' \
+'cmp file-base file-base-expect &&
+git cat-file blob HEAD:file-common | cmp file-common~HEAD - &&
+git cat-file blob master:file-common | cmp file-common~`git rev-parse master` - &&
+git cat-file blob HEAD:file-branch | cmp file-branch -'
+
+test_expect_success 'record and resolve confilcts' \
+'git rerere &&
+echo "content
+added in branch
+added after branch" > file-base &&
+echo "added in branch
+added after branch" > file-common &&
+git rerere &&
+git-ls-files -o | xargs rm &&
+git commit -m "resolved conflicts" -i file-base file-common file-branch &&
+git-checkout master
+'
+ 
+test_expect_failure 'pull branch1' \
+'git pull . branch1'
+
+test_expect_success 'reuse recorded resolve' \
+'git rerere &&
+git cat-file blob branch:file-branch | cmp file-branch - &&
+git cat-file blob branch:file-base | cmp file-base - &&
+git cat-file blob branch:file-common | cmp file-common -'
+
+test_done
+
Signature · 9 lines
1.3.1.gac92


-- 
Uwe Zeisberger
FS Forth-Systeme GmbH, A Digi International Company
Kueferstrasse 8, D-79206 Breisach, Germany
Phone: +49 (7667) 908 0 Fax: +49 (7667) 908 200
Web: www.fsforth.de, www.digi.com
#1 lore raw

Hello,

t/t8003-rerere.sh line 57

Quoted 9 lines · Uwe Zeisberger
t/t8003-rerere.sh new file +8 -0
+echo "added in branch" >> file-common &&
+git add file-branch file-common &&
+git commit -m "branch1" -i file-base file-branch file-common &&
+git branch branch1'
+
...
+ 
+test_expect_failure 'pull branch1' \
+'git pull . branch1'

When typing the test I first tried to pull branch^, but this failed with "no such remote ref refs/heads/branch^". Is it intended that one can only pull branches and not any rev?

Best regards
Uwe

PS: I added a double blank line in the file. Sorry for that...

Signature · 3 lines
Uwe Zeisberger

http://www.google.com/search?q=Planck%27s+constant%3D