author | Junio C Hamano <gitster@pobox.com> | |
Mon, 2 May 2011 22:58:36 +0000 (15:58 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 2 May 2011 22:58:36 +0000 (15:58 -0700) |
* nm/submodule-update-force:
submodule: Add --force option for git submodule update
Conflicts:
t/t7406-submodule-update.sh
submodule: Add --force option for git submodule update
Conflicts:
t/t7406-submodule-update.sh
1 | 2 | |||
---|---|---|---|---|
Documentation/git-submodule.txt | patch | | diff1 | | diff2 | | blob | history |
git-submodule.sh | patch | | diff1 | | diff2 | | blob | history |
t/t7406-submodule-update.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc Documentation/git-submodule.txt
Simple merge
diff --cc git-submodule.sh
Simple merge
diff --cc t/t7406-submodule-update.sh
index bf7c788735d6e3e0ecf56e7a2f82826701ee1789,5d24d9ff74595174a4549bb165fcc8a0800d8120..4f16fcce2bfcb63f437fa6b495fdb5c4370fccc1
)
'
+apos="'";
+test_expect_success 'submodule update does not fetch already present commits' '
+ (cd submodule &&
+ echo line3 >> file &&
+ git add file &&
+ test_tick &&
+ git commit -m "upstream line3"
+ ) &&
+ (cd super/submodule &&
+ head=$(git rev-parse --verify HEAD) &&
+ echo "Submodule path ${apos}submodule$apos: checked out $apos$head$apos" > ../../expected &&
+ git reset --hard HEAD~1
+ ) &&
+ (cd super &&
+ git submodule update > ../actual 2> ../actual.err
+ ) &&
+ test_cmp expected actual &&
+ ! test -s actual.err
+'
+
+ test_expect_success 'submodule update should fail due to local changes' '
+ (cd super/submodule &&
+ git reset --hard HEAD~1 &&
+ echo "local change" > file
+ ) &&
+ (cd super &&
+ (cd submodule &&
+ compare_head
+ ) &&
+ test_must_fail git submodule update submodule
+ )
+ '
+ test_expect_success 'submodule update should throw away changes with --force ' '
+ (cd super &&
+ (cd submodule &&
+ compare_head
+ ) &&
+ git submodule update --force submodule &&
+ cd submodule &&
+ ! compare_head
+ )
+ '
+
test_expect_success 'submodule update --rebase staying on master' '
(cd super/submodule &&
git checkout master