All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 2/2] Revert be7c6d4 (pack-refs: remove newly empty directories)
Date: Sat, 11 Feb 2012 14:55:07 +0700	[thread overview]
Message-ID: <1328946907-31650-2-git-send-email-pclouds@gmail.com> (raw)
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

  reply	other threads:[~2012-02-11  7:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 16:25 [PATCH] Remove empty ref directories while reading loose refs Nguyễn Thái Ngọc Duy
2012-02-10 19:09 ` Junio C Hamano
2012-02-10 20:53 ` Jeff King
2012-02-11  7:55 ` [PATCH 1/2] pack-refs: remove all empty directories under $GIT_DIR/refs Nguyễn Thái Ngọc Duy
2012-02-11  7:55   ` Nguyễn Thái Ngọc Duy [this message]
2012-02-11  8:26   ` Junio C Hamano
2012-02-11  8:55     ` Nguyen Thai Ngoc Duy
2012-02-11 17:59       ` Junio C Hamano
2012-02-11 11:08   ` [PATCH] pack-refs: remove all empty dirs under .git/{refs,logs/refs} Nguyễn Thái Ngọc Duy
2012-02-11 11:27     ` Thomas Adam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1328946907-31650-2-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.