-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'js/maint-submodule-checkout' into maint
* js/maint-submodule-checkout: Fix 'git checkout <submodule>' to update the index
- Loading branch information
Showing
2 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/sh | ||
|
||
test_description='checkout can handle submodules' | ||
|
||
. ./test-lib.sh | ||
|
||
test_expect_success 'setup' ' | ||
mkdir submodule && | ||
(cd submodule && | ||
git init && | ||
test_commit first) && | ||
git add submodule && | ||
test_tick && | ||
git commit -m superproject && | ||
(cd submodule && | ||
test_commit second) && | ||
git add submodule && | ||
test_tick && | ||
git commit -m updated.superproject | ||
' | ||
|
||
test_expect_success '"reset <submodule>" updates the index' ' | ||
git update-index --refresh && | ||
git diff-files --quiet && | ||
git diff-index --quiet --cached HEAD && | ||
test_must_fail git reset HEAD^ submodule && | ||
test_must_fail git diff-files --quiet && | ||
git reset submodule && | ||
git diff-files --quiet | ||
' | ||
|
||
test_expect_success '"checkout <submodule>" updates the index only' ' | ||
git update-index --refresh && | ||
git diff-files --quiet && | ||
git diff-index --quiet --cached HEAD && | ||
git checkout HEAD^ submodule && | ||
test_must_fail git diff-files --quiet && | ||
git checkout HEAD submodule && | ||
git diff-files --quiet | ||
' | ||
|
||
test_done |