Thread (37 messages) 37 messages, 4 authors, 2016-06-15

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

From: Johan Herland <hidden>
Date: 2016-06-15 22:48:25

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 <redacted>
Acked-by: Johan Herland <redacted>

[...]
quoted hunk ↗ jump to hunk
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, [off-list ref]
www.herland.net
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help