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 ----------------