git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 2/3] Add function per_branch_config.

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 9, 2011, 01:14 UTC
Message-ID
<20110209011441.GA24346@elie>
In-Reply-To
<1297211028-14382-3-git-send-email-jaredhance@gmail.com>
Jared Hance wrote:
> [PATCH v3 2/3] Add function per_branch_config.
>
> Adds a configuration function to be filled up more in the next patch.
Micronit: subject should be of the form
	subsystem: do something really great
with no full stop.  So the series might be, roughly:
 - merge: introduce setup_merge_commit helper function
 - merge: introduce per-branch configuration helper function
 - merge: add support for merging from upstream by default

Commit message bodies tend to be in the imperative mood, just like the patches themselves.

Anyway, I like patch 1.  One tiny nit on this one:
Show 15 quoted lines
> +++ b/builtin/merge.c
> @@ -498,11 +498,15 @@ cleanup:
>  	strbuf_release(&bname);
>  }
>  
> -static int git_merge_config(const char *k, const char *v, void *cb)
> +static int per_branch_config(const char *k, const char *v, void *cb)
>  {
> -	if (branch && !prefixcmp(k, "branch.") &&
> -		!prefixcmp(k + 7, branch) &&
> -		!strcmp(k + 7 + strlen(branch), ".mergeoptions")) {
> +	const char *variable;
> +	if (!branch || prefixcmp(k, "branch.")
> +	   || prefixcmp(k + 7, branch))
> +		return 1; /* not what I handle */
Alignment: isn't the "||" meant to be one space over?
Based on a quick grep[1], it seems the prevailing style is rather
	if (!branch || prefixcmp(k, "branch.") ||
	    prefixcmp(k + 7, branch))
		return 1;

with the || at the end of the line, though I'm not sure I care much. :)

With or without an extra space before the ||,
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Thanks for a nice cleanup. Jonathan

[1]
addup () {
	sum=0
	while read term
	do
		: $((sum = sum + term))
	done
	echo $sum
}
 $ git grep --cached -c -e '||$' | cut -d: -f2 | addup
 730
 $ git grep --cached -c -e '  ||' | cut -d: -f2 | addup
 98
 $ git grep --cached -c -e '	||' | cut -d: -f2 | addup
 79
Previous: Jared HanceNext: Junio C Hamano
Message 10 of 14 in “Add support for merging from upstream by default.”
  1. Add support for merging from upstream by default.Jared Hance, Feb 8, 2011
  2. Jay SoffianFeb 8, 2011
  3. Jonathan NiederFeb 8, 2011
  4. Junio C HamanoFeb 9, 2011
  5. Jonathan NiederFeb 9, 2011
  6. 0/3 Updated patch series for default upstream mergeJared Hance, Feb 9, 2011
  7. 1/3 Add setup_merge_commit function to merge/builtin.c.Jared Hance, Feb 9, 2011
  8. Junio C HamanoFeb 9, 2011
  9. 2/3 Add function per_branch_config.Jared Hance, Feb 9, 2011
  10. Jonathan NiederFeb 9, 2011
  11. Junio C HamanoFeb 9, 2011
  12. 3/3 Add support for merging from upstream by default.Jared Hance, Feb 9, 2011
  13. Jonathan NiederFeb 9, 2011
  14. Junio C HamanoFeb 9, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.