git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 25, 2009, 07:15 UTC
Message-ID
<7vk57fc7gz.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7vocwrc7oe.fsf_-_@gitster.siamese.dyndns.org>

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
Previous: Junio C HamanoNext: Johannes Sixt
Message 5 of 10 in “git-push error: Cannot write keep file”
  1. Rafael Darder CalvoFeb 24, 2009
  2. Junio C HamanoFeb 24, 2009
  3. Rafael Darder CalvoFeb 24, 2009
  4. Make sure objects/pack exists before creating a new packJunio C Hamano, Feb 25, 2009
  5. Junio C HamanoFeb 25, 2009
  6. Johannes SixtFeb 26, 2009
  7. Mike RalphsonFeb 26, 2009
  8. Johannes SixtFeb 26, 2009
  9. Mike RalphsonFeb 26, 2009
  10. Junio C HamanoFeb 26, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.