Re: [PATCH v4 4/4] merge: add support for merging from upstream by default

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

 



On Fri, Feb 11, 2011 at 00:40, Jared Hance <jaredhance@xxxxxxxxx> wrote:
> Add the option merge.defaultupstream to add support for merging from
> the upstream branch by default. The upstream branch is found using
> branch.[name].merge.
>
> Signed-off-by: Jared Hance <jaredhance@xxxxxxxxx>
> ---
> ÂDocumentation/config.txt | Â Â6 ++++++
> Âbuiltin/merge.c     Â|  32 +++++++++++++++++++++++---------
> Â2 files changed, 29 insertions(+), 9 deletions(-)
>
> diff --git a/Documentation/config.txt b/Documentation/config.txt
> index c5e1835..4415691 100644
> --- a/Documentation/config.txt
> +++ b/Documentation/config.txt
> @@ -1389,6 +1389,12 @@ man.<tool>.path::
>
> Âinclude::merge-config.txt[]
>
> +merge.defaultUpstream::
> + Â Â Â If merge is called without any ref arguments, merge from the branch
> + Â Â Â specified in branch.<current branch>.merge, which is considered to be
> + Â Â Â the upstream branch for the current branch, possibly set by --track or
> + Â Â Â --set-upstream.
> +
> Âmergetool.<tool>.path::
> Â Â Â ÂOverride the path for the given tool. ÂThis is useful in case
> Â Â Â Âyour tool is not in the PATH.
> diff --git a/builtin/merge.c b/builtin/merge.c
> index 71b392d..a3ca6a0 100644
> --- a/builtin/merge.c
> +++ b/builtin/merge.c
> @@ -37,7 +37,7 @@ struct strategy {
> Â};
>
> Âstatic const char * const builtin_merge_usage[] = {
> - Â Â Â "git merge [options] <branch>...",
> + Â Â Â "git merge [options] [<branch>...]",
> Â Â Â Â"git merge [options] <msg> HEAD <branch>",
> Â Â Â ÂNULL
> Â};
> @@ -58,6 +58,8 @@ static int option_renormalize;
> Âstatic int verbosity;
> Âstatic int allow_rerere_auto;
> Âstatic int abort_current_merge;
> +static int default_upstream;
> +static const char *upstream_branch;
>
> Âstatic struct strategy all_strategy[] = {
> Â Â Â Â{ "recursive", ÂDEFAULT_TWOHEAD | NO_TRIVIAL },
> @@ -524,7 +526,8 @@ static int per_branch_config(const char *k, const char *v, void *cb)
> Â Â Â Â Â Â Â Âfree(buf);
>
> Â Â Â Â Â Â Â Âreturn 0;
> - Â Â Â }
> + Â Â Â } else if (!strcmp(variable, ".merge"))
> + Â Â Â Â Â Â Â return git_config_string(&upstream_branch, k, v);

I don't think, that this is the correct way to get the "upstream" from
a branch. Please have a look into sha1_name.c:interpret_branch_name()
and builtin/for-each-ref.c:populate_value() how they resolve
"upstream".

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