From: Jonathan Nieder <jrnieder@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>,
Daniel Barkalow <barkalow@iabervon.org>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2] rerere: Expose an API corresponding to 'clear' functionality
Date: Wed, 13 Apr 2011 15:38:43 -0500 [thread overview]
Message-ID: <20110413203843.GC30630@elie> (raw)
In-Reply-To: <1302700718-19093-1-git-send-email-artagnon@gmail.com>
Hi,
Ramkumar Ramachandra wrote:
> Expose a new function called rerere_clear,
The commit message is a good chance to quickly explain the API. What
does the function do? When would one call it? Is it equivalent to
running "git rerere clear"? Any gotchas?
> and make 'builtin/rerere.c'
> use this when the corresponding command-line argument is passed.
Didn't "git rerere" already use the functionality of this function?
I'm not sure what this part means.
> As a
> side-effect, also expose unlink_rr_item as unlink_rerere_item.
This is not a side-effect; you did it directly.
I think the reason for this is that rerere_gc is not being exposed at
the same time, right? I suppose if I were doing it, I would have
moved that to rerere.c, too and kept unlink_rr_item static, but there
is also appeal in a minimal patch. It would be clearer to say
something to the effect that we
Also export unlink_rr_item as unlink_rerere_item so
rerere_clear and the un-libified "git rerere gc" can
both use it.
[...]
> +++ b/builtin/rerere.c
> @@ -142,19 +134,14 @@ int cmd_rerere(int argc, const char **argv, const char *prefix)
> pathspec = get_pathspec(prefix, argv + 1);
> return rerere_forget(pathspec);
> }
> + if (!strcmp(argv[0], "clear"))
> + return rerere_clear();
>
> fd = setup_rerere(&merge_rr, flags);
[...]
> +++ b/rerere.c
> @@ -671,3 +679,22 @@ int rerere_clear(void)
[...]
> + fd = setup_rerere(&merge_rr, RERERE_NOAUTOUPDATE);
> + if (fd < 0)
> + return 0;
Why RERERE_NOAUTOUPDATE instead of 0? (Of course it doesn't matter in
practice. Maybe "0" would convey that more clearly?)
> +
> + for (i = 0; i < merge_rr.nr; i++) {
> + const char *name = (const char *)merge_rr.items[i].util;
> + if (!has_rerere_resolution(name))
> + unlink_rerere_item(name);
> + }
> + string_list_clear(&merge_rr, 1);
> + unlink_or_warn(git_path("MERGE_RR"));
> + return 0;
> +}
The write_lock is never rolled back. "git rerere" won't care since it
exits moments later and the atexit handler is called, but others might
mind that they can't perform any more rerere operations afterwards. :)
Thanks and hope that helps.
Jonathan
next prev parent reply other threads:[~2011-04-13 20:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-11 8:51 [PATCH] rerere: Expose an API corresponding to 'clear' functionality Ramkumar Ramachandra
2011-04-11 18:36 ` Junio C Hamano
2011-04-13 13:18 ` [PATCH v2] " Ramkumar Ramachandra
2011-04-13 20:38 ` Jonathan Nieder [this message]
2011-05-06 6:36 ` [PATCH v3] " Ramkumar Ramachandra
2011-05-06 16:51 ` Junio C Hamano
2011-05-07 13:17 ` Ramkumar Ramachandra
2011-05-08 7:30 ` [PATCH v4 0/2] Libify rerere: clear and gc Ramkumar Ramachandra
2011-05-08 7:30 ` [PATCH v4 1/2] usage: Introduce error_errno corresponding to die_errno Ramkumar Ramachandra
2011-05-08 9:46 ` Ramkumar Ramachandra
2011-05-08 18:10 ` Junio C Hamano
2011-05-08 7:30 ` [PATCH v4 2/2] rerere: Libify "rerere clear" and "rerere gc" Ramkumar Ramachandra
2011-05-08 20:06 ` Junio C Hamano
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=20110413203843.GC30630@elie \
--to=jrnieder@gmail.com \
--cc=artagnon@gmail.com \
--cc=barkalow@iabervon.org \
--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).