Re: [PATCH v6 08/13] notes: implement helpers needed for note copying during rewrite
- From
Johan Herland <johan@herland.net>
- Date
- Mar 11, 2010, 10:50 UTC
- Message-ID
- <201003111150.58740.johan@herland.net>
- In-Reply-To
- <cf0765f47b3a97061997125d4440a475cda03e22.1268229087.git.trast@student.ethz.ch>
On Wednesday 10 March 2010, Thomas Rast wrote:
Show 9 quoted lines
> Implement helper functions to load the rewriting config, and to > actually copy the notes. Also document the config. > > Secondly, also implement an undocumented --for-rewrite=<cmd> option to > 'git notes copy' which is used like --stdin, but also puts the > configuration for <cmd> into effect. It will be needed to support the > copying in git-rebase. > > Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Johan Herland <johan@herland.net>
[...]
> diff --git a/builtin/notes.c b/builtin/notes.c > index 576a989..6c2297a 100644 > --- a/builtin/notes.c > +++ b/builtin/notes.c
[...]
Show 32 quoted lines
> +struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)
> +{
> + struct notes_rewrite_cfg *c = xmalloc(sizeof(struct
> notes_rewrite_cfg)); + const char *rewrite_mode_env =
> getenv(GIT_NOTES_REWRITE_MODE_ENVIRONMENT); + const char
> *rewrite_refs_env = getenv(GIT_NOTES_REWRITE_REF_ENVIRONMENT); + c->cmd
> = cmd;
> + c->enabled = 1;
> + c->combine = combine_notes_concatenate;
> + c->refs = xcalloc(1, sizeof(struct string_list));
> + c->refs->strdup_strings = 1;
> + c->refs_from_env = 0;
> + c->mode_from_env = 0;
> + if (rewrite_mode_env) {
> + c->mode_from_env = 1;
> + c->combine = parse_combine_notes_fn(rewrite_mode_env);
> + if (!c->combine)
> + error("Bad " GIT_NOTES_REWRITE_MODE_ENVIRONMENT
> + " value: '%s'", rewrite_mode_env);
> + }
> + if (rewrite_refs_env) {
> + c->refs_from_env = 1;
> + string_list_add_refs_from_colon_sep(c->refs, rewrite_refs_env);
> + }
> + git_config(notes_rewrite_config, c);
> + if (!c->enabled || !c->refs->nr) {
> + string_list_clear(c->refs, 0);
> + free(c->refs);
> + free(c);
> + return NULL;
> + }
> + c->trees = load_notes_trees(c->refs);Ah, this invalidates some of my comments to PATCH 02/13. Please disregard those comments.
...Johan
-- Johan Herland, <johan@herland.net> www.herland.net