aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit-clone-script68
-rw-r--r--pack-check.c2
-rw-r--r--t/README8
-rw-r--r--t/t6000lib.sh (renamed from t/t6000-lib.sh)0
-rwxr-xr-xt/t6001-rev-list-merge-order.sh2
-rwxr-xr-xt/t6002-rev-list-bisect.sh2
-rwxr-xr-xt/t6003-rev-list-topo-order.sh2
7 files changed, 79 insertions, 5 deletions
diff --git a/git-clone-script b/git-clone-script
index 28a932126..4f80ade21 100755
--- a/git-clone-script
+++ b/git-clone-script
@@ -1,4 +1,70 @@
#!/bin/sh
+#
+# Copyright (c) 2005, Linus Torvalds
+# Copyright (c) 2005, Junio C Hamano
+#
+# Clone a repository into a different directory that does not yet exist.
+
+usage() {
+ echo >&2 "* git clone [-l] <repo> <dir>"
+ exit 1
+}
+
+use_local=no
+while
+ case "$#,$1" in
+ 0,*) break ;;
+ *,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
+ *,-*) usage ;;
+ *) break ;;
+ esac
+do
+ shift
+done
+
repo="$1"
dir="$2"
-mkdir "$dir" && cd "$dir" && git-init-db && git-clone-pack "$repo"
+mkdir "$dir" &&
+D=$(
+ (cd "$dir" && git-init-db && pwd)
+) &&
+test -d "$D" || usage
+
+# We do local magic only when the user tells us to.
+case "$use_local" in
+yes)
+ ( cd "$repo/objects" ) || {
+ repo="$repo/.git"
+ ( cd "$repo/objects" ) || {
+ echo >&2 "-l flag seen but $repo is not local."
+ exit 1
+ }
+ }
+
+ # See if we can hardlink and drop "l" if not.
+ sample_file=$(cd "$repo" && \
+ find objects -type f -print | sed -e 1q)
+
+ # objects directory should not be empty since we are cloning!
+ test -f "$repo/$sample_file" || exit
+
+ l=
+ if ln "$repo/$sample_file" "$D/.git/objects/sample" 2>/dev/null
+ then
+ l=l
+ fi &&
+ rm -f "$D/.git/objects/sample" &&
+ cp -r$l "$repo/objects" "$D/.git/" || exit 1
+
+ # Make a duplicate of refs and HEAD pointer
+ HEAD=
+ if test -f "$repo/HEAD"
+ then
+ HEAD=HEAD
+ fi
+ tar Ccf "$repo" - refs $HEAD | tar Cxf "$D/.git" - || exit 1
+ exit 0
+ ;;
+esac
+
+cd "$D" && git clone-pack "$repo"
diff --git a/pack-check.c b/pack-check.c
index 916257f41..054b0131e 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -58,7 +58,7 @@ static int verify_packfile(struct packed_git *p)
continue;
}
if (check_sha1_signature(sha1, data, size, type)) {
- err = error("cannot packed %s from %s corrupt",
+ err = error("packed %s from %s is corrupt",
sha1_to_hex(sha1), p->pack_name);
free(data);
continue;
diff --git a/t/README b/t/README
index 2a94fdb0b..ab47ef9c5 100644
--- a/t/README
+++ b/t/README
@@ -79,6 +79,14 @@ Second digit tells the particular command we are testing.
Third digit (optionally) tells the particular switch or group of switches
we are testing.
+If you create files under t/ directory (i.e. here) that is not
+the top-level test script, never name the file to match the above
+pattern. The Makefile here considers all such files as the
+top-level test script and tries to run all of them. A care is
+especially needed if you are creating a common test library
+file, similar to test-lib.sh, because such a library file may
+not be suitable for standalone execution.
+
Writing Tests
-------------
diff --git a/t/t6000-lib.sh b/t/t6000lib.sh
index 01f796e9c..01f796e9c 100644
--- a/t/t6000-lib.sh
+++ b/t/t6000lib.sh
diff --git a/t/t6001-rev-list-merge-order.sh b/t/t6001-rev-list-merge-order.sh
index 66bd9ca8d..5dcb957ac 100755
--- a/t/t6001-rev-list-merge-order.sh
+++ b/t/t6001-rev-list-merge-order.sh
@@ -6,7 +6,7 @@
test_description='Tests git-rev-list --merge-order functionality'
. ./test-lib.sh
-. ../t6000-lib.sh # t6xxx specific functions
+. ../t6000lib.sh # t6xxx specific functions
# test-case specific test function
check_adjacency()
diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh
index a5e313b2f..6a7182082 100755
--- a/t/t6002-rev-list-bisect.sh
+++ b/t/t6002-rev-list-bisect.sh
@@ -5,7 +5,7 @@
test_description='Tests git-rev-list --bisect functionality'
. ./test-lib.sh
-. ../t6000-lib.sh
+. ../t6000lib.sh # t6xxx specific functions
bc_expr()
{
diff --git a/t/t6003-rev-list-topo-order.sh b/t/t6003-rev-list-topo-order.sh
index 98c5e2fae..eb41f86a1 100755
--- a/t/t6003-rev-list-topo-order.sh
+++ b/t/t6003-rev-list-topo-order.sh
@@ -6,7 +6,7 @@
test_description='Tests git-rev-list --topo-order functionality'
. ./test-lib.sh
-. ../t6000-lib.sh # t6xxx specific functions
+. ../t6000lib.sh # t6xxx specific functions
list_duplicates()
{