Re: [PATCH v2] Make sure objects/pack exists before creating a new pack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is *not* to be applied, but to document and demonstrate how I tested
the previous fix.  It disables the creation of .git/objects/pack/
directory when "git init" is run, and adds minimum workaround in the tests
that assume the directory is always created.

---
 builtin-init-db.c      |    2 +-
 t/t0000-basic.sh       |    2 +-
 t/t5300-pack-object.sh |    1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/builtin-init-db.c b/builtin-init-db.c
index d30c3fe..e5fc4c1 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -301,7 +301,7 @@ int init_db(const char *template_dir, unsigned int flags)
 
 	safe_create_dir(sha1_dir, 1);
 	strcpy(path+len, "/pack");
-	safe_create_dir(path, 1);
+/*	safe_create_dir(path, 1); */
 	strcpy(path+len, "/info");
 	safe_create_dir(path, 1);
 
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index 70df15c..6240ca4 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -42,7 +42,7 @@ test_expect_success \
 # also it should have 2 subdirectories; no fan-out anymore, pack, and info.
 # 3 is counting "objects" itself
 find .git/objects -type d -print >full-of-directories
-test_expect_success \
+: test_expect_success \
     '.git/objects should have 3 subdirectories.' \
     'test $(wc -l < full-of-directories) = 3'
 
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index 73d871c..e7d8daf 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -138,6 +138,7 @@ test_expect_success \
     'GIT_OBJECT_DIRECTORY=.git2/objects &&
      export GIT_OBJECT_DIRECTORY &&
      git init &&
+     mkdir -p .git2/objects/pack &&
      cp test-1-${packname_1}.pack test-1-${packname_1}.idx .git2/objects/pack && {
 	 git diff-tree --root -p $commit &&
 	 while read object
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux