upload-pack: fix off-by-one depth calculation in shallow clone
[gitweb.git] / t / t4041-diff-submodule-option.sh
index bf9a7526bd38a17e0e991739db8c4a1f8541b2f6..6c01d0c056e2608393ed16eea29dd45fc79d786c 100755 (executable)
@@ -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