summaryrefslogtreecommitdiff
path: root/t/t4041-diff-submodule-option.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-05-25 11:26:38 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-05-25 11:26:38 -0700
commit69e82602b9a5a01bc225d9b4e7a65a9daba506cb (patch)
treea1fbafe5fb22f2d96e782a0833b9c2b70c4aea31 /t/t4041-diff-submodule-option.sh
parentMerge branch 'bp/diff-no-index-strbuf-fix' into maint (diff)
parentteach add_submodule_odb() to look for alternates (diff)
downloadtgif-69e82602b9a5a01bc225d9b4e7a65a9daba506cb.tar.xz
Merge branch 'hv/submodule-alt-odb' into maint
When a submodule repository uses alternate object store mechanism, some commands that were started from the superproject did not notice it and failed with "No such object" errors. The subcommands of "git submodule" command that recursed into the submodule in a separate process were OK; only the ones that cheated and peeked directly into the submodule's repository from the primary process were affected. By Heiko Voigt * hv/submodule-alt-odb: teach add_submodule_odb() to look for alternates
Diffstat (limited to 't/t4041-diff-submodule-option.sh')
-rwxr-xr-xt/t4041-diff-submodule-option.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index bf9a7526bd..6c01d0c056 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -458,4 +458,38 @@ EOF
test_cmp expected actual
'
+test_expect_success 'diff --submodule with objects referenced by alternates' '
+ mkdir sub_alt &&
+ (cd sub_alt &&
+ git init &&
+ echo a >a &&
+ git add a &&
+ git commit -m a
+ ) &&
+ mkdir super &&
+ (cd super &&
+ git clone -s ../sub_alt sub &&
+ git init &&
+ git add sub &&
+ git commit -m "sub a"
+ ) &&
+ (cd sub_alt &&
+ sha1_before=$(git rev-parse --short HEAD)
+ echo b >b &&
+ git add b &&
+ git commit -m b
+ sha1_after=$(git rev-parse --short HEAD)
+ echo "Submodule sub $sha1_before..$sha1_after:
+ > b" >../expected
+ ) &&
+ (cd super &&
+ (cd sub &&
+ git fetch &&
+ git checkout origin/master
+ ) &&
+ git diff --submodule > ../actual
+ )
+ test_cmp expected actual
+'
+
test_done