Re: [PATCH v6 08/13] notes: implement helpers needed for note copying during rewrite

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday 10 March 2010, Thomas Rast wrote:
> 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@xxxxxxxxxxxxxxx>

Acked-by: Johan Herland <johan@xxxxxxxxxxx>

[...]

> diff --git a/builtin/notes.c b/builtin/notes.c
> index 576a989..6c2297a 100644
> --- a/builtin/notes.c
> +++ b/builtin/notes.c

[...]

> +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@xxxxxxxxxxx>
www.herland.net
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]