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

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

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
Feb 11, 2011, 07:37 UTC
Message-ID
<AANLkTi=F8E02GXDsBzne4Fbrg5a0BEK8N7zS_MoaRE+B@mail.gmail.com>
In-Reply-To
<1297381209-6377-8-git-send-email-jaredhance@gmail.com>
On Fri, Feb 11, 2011 at 00:40, Jared Hance <jaredhance@gmail.com> wrote:
Show 56 quoted lines
> 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@gmail.com>
> ---
>  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
Previous: Jared HanceNext: Jared Hance
Message 9 of 12 in “Updated patch series for default upstream merge”
  1. 0/4 Updated patch series for default upstream mergeJared Hance, Feb 10, 2011
  2. 1/4 merge: update the usage information to be more modernJared Hance, Feb 10, 2011
  3. 1/5 t5526: Fix wrong argument order in "git config"Jared Hance, Feb 10, 2011
  4. 2/4 merge: introduce setup_merge_commit helper functionJared Hance, Feb 10, 2011
  5. 2/5 merge: update the usage information to be more modernJared Hance, Feb 10, 2011
  6. 3/4 merge: introduce per-branch-configuration helper functionJared Hance, Feb 10, 2011
  7. 3/5 merge: introduce setup_merge_commit helper functionJared Hance, Feb 10, 2011
  8. 4/4 merge: add support for merging from upstream by defaultJared Hance, Feb 10, 2011
  9. Bert WesargFeb 11, 2011
  10. 4/5 merge: introduce per-branch-configuration helper functionJared Hance, Feb 10, 2011
  11. 5/5 merge: add support for merging from upstream by defaultJared Hance, Feb 10, 2011
  12. Jared HanceFeb 10, 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.