author | Junio C Hamano <gitster@pobox.com> | |
Fri, 20 May 2011 03:37:21 +0000 (20:37 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 20 May 2011 03:37:21 +0000 (20:37 -0700) |
* jl/submodule-conflicted-gitmodules:
Submodules: Don't parse .gitmodules when it contains, merge conflicts
test that git status works with merge conflict in, .gitmodules
Submodules: Don't parse .gitmodules when it contains, merge conflicts
test that git status works with merge conflict in, .gitmodules
1 | 2 | |||
---|---|---|---|---|
t/t7506-status-submodule.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc t/t7506-status-submodule.sh
index c8d50a65672fdc00ccb42e6b7cece44b255623f1,e80e6bb59c22638b6728184bf249d3b0489a0794..d31b34da83d5ad336f2355acc0d2536b9d30e3ce
rm -rf sub/* sub/.git
'
-test_expect_success C_LOCALE_OUTPUT 'status clean (empty submodule dir)' '
+test_expect_success 'status clean (empty submodule dir)' '
git status >output &&
- grep "nothing to commit" output
+ test_i18ngrep "nothing to commit" output
'
-test_expect_success C_LOCALE_OUTPUT 'status -a clean (empty submodule dir)' '
+test_expect_success 'status -a clean (empty submodule dir)' '
test_must_fail git commit --dry-run -a >output &&
- grep "nothing to commit" output
+ test_i18ngrep "nothing to commit" output
'
+ cat >status_expect <<\EOF
+ AA .gitmodules
+ A sub1
+ EOF
+
+ test_expect_success 'status with merge conflict in .gitmodules' '
+ git clone . super &&
+ test_create_repo_with_commit sub1 &&
+ test_tick &&
+ test_create_repo_with_commit sub2 &&
+ (
+ cd super &&
+ prev=$(git rev-parse HEAD) &&
+ git checkout -b add_sub1 &&
+ git submodule add ../sub1 &&
+ git commit -m "add sub1" &&
+ git checkout -b add_sub2 $prev &&
+ git submodule add ../sub2 &&
+ git commit -m "add sub2" &&
+ git checkout -b merge_conflict_gitmodules &&
+ test_must_fail git merge add_sub1 &&
+ git status -s >../status_actual 2>&1
+ ) &&
+ test_cmp status_actual status_expect
+ '
+
+ sha1_merge_sub1=$(cd sub1 && git rev-parse HEAD)
+ sha1_merge_sub2=$(cd sub2 && git rev-parse HEAD)
+ short_sha1_merge_sub1=$(cd sub1 && git rev-parse --short HEAD)
+ short_sha1_merge_sub2=$(cd sub2 && git rev-parse --short HEAD)
+ cat >diff_expect <<\EOF
+ diff --cc .gitmodules
+ index badaa4c,44f999a..0000000
+ --- a/.gitmodules
+ +++ b/.gitmodules
+ @@@ -1,3 -1,3 +1,9 @@@
+ ++<<<<<<< HEAD
+ +[submodule "sub2"]
+ + path = sub2
+ + url = ../sub2
+ ++=======
+ + [submodule "sub1"]
+ + path = sub1
+ + url = ../sub1
+ ++>>>>>>> add_sub1
+ EOF
+
+ cat >diff_submodule_expect <<\EOF
+ diff --cc .gitmodules
+ index badaa4c,44f999a..0000000
+ --- a/.gitmodules
+ +++ b/.gitmodules
+ @@@ -1,3 -1,3 +1,9 @@@
+ ++<<<<<<< HEAD
+ +[submodule "sub2"]
+ + path = sub2
+ + url = ../sub2
+ ++=======
+ + [submodule "sub1"]
+ + path = sub1
+ + url = ../sub1
+ ++>>>>>>> add_sub1
+ EOF
+
+ test_expect_success 'diff with merge conflict in .gitmodules' '
+ (
+ cd super &&
+ git diff >../diff_actual 2>&1
+ ) &&
+ test_cmp diff_actual diff_expect
+ '
+
+ test_expect_success 'diff --submodule with merge conflict in .gitmodules' '
+ (
+ cd super &&
+ git diff --submodule >../diff_submodule_actual 2>&1
+ ) &&
+ test_cmp diff_submodule_actual diff_submodule_expect
+ '
+
test_done