From: Adam Simpkins <simpkins@facebook.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH] prune: honor --expire=never
Date: Fri, 26 Feb 2010 17:21:30 -0800 [thread overview]
Message-ID: <20100227012130.GA28452@facebook.com> (raw)
In-Reply-To: <7v4ol3ilri.fsf@alter.siamese.dyndns.org>
On Fri, Feb 26, 2010 at 04:07:45PM -0800, Junio C Hamano wrote:
> Adam Simpkins <simpkins@facebook.com> writes:
>
> > diff --git a/builtin-prune.c b/builtin-prune.c
> > index 4675f60..ce43271 100644
> > --- a/builtin-prune.c
> > +++ b/builtin-prune.c
> > @@ -7,6 +7,8 @@
> > #include "parse-options.h"
> > #include "dir.h"
> >
> > +#define ALWAYS_EXPIRE ((unsigned int)-1)
> > ...
> > @@ -34,7 +36,7 @@ static int prune_tmp_object(const char *path, const char *filename)
> > static int prune_object(char *path, const char *filename, const unsigned char *sha1)
> > {
> > const char *fullpath = mkpath("%s/%s", path, filename);
> > - if (expire) {
> > + if (expire != ALWAYS_EXPIRE) {
>
> Wouldn't it be a lot simpler to initialize expire to "now" for the default
> case, and remove all these "if (expire)"?
Sure, I can submit an updated patch to do that. It does slightly
change the behavior of "git prune" with no --expire argument though:
- Objects with an mtime in the future will no longer be pruned.
- We'll call lstat() all of the unreachable objects, even though it
isn't really necessary.
However, the code is indeed simpler, if you don't think either of
these changes matter.
> I think that is how the logic
> to expire reflog entries work, which I think is saner.
Hmm. reflog appears to have the same bug when parsing the
gc.reflogexpire and gc.reflogexpireunreachable options. Setting
either of these to "never" or "false" results in the default
expiration time. (However, using --expire=never on the command line
works correctly.)
I'll submit a separate patch for that.
> While you are at it, you might want to think about a way to unify what
> parse_opt_approxidate_cb() and parse_expire_cfg_value() do. The latter
> knows about "expire = false" but the former doesn't, which is a slight
> inconsistency.
Sure, I'll look into it and submit a patch.
--
Adam Simpkins
simpkins@facebook.com
next prev parent reply other threads:[~2010-02-27 1:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-26 21:59 [PATCH] prune: honor --expire=never Adam Simpkins
2010-02-27 0:07 ` Junio C Hamano
2010-02-27 1:21 ` Adam Simpkins [this message]
2010-02-27 3:50 ` [PATCH 1/3] " Adam Simpkins
2010-02-27 3:50 ` [PATCH 2/3] reflog: honor gc.reflogexpire=never Adam Simpkins
2010-02-27 3:50 ` [PATCH 3/3] clean up parsing of expiration dates Adam Simpkins
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=20100227012130.GA28452@facebook.com \
--to=simpkins@facebook.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).