From: Johannes Sixt <j6t@kdbg.org>
To: karsten.blees@dcon.de
Cc: kusmabite@gmail.com, git@vger.kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
msysGit <msysgit@googlegroups.com>,
Pat Thoyts <patthoyts@gmail.com>,
Stefan Naewe <stefan.naewe@gmail.com>
Subject: Re: [msysGit] [PATCH] fix deletion of .git/objects sub-directories in git-prune/repack
Date: Tue, 06 Mar 2012 19:32:41 +0100 [thread overview]
Message-ID: <4F565849.80303@kdbg.org> (raw)
In-Reply-To: <OF93114E93.E64C1F7D-ONC12579B9.0032A592-C12579B9.00332D78@dcon.de>
Am 06.03.2012 10:18, schrieb karsten.blees@dcon.de:
> On some systems (e.g. Windows XP), directories cannot be deleted while
> they're open. Both git-prune and git-repack (and thus, git-gc) try to
> rmdir while holding a DIR* handle on the directory, leaving dangling
> empty directories in the .git/objects store.
>
> Fix it by swapping the rmdir / closedir calls.
The reasoning makes a lot of sense. I wonder why object directories are
pruned nevertheless when I run git gc --prune (I run git master plus a
few topics from pu).
> diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c
> index f9463de..a834417 100644
> --- a/builtin/prune-packed.c
> +++ b/builtin/prune-packed.c
> @@ -36,7 +36,6 @@ static void prune_dir(int i, DIR *dir, char *pathname,
> int len, int opts)
> display_progress(progress, i + 1);
> }
> pathname[len] = 0;
> - rmdir(pathname);
After moving the rmdir() away from prune_dir(), the truncation of the
pathname does not logically belong here anymore. It should be moved with
the rmdir(). Looks good otherwise.
> }
>
> void prune_packed_objects(int opts)
> @@ -65,6 +64,7 @@ void prune_packed_objects(int opts)
> continue;
> prune_dir(i, d, pathname, len + 3, opts);
> closedir(d);
> + rmdir(pathname);
> }
> stop_progress(&progress);
> }
> diff --git a/builtin/prune.c b/builtin/prune.c
> index 58d7cb8..b99b635 100644
> --- a/builtin/prune.c
> +++ b/builtin/prune.c
> @@ -85,9 +85,9 @@ static int prune_dir(int i, char *path)
> }
> fprintf(stderr, "bad sha1 file: %s/%s\n", path,
> de->d_name);
> }
> + closedir(dir);
> if (!show_only)
> rmdir(path);
> - closedir(dir);
> return 0;
> }
>
next prev parent reply other threads:[~2012-03-06 18:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CABPQNSbo5yEosEid_SKoiCS4c8eYAaOHy4skSOBJsef+E6H6Sw@mail.gmail.com>
2012-03-06 9:18 ` [PATCH] fix deletion of .git/objects sub-directories in git-prune/repack karsten.blees
2012-03-06 18:32 ` Johannes Sixt [this message]
2012-03-06 20:19 ` [msysGit] " Junio C Hamano
2012-03-06 21:19 ` Johannes Sixt
2012-03-06 21:30 ` karsten.blees
2012-03-06 21:49 ` Junio C Hamano
2012-03-07 10:50 ` karsten.blees
2012-03-06 21:57 ` Junio C Hamano
2012-03-06 21:47 ` karsten.blees
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=4F565849.80303@kdbg.org \
--to=j6t@kdbg.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=karsten.blees@dcon.de \
--cc=kusmabite@gmail.com \
--cc=msysgit@googlegroups.com \
--cc=patthoyts@gmail.com \
--cc=stefan.naewe@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).