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

[PATCH 2/2] Revert be7c6d4 (pack-refs: remove newly empty directories)

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Feb 11, 2012, 07:55 UTC
Message-ID
<1328946907-31650-2-git-send-email-pclouds@gmail.com>
In-Reply-To
<1328946907-31650-1-git-send-email-pclouds@gmail.com>

The functionality is taken over by prune_empty_dirs. Only code is reverted. The added test remains to verify.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 pack-refs.c |   32 --------------------------------
 1 files changed, 0 insertions(+), 32 deletions(-)
diff --git a/pack-refs.c b/pack-refs.c
index bb3a9c4..746211e 100644
--- a/pack-refs.c
+++ b/pack-refs.c
@@ -60,37 +60,6 @@ static int handle_one_ref(const char *path, const unsigned char *sha1,
 	return 0;
 }
 
-/*
- * Remove empty parents, but spare refs/ and immediate subdirs.
- * Note: munges *name.
- */
-static void try_remove_empty_parents(char *name)
-{
-	char *p, *q;
-	int i;
-	p = name;
-	for (i = 0; i < 2; i++) { /* refs/{heads,tags,...}/ */
-		while (*p && *p != '/')
-			p++;
-		/* tolerate duplicate slashes; see check_refname_format() */
-		while (*p == '/')
-			p++;
-	}
-	for (q = p; *q; q++)
-		;
-	while (1) {
-		while (q > p && *q != '/')
-			q--;
-		while (q > p && *(q-1) == '/')
-			q--;
-		if (q == p)
-			break;
-		*q = '\0';
-		if (rmdir(git_path("%s", name)))
-			break;
-	}
-}
-
 static int prune_empty_dirs(const char *path)
 {
 	int nr_entries = 0, pathlen = strlen(path);
@@ -151,7 +120,6 @@ static void prune_ref(struct ref_to_prune *r)
 	if (lock) {
 		unlink_or_warn(git_path("%s", r->name));
 		unlock_ref(lock);
-		try_remove_empty_parents(r->name);
 	}
 }
 
-- 
1.7.8.36.g69ee2
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 5 of 10 in “Remove empty ref directories while reading loose refs”
  1. Remove empty ref directories while reading loose refsNguyễn Thái Ngọc Duy, Feb 10, 2012
  2. Junio C HamanoFeb 10, 2012
  3. Jeff KingFeb 10, 2012
  4. 1/2 pack-refs: remove all empty directories under $GIT_DIR/refsNguyễn Thái Ngọc Duy, Feb 11, 2012
  5. 2/2 Revert be7c6d4 (pack-refs: remove newly empty directories)Nguyễn Thái Ngọc Duy, Feb 11, 2012
  6. Junio C HamanoFeb 11, 2012
  7. Nguyen Thai Ngoc DuyFeb 11, 2012
  8. Junio C HamanoFeb 11, 2012
  9. pack-refs: remove all empty dirs under .git/{refs,logs/refs}Nguyễn Thái Ngọc Duy, Feb 11, 2012
  10. Thomas AdamFeb 11, 2012

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.