Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-05-24 12:14:52 +0400
committerVicent Martí <vicent@github.com>2013-05-24 12:14:52 +0400
commit4811c1500bfaaf8c7e61d712371f3ca429ef2016 (patch)
tree5c57bcc86f6ddba872c75c2866ef89594f22adc6 /tests-clar
parent30caf0cf2942412981b7662e50a2e9242afa2cce (diff)
parent6f0b8142e65b43f2224027a7abc67116ab6ad1a7 (diff)
Merge pull request #1603 from ben/shallow
Shallow-clone detection
Diffstat (limited to 'tests-clar')
-rw-r--r--tests-clar/repo/shallow.c33
-rw-r--r--tests-clar/resources/shallow.git/HEAD1
-rw-r--r--tests-clar/resources/shallow.git/config8
-rw-r--r--tests-clar/resources/shallow.git/objects/pack/pack-706e49b161700946489570d96153e5be4dc31ad4.idxbin0 -> 1324 bytes
-rw-r--r--tests-clar/resources/shallow.git/objects/pack/pack-706e49b161700946489570d96153e5be4dc31ad4.packbin0 -> 791 bytes
-rw-r--r--tests-clar/resources/shallow.git/packed-refs2
-rw-r--r--tests-clar/resources/shallow.git/refs/.gitkeep0
-rw-r--r--tests-clar/resources/shallow.git/shallow1
8 files changed, 45 insertions, 0 deletions
diff --git a/tests-clar/repo/shallow.c b/tests-clar/repo/shallow.c
new file mode 100644
index 000000000..1cc66ae40
--- /dev/null
+++ b/tests-clar/repo/shallow.c
@@ -0,0 +1,33 @@
+#include "clar_libgit2.h"
+#include "fileops.h"
+
+static git_repository *g_repo;
+
+void test_repo_shallow__initialize(void)
+{
+}
+
+void test_repo_shallow__cleanup(void)
+{
+ cl_git_sandbox_cleanup();
+}
+
+void test_repo_shallow__no_shallow_file(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo.git");
+ cl_assert_equal_i(0, git_repository_is_shallow(g_repo));
+}
+
+void test_repo_shallow__empty_shallow_file(void)
+{
+ g_repo = cl_git_sandbox_init("testrepo.git");
+ cl_git_mkfile("testrepo.git/shallow", "");
+ cl_assert_equal_i(0, git_repository_is_shallow(g_repo));
+}
+
+void test_repo_shallow__shallow_repo(void)
+{
+ g_repo = cl_git_sandbox_init("shallow.git");
+ cl_assert_equal_i(1, git_repository_is_shallow(g_repo));
+}
+
diff --git a/tests-clar/resources/shallow.git/HEAD b/tests-clar/resources/shallow.git/HEAD
new file mode 100644
index 000000000..cb089cd89
--- /dev/null
+++ b/tests-clar/resources/shallow.git/HEAD
@@ -0,0 +1 @@
+ref: refs/heads/master
diff --git a/tests-clar/resources/shallow.git/config b/tests-clar/resources/shallow.git/config
new file mode 100644
index 000000000..a88b74b69
--- /dev/null
+++ b/tests-clar/resources/shallow.git/config
@@ -0,0 +1,8 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = true
+ ignorecase = true
+ precomposeunicode = false
+[remote "origin"]
+ url = file://testrepo.git
diff --git a/tests-clar/resources/shallow.git/objects/pack/pack-706e49b161700946489570d96153e5be4dc31ad4.idx b/tests-clar/resources/shallow.git/objects/pack/pack-706e49b161700946489570d96153e5be4dc31ad4.idx
new file mode 100644
index 000000000..bfc7d24ff
--- /dev/null
+++ b/tests-clar/resources/shallow.git/objects/pack/pack-706e49b161700946489570d96153e5be4dc31ad4.idx
Binary files differ
diff --git a/tests-clar/resources/shallow.git/objects/pack/pack-706e49b161700946489570d96153e5be4dc31ad4.pack b/tests-clar/resources/shallow.git/objects/pack/pack-706e49b161700946489570d96153e5be4dc31ad4.pack
new file mode 100644
index 000000000..ccc6932fc
--- /dev/null
+++ b/tests-clar/resources/shallow.git/objects/pack/pack-706e49b161700946489570d96153e5be4dc31ad4.pack
Binary files differ
diff --git a/tests-clar/resources/shallow.git/packed-refs b/tests-clar/resources/shallow.git/packed-refs
new file mode 100644
index 000000000..97eed743b
--- /dev/null
+++ b/tests-clar/resources/shallow.git/packed-refs
@@ -0,0 +1,2 @@
+# pack-refs with: peeled
+a65fedf39aefe402d3bb6e24df4d4f5fe4547750 refs/heads/master
diff --git a/tests-clar/resources/shallow.git/refs/.gitkeep b/tests-clar/resources/shallow.git/refs/.gitkeep
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests-clar/resources/shallow.git/refs/.gitkeep
diff --git a/tests-clar/resources/shallow.git/shallow b/tests-clar/resources/shallow.git/shallow
new file mode 100644
index 000000000..9536ad89c
--- /dev/null
+++ b/tests-clar/resources/shallow.git/shallow
@@ -0,0 +1 @@
+be3563ae3f795b2b4353bcce3a527ad0a4f7f644