Signed-off-by: Christian Couder <[email protected]>
---
t/t0420-transfer-http-e-odb.sh | 7 +++++
t/t0470-read-object-http-e-odb.sh | 7 +++++
t/t0480-read-object-have-http-e-odb.sh | 7 +++++
t/t5616-clone-initial-refspec.sh | 48 ++++++++++++++++++++++++++++++++++
4 files changed, 69 insertions(+)
create mode 100755 t/t5616-clone-initial-refspec.sh
diff --git a/t/t0420-transfer-http-e-odb.sh b/t/t0420-transfer-http-e-odb.sh
index d307af0457..ed833850c3 100755
--- a/t/t0420-transfer-http-e-odb.sh
+++ b/t/t0420-transfer-http-e-odb.sh
@@ -140,6 +140,13 @@ test_expect_success 'no-local clone from the first repo
with helper succeeds' '
rm -rf my-other-clone
'
+test_expect_success 'no-local initial-refspec clone succeeds' '
+ mkdir my-other-clone &&
+ (cd my-other-clone &&
+ git -c odb.magic.scriptCommand="$HELPER" \
+ clone --no-local --initial-refspec
"refs/odbs/magic/*:refs/odbs/magic/*" .. .)
+'
+
stop_httpd
test_done
diff --git a/t/t0470-read-object-http-e-odb.sh
b/t/t0470-read-object-http-e-odb.sh
index d814a43d59..7355ca4d51 100755
--- a/t/t0470-read-object-http-e-odb.sh
+++ b/t/t0470-read-object-http-e-odb.sh
@@ -107,6 +107,13 @@ test_expect_success 'no-local clone from the first repo
with helper succeeds' '
rm -rf my-other-clone
'
+test_expect_success 'no-local initial-refspec clone succeeds' '
+ mkdir my-other-clone &&
+ (cd my-other-clone &&
+ git -c odb.magic.subprocessCommand="$HELPER" \
+ clone --no-local --initial-refspec
"refs/odbs/magic/*:refs/odbs/magic/*" .. .)
+'
+
stop_httpd
test_done
diff --git a/t/t0480-read-object-have-http-e-odb.sh
b/t/t0480-read-object-have-http-e-odb.sh
index fe1fac5ef3..c451d269a7 100755
--- a/t/t0480-read-object-have-http-e-odb.sh
+++ b/t/t0480-read-object-have-http-e-odb.sh
@@ -107,6 +107,13 @@ test_expect_success 'no-local clone from the first repo
with helper succeeds' '
rm -rf my-other-clone
'
+test_expect_success 'no-local initial-refspec clone succeeds' '
+ mkdir my-other-clone &&
+ (cd my-other-clone &&
+ git -c odb.magic.subprocessCommand="$HELPER" \
+ clone --no-local --initial-refspec
"refs/odbs/magic/*:refs/odbs/magic/*" .. .)
+'
+
stop_httpd
test_done
diff --git a/t/t5616-clone-initial-refspec.sh b/t/t5616-clone-initial-refspec.sh
new file mode 100755
index 0000000000..ccbc27f83f
--- /dev/null
+++ b/t/t5616-clone-initial-refspec.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+test_description='test clone with --initial-refspec option'
+. ./test-lib.sh
+
+
+test_expect_success 'setup regular repo' '
+ # Make two branches, "master" and "side"
+ echo one >file &&
+ git add file &&
+ git commit -m one &&
+ echo two >file &&
+ git commit -a -m two &&
+ git tag two &&
+ echo three >file &&
+ git commit -a -m three &&
+ git checkout -b side &&
+ echo four >file &&
+ git commit -a -m four &&
+ git checkout master
+'
+
+test_expect_success 'add a special ref pointing to a blob' '
+ hash=$(echo "Hello world!" | git hash-object -w -t blob --stdin) &&
+ git update-ref refs/special/hello "$hash"
+'
+
+test_expect_success 'no-local clone from the first repo' '
+ mkdir my-clone &&
+ (cd my-clone &&
+ git clone --no-local .. . &&
+ test_must_fail git cat-file blob "$hash") &&
+ rm -rf my-clone
+'
+
+test_expect_success 'no-local clone with --initial-refspec' '
+ mkdir my-clone &&
+ (cd my-clone &&
+ git clone --no-local --initial-refspec "refs/special/*:refs/special/*"
.. . &&
+ git cat-file blob "$hash" &&
+ git rev-parse refs/special/hello >actual &&
+ echo "$hash" >expected &&
+ test_cmp expected actual) &&
+ rm -rf my-clone
+'
+
+test_done
+
--
2.14.1.576.g3f707d88cd