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

Re: [PATCH v3 3/3] Add support for merging from upstream by default.

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 9, 2011, 01:41 UTC
Message-ID
<20110209014129.GB24346@elie>
In-Reply-To
<1297211028-14382-4-git-send-email-jaredhance@gmail.com>
Jared Hance wrote:
Show 7 quoted lines
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1389,6 +1389,12 @@ man.<tool>.path::
> 
>  include::merge-config.txt[]
> 
> +merge.defaultUpstream::
[...]

Might make sense to put this in merge-config.txt, to get documentation in git-merge(1) for free.

Show 8 quoted lines
> --- a/builtin/merge.c
> +++ b/builtin/merge.c
> @@ -525,6 +527,8 @@ static int per_branch_config(const char *k, const char *v, void *cb)
>  
>  		return 0;
>  	}
> +	else if (!strcmp(variable, ".merge"))
> +		return git_config_string(&upstream_branch, k, v);
Style:
	} else if (...) {
		return git_config_string(...);
	}
Show 13 quoted lines
> @@ -1017,9 +1023,13 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
>  	if (!allow_fast_forward && fast_forward_only)
>  		die("You cannot combine --no-ff with --ff-only.");
>  
> -	if (!argc)
> -		usage_with_options(builtin_merge_usage,
> -			builtin_merge_options);
> +	if (!argc) {
> +		if (!default_upstream || !upstream_branch)
> +			usage_with_options(builtin_merge_usage,
> +					builtin_merge_options);
> +		else
> +			setup_merge_commit(&buf, &remotes, upstream_branch);
Why the "else"?  usage_msg_opt doesn't return to the caller.

Hopefully someone will chime in with some tests to complement t5520-pull (hint, hint). :)

Jonathan
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index c1efaaa..bc8ce25 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -11,7 +11,7 @@ SYNOPSIS
 [verse]
 'git merge' [-n] [--stat] [--no-commit] [--squash]
 	[-s <strategy>] [-X <strategy-option>]
-	[--[no-]rerere-autoupdate] [-m <msg>] <commit>...
+	[--[no-]rerere-autoupdate] [-m <msg>] [<commit>...]
 'git merge' <msg> HEAD <commit>...
 'git merge' --abort
 
@@ -97,7 +97,10 @@ commit or stash your changes before running 'git merge'.
 	Commits, usually other branch heads, to merge into our branch.
 	You need at least one <commit>.  Specifying more than one
 	<commit> obviously means you are trying an Octopus.
-
++
+By default, if no commit is specified then git will error out.
+However, the `merge.defaultToUpstream` configuration item (see below)
+changes that.
 
 PRE-MERGE CHECKS
 ----------------
Previous: Jared HanceNext: Junio C Hamano
Message 13 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.