{"thread":{"id":"19849","subject":"[RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","startedAt":"2009-06-18T07:57:11Z","lastAt":"2009-06-19T13:42:35Z","messageCount":19,"participants":["Santi Béjar","Johannes Schindelin","Paolo Bonzini","Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"116530","messageId":"1245311834-5290-1-git-send-email-santi@agolina.net","threadId":"19849","inReplyTo":null,"subject":"[RFC/PATCH 0/2] Support for arbitrary mapping for \"git pull --rebase\"","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T07:57:11Z","receivedAt":"2009-06-18T07:57:11Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"Hi *,\n\n  Here you have my patch serie to add support for arbitrary mapping for\n\"git pull --rebase\".\n\n  This is a RFC specially for the new \"git remote\" subcommand, tracking.\nSuggest other things if you think of a better way.\n\n  Santi\n\nSanti BÃ©jar (2):\n  remote tracking: return the tracking branch for the given branches\n  get_remote_merge_branch: Support for arbitrary mapping\n\n Documentation/git-remote.txt |    7 +++++++\n builtin-remote.c             |   35 +++++++++++++++++++++++++++++++++++\n git-parse-remote.sh          |   21 ++++++++++++---------\n 3 files changed, 54 insertions(+), 9 deletions(-)\n"},{"id":"116529","messageId":"1245311834-5290-2-git-send-email-santi@agolina.net","threadId":"19849","inReplyTo":"1245311834-5290-1-git-send-email-santi@agolina.net","subject":"[RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T07:57:12Z","receivedAt":"2009-06-18T07:57:12Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"Signed-off-by: Santi Béjar <santi@agolina.net>\n---\n Documentation/git-remote.txt |    7 +++++++\n builtin-remote.c             |   35 +++++++++++++++++++++++++++++++++++\n 2 files changed, 42 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt\nindex 9e2b4ea..e444899 100644\n--- a/Documentation/git-remote.txt\n+++ b/Documentation/git-remote.txt\n@@ -17,6 +17,7 @@ SYNOPSIS\n 'git remote show' [-n] <name>\n 'git remote prune' [-n | --dry-run] <name>\n 'git remote update' [-p | --prune] [group | remote]...\n+'git remote tracking' <name> <branch>...\n \n DESCRIPTION\n -----------\n@@ -128,6 +129,12 @@ be updated.  (See linkgit:git-config[1]).\n +\n With `--prune` option, prune all the remotes that are updated.\n \n+'tracking'::\n+\n+Returns the tracking branch for the given remote (<name>) and branch\n+(<branch>). Note that <branch> must exactly match the left hand side of\n+the refspec of the given remote.\n+\n \n DISCUSSION\n ----------\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 709f8a6..bb8e73b 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -16,6 +16,7 @@ static const char * const builtin_remote_usage[] = {\n \t\"git remote show [-n] <name>\",\n \t\"git remote prune [-n | --dry-run] <name>\",\n \t\"git remote [-v | --verbose] update [-p | --prune] [group]\",\n+\t\"git remote tracking <name> <branch>...\",\n \tNULL\n };\n \n@@ -665,6 +666,38 @@ static int remove_branches(struct string_list *branches)\n \treturn result;\n }\n \n+static int tracking(int argc, const char **argv)\n+{\n+\tstruct option options[] = {\n+\t\tOPT_END()\n+\t};\n+\tstruct remote *remote;\n+\tstatic const char **refs = NULL;\n+\tint ref_nr = 0;\n+\tint i = 0;\n+\tstruct refspec *refspec;\n+\n+\tif (argc < 3)\n+\t\tusage_with_options(builtin_remote_usage, options);\n+\tremote = remote_get(argv[1]);\n+\tif (!remote)\n+\t\tdie(\"No such remote: %s\", argv[1]);\n+\trefs = xcalloc(argc + 1, sizeof(const char *));\n+\tfor (i = 2; i < argc; i++) {\n+\t\trefs[ref_nr++] = argv[i];\n+\t}\n+\trefs[ref_nr] = NULL;\n+\tmemset(&refspec, 0, sizeof(*refspec));\n+\trefspec = parse_fetch_refspec(ref_nr, refs);\n+\tfor (i = 0; i < ref_nr ; i++) {\n+\t\tif (!remote_find_tracking(remote, &refspec[i]))\n+\t\t\tprintf(\"%s\\n\", refspec[i].dst);\n+\t\telse\n+\t\t\treturn 1;\n+\t}\n+\treturn 0;\n+}\n+\n static int rm(int argc, const char **argv)\n {\n \tstruct option options[] = {\n@@ -1348,6 +1381,8 @@ int cmd_remote(int argc, const char **argv, const char *prefix)\n \t\tresult = show_all();\n \telse if (!strcmp(argv[0], \"add\"))\n \t\tresult = add(argc, argv);\n+\telse if (!strcmp(argv[0], \"tracking\"))\n+\t\tresult = tracking(argc, argv);\n \telse if (!strcmp(argv[0], \"rename\"))\n \t\tresult = mv(argc, argv);\n \telse if (!strcmp(argv[0], \"rm\"))\n-- \n1.6.3.2.406.gd6a466\n"},{"id":"116532","messageId":"1245311834-5290-3-git-send-email-santi@agolina.net","threadId":"19849","inReplyTo":"1245311834-5290-1-git-send-email-santi@agolina.net","subject":"Re: branch.<branch>.merge and --format='%(upstream)'","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T07:57:13Z","receivedAt":"2009-06-18T07:57:13Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"\n2009/6/16 Junio C Hamano <gitster@pobox.com>\n>\n> Jeff King <peff@peff.net> writes:\n>\n> > On Tue, Jun 16, 2009 at 01:08:02PM +0200, Santi BÃ©jar wrote:\n> >\n> >>   I've noticed that having branch.<branch>.merge set with the branch\n> >> name, and not with the full ref, cause problems with\n> >> --format='%(upstream)'  and also with the \"branch -av\" and \"git\n> >> status\" upstream branch outputs. But git-fetch and git-pull works ok,\n> >> so it is a valid setting.\n> >\n> > Actually, it is broken in a lot of places. for-each-ref relies on the\n> > same code as \"git status\", \"git checkout\", etc, which will all fail to\n> > display tracking info. I believe the same code is also used for updating\n> > tracking branches on push. So I'm not sure if it was ever intended to be\n> > a valid setting.\n>\n> It wasn't.  Some places may accept them gracefully by either being extra\n> nice or by accident.\n\nAnd what about the comments in my reply. And in the branch.<name>.merge\ndocs says: The value is handled like the remote part of a refspec.\n\nIn fact I found it trying to implement a patch to get the local tracking\nfor a given remote and branch. But it only works if you spell the branch with\nits full form:\n\n$ git remote tracking origin master # does not work\n$ git remote tracking origin refs/heads/master # does work\nrefs/remotes/origin/master\n\nso I thought it would be better to resolve the %(upstream) first.\n\nSo if you know how to resolve this and or the %(upstream) issue, please tell me.\n\nAnyway, here you have the WIP patch to get the tracking branch, I'm not sure\nabout the UI (or the script interface?), it is also a RFC.\n\n---8<----\nSubject: [RFC/PATCH]: Output tracking branch from remote and branch\n---\n\nHi,\n\n  as said above it is a RFC, specially for the UI, and also can anyone help\nme with the:\n\n$ git remote tracking origin master # does not work\n\ncase?\n\nThanks,\nSanti\n\nP.D: This case will be used in the \"git pull --rebase remote branch\" case.\n\n builtin-remote.c |   34 ++++++++++++++++++++++++++++++++++\n 1 files changed, 34 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex 709f8a6..03bcc27 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -665,6 +665,38 @@ static int remove_branches(struct string_list *branches)\n \treturn result;\n }\n \n+static int tracking(int argc, const char **argv)\n+{\n+\tstruct option options[] = {\n+\t\tOPT_END()\n+\t};\n+\tstruct remote *remote;\n+\tstatic const char **refs = NULL;\n+\tint ref_nr = 0;\n+\tint i = 0;\n+\tstruct refspec *refspec;\n+\n+\tif (argc < 3)\n+\t\tusage_with_options(builtin_remote_usage, options);\n+\tremote = remote_get(argv[1]);\n+\tif (!remote)\n+\t\tdie(\"No such remote: %s\", argv[1]);\n+\trefs = xcalloc(argc + 1, sizeof(const char *));\n+\tfor (i = 2; i < argc; i++) {\n+\t\trefs[ref_nr++] = argv[i];\n+\t}\n+\trefs[ref_nr] = NULL;\n+\tmemset(&refspec, 0, sizeof(*refspec));\n+\trefspec = parse_fetch_refspec(ref_nr, refs);\n+\tfor (i = 0; i < ref_nr ; i++) {\n+\t\tif (!remote_find_tracking(remote, &refspec[i]))\n+\t\t\tprintf(\"%s\\n\", refspec[i].dst);\n+\t\telse\n+\t\t\treturn 1;\n+\t}\n+\treturn 0;\n+}\n+\n static int rm(int argc, const char **argv)\n {\n \tstruct option options[] = {\n@@ -1348,6 +1380,8 @@ int cmd_remote(int argc, const char **argv, const char *prefix)\n \t\tresult = show_all();\n \telse if (!strcmp(argv[0], \"add\"))\n \t\tresult = add(argc, argv);\n+\telse if (!strcmp(argv[0], \"tracking\"))\n+\t\tresult = tracking(argc, argv);\n \telse if (!strcmp(argv[0], \"rename\"))\n \t\tresult = mv(argc, argv);\n \telse if (!strcmp(argv[0], \"rm\"))\n-- \n1.6.3.2.406.gd6a466\n"},{"id":"116531","messageId":"1245311834-5290-4-git-send-email-santi@agolina.net","threadId":"19849","inReplyTo":"1245311834-5290-1-git-send-email-santi@agolina.net","subject":"[RFC/PATCH 2/2] get_remote_merge_branch: Support for arbitrary mapping","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T07:57:14Z","receivedAt":"2009-06-18T07:57:14Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"This function is used in \"git pull --rebase\" to know the tracking branch.\n\nSigned-off-by: Santi Béjar <santi@agolina.net>\n---\n git-parse-remote.sh |   21 ++++++++++++---------\n 1 files changed, 12 insertions(+), 9 deletions(-)\n\ndiff --git a/git-parse-remote.sh b/git-parse-remote.sh\nindex 5f47b18..1aa6ffe 100755\n--- a/git-parse-remote.sh\n+++ b/git-parse-remote.sh\n@@ -74,8 +74,6 @@ get_remote_merge_branch () {\n \t    repo=$1\n \t    shift\n \t    ref=$1\n-\t    # FIXME: It should return the tracking branch\n-\t    #        Currently only works with the default mapping\n \t    case \"$ref\" in\n \t    +*)\n \t\tref=$(expr \"z$ref\" : 'z+\\(.*\\)')\n@@ -83,13 +81,18 @@ get_remote_merge_branch () {\n \t    esac\n \t    expr \"z$ref\" : 'z.*:' >/dev/null || ref=\"${ref}:\"\n \t    remote=$(expr \"z$ref\" : 'z\\([^:]*\\):')\n-\t    case \"$remote\" in\n-\t    '' | HEAD ) remote=HEAD ;;\n-\t    heads/*) remote=${remote#heads/} ;;\n-\t    refs/heads/*) remote=${remote#refs/heads/} ;;\n-\t    refs/* | tags/* | remotes/* ) remote=\n-\t    esac\n+\t    while true ; do\n+\t\tcase \"$remote\" in\n+\t\t'' | HEAD ) remote=;;\n+\t\theads/*) remote=refs/$remote;;\n+\t\trefs/heads/*) ;;\n+\t\trefs/* | tags/* | remotes/* ) remote=;;\n+\t\t*) remote=heads/$remote\n+\t\tesac\n \n-\t    [ -n \"$remote\" ] && echo \"refs/remotes/$repo/$remote\"\n+\t\t[ -n \"$remote\" ] &&\n+\t\tgit remote tracking $repo $remote && break\n+\t\tcase \"$remote\" in refs/heads/* | \"\" ) break ; esac\n+\t    done\n \tesac\n }\n-- \n1.6.3.2.406.gd6a466\n"},{"id":"116545","messageId":"alpine.DEB.1.00.0906181040320.4848@intel-tinevez-2-302","threadId":"19849","inReplyTo":"1245311834-5290-1-git-send-email-santi@agolina.net","subject":"Re: [RFC/PATCH 0/2] Support for arbitrary mapping for \"git pull --rebase\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-06-18T08:41:05Z","receivedAt":"2009-06-18T08:41:05Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 18 Jun 2009, Santi Béjar wrote:\n\n> Santi B??jar (2):\n\nSeems something is wrong in the --cover-letter utf-8 handlin, no?\n\nCiao,\nDscho"},{"id":"116552","messageId":"adf1fd3d0906180224l668b4c84kc633ec13f8d0296@mail.gmail.com","threadId":"19849","inReplyTo":"alpine.DEB.1.00.0906181040320.4848@intel-tinevez-2-302","subject":"Re: [RFC/PATCH 0/2] Support for arbitrary mapping for \"git pull --rebase\"","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T09:24:01Z","receivedAt":"2009-06-18T09:24:01Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/6/18 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> Hi,\n>\n> On Thu, 18 Jun 2009, Santi Béjar wrote:\n>\n>> Santi B??jar (2):\n>\n> Seems something is wrong in the --cover-letter utf-8 handlin, no?\n\nIn this case (the cover letter) it is send-email that handles the\nutf-8, but I don't know why it is not working, as there is a test in\nt9001-send-email that tests it. I think it worked, I'll try to bisect\nif I found a working version.\n\nSanti\n"},{"id":"116553","messageId":"adf1fd3d0906180227t4da5c0cby3b0e71b132eae68@mail.gmail.com","threadId":"19849","inReplyTo":"1245311834-5290-4-git-send-email-santi@agolina.net","subject":"Re: [RFC/PATCH 2/2] get_remote_merge_branch: Support for arbitrary mapping","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T09:27:31Z","receivedAt":"2009-06-18T09:27:31Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/6/18 Santi Béjar <santi@agolina.net>\n>\n> This function is used in \"git pull --rebase\" to know the tracking branch.\n>\n> Signed-off-by: Santi Béjar <santi@agolina.net>\n> ---\n>  git-parse-remote.sh |   21 ++++++++++++---------\n>  1 files changed, 12 insertions(+), 9 deletions(-)\n>\n> diff --git a/git-parse-remote.sh b/git-parse-remote.sh\n> index 5f47b18..1aa6ffe 100755\n> --- a/git-parse-remote.sh\n> +++ b/git-parse-remote.sh\n\n[...]\n\n> @@ -83,13 +81,18 @@ get_remote_merge_branch () {\n>            esac\n>            expr \"z$ref\" : 'z.*:' >/dev/null || ref=\"${ref}:\"\n>            remote=$(expr \"z$ref\" : 'z\\([^:]*\\):')\n> -           case \"$remote\" in\n> -           '' | HEAD ) remote=HEAD ;;\n[...]\n> +           while true ; do\n> +               case \"$remote\" in\n> +               '' | HEAD ) remote=;;\n\nI forgot to say that I changed the HEAD behavior because the remote\nHEAD and the local remote HEAD (origin/HEAD) can point to different\nbranches, as the local remote HEAD represents your preference for\nwhich is the default remote branch.\n\nSanti\n"},{"id":"116559","messageId":"4A3A2A7D.30502@gnu.org","threadId":"19849","inReplyTo":"1245311834-5290-2-git-send-email-santi@agolina.net","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2009-06-18T11:52:29Z","receivedAt":"2009-06-18T11:52:29Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"Having a testcase would be nice (just a reminder for the final submission).\n\nPaolo\n"},{"id":"116563","messageId":"alpine.DEB.1.00.0906181433330.4297@intel-tinevez-2-302","threadId":"19849","inReplyTo":"1245311834-5290-2-git-send-email-santi@agolina.net","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-06-18T12:35:08Z","receivedAt":"2009-06-18T12:35:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 18 Jun 2009, Santi Béjar wrote:\n\n> diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt\n> index 9e2b4ea..e444899 100644\n> --- a/Documentation/git-remote.txt\n> +++ b/Documentation/git-remote.txt\n> @@ -17,6 +17,7 @@ SYNOPSIS\n>  'git remote show' [-n] <name>\n>  'git remote prune' [-n | --dry-run] <name>\n>  'git remote update' [-p | --prune] [group | remote]...\n> +'git remote tracking' <name> <branch>...\n>  \n>  DESCRIPTION\n>  -----------\n> @@ -128,6 +129,12 @@ be updated.  (See linkgit:git-config[1]).\n>  +\n>  With `--prune` option, prune all the remotes that are updated.\n>  \n> +'tracking'::\n> +\n> +Returns the tracking branch for the given remote (<name>) and branch\n> +(<branch>). Note that <branch> must exactly match the left hand side of\n> +the refspec of the given remote.\n> +\n\n>From that description, it is not clear to me if the branch is the _remote_ \nbranch, the branch _on_ the remote, or the local branch.\n\nIf it is the remote branch (or the branch on the remote), I wonder how you \ndeal with ambiguities, as I can easily create hundreds of branches \ntracking the same remote branch.\n\nIf it is the local branch I wonder why I have to pass the name of the \nremote.\n\nCiao,\nDscho"},{"id":"116567","messageId":"adf1fd3d0906180622n25169f51n6aa249e9167cbc38@mail.gmail.com","threadId":"19849","inReplyTo":"alpine.DEB.1.00.0906181433330.4297@intel-tinevez-2-302","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T13:22:30Z","receivedAt":"2009-06-18T13:22:30Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/6/18 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> Hi,\n>\n> On Thu, 18 Jun 2009, Santi Béjar wrote:\n>\n>> diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt\n>> index 9e2b4ea..e444899 100644\n>> --- a/Documentation/git-remote.txt\n>> +++ b/Documentation/git-remote.txt\n>> @@ -17,6 +17,7 @@ SYNOPSIS\n>>  'git remote show' [-n] <name>\n>>  'git remote prune' [-n | --dry-run] <name>\n>>  'git remote update' [-p | --prune] [group | remote]...\n>> +'git remote tracking' <name> <branch>...\n>>\n>>  DESCRIPTION\n>>  -----------\n>> @@ -128,6 +129,12 @@ be updated.  (See linkgit:git-config[1]).\n>>  +\n>>  With `--prune` option, prune all the remotes that are updated.\n>>\n>> +'tracking'::\n>> +\n>> +Returns the tracking branch for the given remote (<name>) and branch\n>> +(<branch>). Note that <branch> must exactly match the left hand side of\n>> +the refspec of the given remote.\n>> +\n>\n> From that description, it is not clear to me if the branch is the _remote_\n> branch, the branch _on_ the remote, or the local branch.\n\nOK. s/and branch/and remote branch/\n\n>\n> If it is the remote branch (or the branch on the remote), I wonder how you\n> deal with ambiguities, as I can easily create hundreds of branches\n> tracking the same remote branch.\n\nAFAICS from remote_find_tracking (and some tests), it picks the first match.\n\nSo, additional text could be: In case of multiple matches, it picks\nthe first one.\n\nSanti\n"},{"id":"116568","messageId":"adf1fd3d0906180623x68fa250eq9483d308e03fa0c@mail.gmail.com","threadId":"19849","inReplyTo":"4A3A2A7D.30502@gnu.org","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T13:23:02Z","receivedAt":"2009-06-18T13:23:02Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/6/18 Paolo Bonzini <bonzini@gnu.org>:\n> Having a testcase would be nice (just a reminder for the final submission).\n\nSure.\n\nSanti\n"},{"id":"116569","messageId":"m3iqithd24.fsf@localhost.localdomain","threadId":"19849","inReplyTo":"adf1fd3d0906180622n25169f51n6aa249e9167cbc38@mail.gmail.com","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-06-18T13:44:08Z","receivedAt":"2009-06-18T13:44:08Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Santi Béjar <santi@agolina.net> writes:\n> 2009/6/18 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n>> On Thu, 18 Jun 2009, Santi Béjar wrote:\n>>\n>>> diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt\n>>> index 9e2b4ea..e444899 100644\n>>> --- a/Documentation/git-remote.txt\n>>> +++ b/Documentation/git-remote.txt\n>>> @@ -17,6 +17,7 @@ SYNOPSIS\n>>>  'git remote show' [-n] <name>\n>>>  'git remote prune' [-n | --dry-run] <name>\n>>>  'git remote update' [-p | --prune] [group | remote]...\n>>> +'git remote tracking' <name> <branch>...\n>>>\n>>>  DESCRIPTION\n>>>  -----------\n>>> @@ -128,6 +129,12 @@ be updated.  (See linkgit:git-config[1]).\n>>>  +\n>>>  With `--prune` option, prune all the remotes that are updated.\n>>>\n>>> +'tracking'::\n>>> +\n>>> +Returns the tracking branch for the given remote (<name>) and branch\n>>> +(<branch>). Note that <branch> must exactly match the left hand side of\n>>> +the refspec of the given remote.\n>>> +\n>>\n>> From that description, it is not clear to me if the branch is the _remote_\n>> branch, the branch _on_ the remote, or the local branch.\n> \n> OK. s/and branch/and remote branch/\n> \n>> If it is the remote branch (or the branch on the remote), I wonder how you\n>> deal with ambiguities, as I can easily create hundreds of branches\n>> tracking the same remote branch.\n> \n> AFAICS from remote_find_tracking (and some tests), it picks the first match.\n> \n> So, additional text could be: In case of multiple matches, it picks\n> the first one.\n\nWhy not have both:\n\n  git remote tracking <remote> <remote branch>\n\nwould show all local branches that track <remote branch>, and have\n<remote> as default remote, while\n\n  git remote tracking <local branch>\n\nwould show <remote> and <remote branch> if <local branch> is following\nremote-tracking branch.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"116570","messageId":"adf1fd3d0906180655q5c142889r3375169b6cf1f8b0@mail.gmail.com","threadId":"19849","inReplyTo":"m3iqithd24.fsf@localhost.localdomain","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T13:55:53Z","receivedAt":"2009-06-18T13:55:53Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/6/18 Jakub Narebski <jnareb@gmail.com>:\n> Santi Béjar <santi@agolina.net> writes:\n>> 2009/6/18 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n>>> On Thu, 18 Jun 2009, Santi Béjar wrote:\n>>>\n>>>> diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt\n>>>> index 9e2b4ea..e444899 100644\n>>>> --- a/Documentation/git-remote.txt\n>>>> +++ b/Documentation/git-remote.txt\n>>>> @@ -17,6 +17,7 @@ SYNOPSIS\n>>>>  'git remote show' [-n] <name>\n>>>>  'git remote prune' [-n | --dry-run] <name>\n>>>>  'git remote update' [-p | --prune] [group | remote]...\n>>>> +'git remote tracking' <name> <branch>...\n>>>>\n>>>>  DESCRIPTION\n>>>>  -----------\n>>>> @@ -128,6 +129,12 @@ be updated.  (See linkgit:git-config[1]).\n>>>>  +\n>>>>  With `--prune` option, prune all the remotes that are updated.\n>>>>\n>>>> +'tracking'::\n>>>> +\n>>>> +Returns the tracking branch for the given remote (<name>) and branch\n>>>> +(<branch>). Note that <branch> must exactly match the left hand side of\n>>>> +the refspec of the given remote.\n>>>> +\n>>>\n>>> From that description, it is not clear to me if the branch is the _remote_\n>>> branch, the branch _on_ the remote, or the local branch.\n>>\n>> OK. s/and branch/and remote branch/\n>>\n>>> If it is the remote branch (or the branch on the remote), I wonder how you\n>>> deal with ambiguities, as I can easily create hundreds of branches\n>>> tracking the same remote branch.\n>>\n>> AFAICS from remote_find_tracking (and some tests), it picks the first match.\n>>\n>> So, additional text could be: In case of multiple matches, it picks\n>> the first one.\n>\n> Why not have both:\n\nIt makes sense.\n\n>\n>  git remote tracking <remote> <remote branch>\n>\n> would show all local branches that track <remote branch>, and have\n> <remote> as default remote,\n\nMaybe my description is unclear, but it's not about local branches\nwhich track <branch> on <remote>, it is about the local branch\nrepresentation of the remote branch, i.e. not 'master' but\norigin/master (git remote tracking origin master in a default clone).\n\n> while\n>\n>  git remote tracking <local branch>\n>\n> would show <remote> and <remote branch> if <local branch> is following\n> remote-tracking branch.\n\nGood idea.\n\nSanti\n\n> --\n> Jakub Narebski\n> Poland\n> ShadeHawk on #git\n>\n"},{"id":"116573","messageId":"200906181617.07802.jnareb@gmail.com","threadId":"19849","inReplyTo":"adf1fd3d0906180655q5c142889r3375169b6cf1f8b0@mail.gmail.com","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-06-18T14:17:06Z","receivedAt":"2009-06-18T14:17:06Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Thu, 18 June 2009, Santi Béjar wrote:\n> 2009/6/18 Jakub Narebski <jnareb@gmail.com>:\n\n[cut]\n> >\n> >  $ git remote tracking <remote> <remote branch>\n> >\n> > would show all local branches that track <remote branch>, and have\n> > <remote> as default remote,\n> \n> Maybe my description is unclear, but it's not about local branches\n> which track <branch> on <remote>, it is about the local branch\n> representation of the remote branch, i.e. not 'master' but\n> origin/master (git remote tracking origin master in a default clone).\n\nAh, the problem with the same (or similar) name for two different \nthings.  If we have local branch 'local' set to track branch 'master'\non remote 'origin', we have:\n\n   /------- local repository ------\\            /- origin -\\\n  /                                 \\          /            \\\n  |                                 |          |            |\n  'local'  -------->  'origin/master' -----------> 'master' \n  refs/heads/local    refs/remotes/origin/master   refs/heads/master                \n\n  branch.local.remote = origin\n  branch.local.merge  = refs/heads/master\n\n  remote.origin.fetch = +refs/heads/*:refs/remotes/origin/*\n\n'origin/master' is called remote-TRACKING branch (for 'master' branch\non remote 'origin').  Setting up automerge information for local branch\n'local' which _follows_ branch 'master' on remote 'origin' is done \nusing --TRACK option to git-branch.\n\nTherefore the confusion.\n\n\nDo I understand correctly that you want for\n\n  $ git remote tracking origin master\n\nto return\n\n  origin/master\n\n(and perhaps also origin/HEAD?).\n-- \nJakub Narebski\nPoland\n"},{"id":"116576","messageId":"adf1fd3d0906180740t637da9braea02deb3cba2680@mail.gmail.com","threadId":"19849","inReplyTo":"200906181617.07802.jnareb@gmail.com","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T14:40:50Z","receivedAt":"2009-06-18T14:40:50Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/6/18 Jakub Narebski <jnareb@gmail.com>:\n> On Thu, 18 June 2009, Santi Béjar wrote:\n>> 2009/6/18 Jakub Narebski <jnareb@gmail.com>:\n>\n> [cut]\n>> >\n>> >  $ git remote tracking <remote> <remote branch>\n>> >\n>> > would show all local branches that track <remote branch>, and have\n>> > <remote> as default remote,\n>>\n>> Maybe my description is unclear, but it's not about local branches\n>> which track <branch> on <remote>, it is about the local branch\n>> representation of the remote branch, i.e. not 'master' but\n>> origin/master (git remote tracking origin master in a default clone).\n>\n> Ah, the problem with the same (or similar) name for two different\n> things.  If we have local branch 'local' set to track branch 'master'\n> on remote 'origin', we have:\n>\n>   /------- local repository ------\\            /- origin -\\\n>  /                                 \\          /            \\\n>  |                                 |          |            |\n>  'local'  -------->  'origin/master' -----------> 'master'\n>  refs/heads/local    refs/remotes/origin/master   refs/heads/master\n>\n>  branch.local.remote = origin\n>  branch.local.merge  = refs/heads/master\n>\n>  remote.origin.fetch = +refs/heads/*:refs/remotes/origin/*\n>\n> 'origin/master' is called remote-TRACKING branch (for 'master' branch\n> on remote 'origin').  Setting up automerge information for local branch\n> 'local' which _follows_ branch 'master' on remote 'origin' is done\n> using --TRACK option to git-branch.\n>\n> Therefore the confusion.\n\nOK, but I wonder if the documentation for the new command is clear\nenough or can be improved.\n\n>\n>\n> Do I understand correctly that you want for\n>\n>  $ git remote tracking origin master\n>\n> to return\n>\n>  origin/master\n\nIn this particular case (the above settings) not exactly, as master\ndoes not match exactly the lhs of the refspec. It would be:\n\n$ git remote tracking origin refs/heads/master\nrefs/remotes/origin/master\n\n>\n> (and perhaps also origin/HEAD?).\n\nHEAD is another beast, as the local HEAD symlink is a local config,\nthat defaults to the remote default branch, but that you can change\nwith \"git remote set-head\".\n\nOps, you are saying to return origin/HEAD for \"git remote tracking\norigin master\", no? I don't think it makes sense, I think of \"git\nremote tracking\" more as a mapping function, it applies the map (the\nrefspec) to the given argument.\n\nSanti\n"},{"id":"116596","messageId":"adf1fd3d0906181201r5f3b2f55t8427e7be5ba07e9a@mail.gmail.com","threadId":"19849","inReplyTo":"adf1fd3d0906180740t637da9braea02deb3cba2680@mail.gmail.com","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T19:01:55Z","receivedAt":"2009-06-18T19:01:55Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"One thing it just occurred to me is to return the explicit refspec\ninstead of the tracking branch. So with the default config (after a\nclone):\n\n$ git remote tracking origin refs/heads/master\nrefs/heads/master:refs/remotes/origin/master\n\nthis makes a difference in case we want to allow returning all the\nmatching tracking branch and not the first one with more than one\nbranch, as:\n\n$ git config remote.origin.fetch --add +refs/heads/*:refs/remote/another/*\n\n$ git remote tracking origin refs/heads/master\nrefs/heads/master:refs/remotes/origin/master\nrefs/heads/next:refs/remotes/origin/next\n\n$ git remote tracking origin refs/heads/master refs/heads/next\nrefs/heads/master:refs/remotes/origin/master\nrefs/heads/master:refs/remotes/another/master\nrefs/heads/next:refs/remotes/origin/next\nrefs/heads/next:refs/remotes/another/next\n\nThoughts?\n"},{"id":"116597","messageId":"7v63etnydr.fsf@alter.siamese.dyndns.org","threadId":"19849","inReplyTo":"adf1fd3d0906181201r5f3b2f55t8427e7be5ba07e9a@mail.gmail.com","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-06-18T19:19:12Z","receivedAt":"2009-06-18T19:19:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Santi Béjar <santi@agolina.net> writes:\n\n> One thing it just occurred to me is to return the explicit refspec\n> instead of the tracking branch. So with the default config (after a\n> clone):\n>\n> $ git remote tracking origin refs/heads/master\n> refs/heads/master:refs/remotes/origin/master\n\nI think the output is sensible, instead of saying something like\n'origin/master'.\n\nWe can and should allow the end users to use abbreviated form as input to\nus (either command line or configuration value) when it is unambiguous,\nbut when returning values for use by Porcelains, we should be strict and\nprecise to avoid ambiguities.\n\n> this makes a difference in case we want to allow returning all the\n> matching tracking branch and not the first one with more than one\n> branch, as:\n>\n> $ git config remote.origin.fetch --add +refs/heads/*:refs/remote/another/*\n>\n> $ git remote tracking origin refs/heads/master\n> refs/heads/master:refs/remotes/origin/master\n> refs/heads/next:refs/remotes/origin/next\n\nI am not sure what this example is doing.  You asked about refs/heads/master\nbut you also talk about refs/heads/next?   I guess you meant to say\n\n    $ git remote tracking origin refs/heads/master\n    refs/heads/master:refs/remotes/origin/master\n    refs/heads/master:refs/remotes/another/master\n\ninstead, judging from the next example?\n\n> $ git remote tracking origin refs/heads/master refs/heads/next\n> refs/heads/master:refs/remotes/origin/master\n> refs/heads/master:refs/remotes/another/master\n> refs/heads/next:refs/remotes/origin/next\n> refs/heads/next:refs/remotes/another/next\n"},{"id":"116599","messageId":"adf1fd3d0906181431o9b50191n29f349a14f9d1be1@mail.gmail.com","threadId":"19849","inReplyTo":"7v63etnydr.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-18T21:31:51Z","receivedAt":"2009-06-18T21:31:51Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/6/18 Junio C Hamano <gitster@pobox.com>:\n> Santi Béjar <santi@agolina.net> writes:\n>\n>> One thing it just occurred to me is to return the explicit refspec\n>> instead of the tracking branch. So with the default config (after a\n>> clone):\n>>\n>> $ git remote tracking origin refs/heads/master\n>> refs/heads/master:refs/remotes/origin/master\n>\n> I think the output is sensible, instead of saying something like\n> 'origin/master'.\n\nOK.\n\n>\n> We can and should allow the end users to use abbreviated form as input to\n> us (either command line or configuration value) when it is unambiguous,\n\nOK. Moreover I think it also applies to the %(upstream) case I\nreported some days ago.\n\n> but when returning values for use by Porcelains, we should be strict and\n> precise to avoid ambiguities.\n>\n>> this makes a difference in case we want to allow returning all the\n>> matching tracking branch and not the first one with more than one\n>> branch, as:\n>>\n>> $ git config remote.origin.fetch --add +refs/heads/*:refs/remote/another/*\n>>\n>> $ git remote tracking origin refs/heads/master\n>> refs/heads/master:refs/remotes/origin/master\n>> refs/heads/next:refs/remotes/origin/next\n>\n> I am not sure what this example is doing.  You asked about refs/heads/master\n> but you also talk about refs/heads/next?   I guess you meant to say\n>\n>    $ git remote tracking origin refs/heads/master\n>    refs/heads/master:refs/remotes/origin/master\n>    refs/heads/master:refs/remotes/another/master\n>\n> instead, judging from the next example?\n\nYes.\n\nSanti\n"},{"id":"116625","messageId":"adf1fd3d0906190642j383411e8ydf03b524abcc1875@mail.gmail.com","threadId":"19849","inReplyTo":"adf1fd3d0906180224l668b4c84kc633ec13f8d0296@mail.gmail.com","subject":"Re: [RFC/PATCH 0/2] Support for arbitrary mapping for \"git pull --rebase\"","fromName":"Santi Béjar","fromEmail":"santi@agolina.net","sentAt":"2009-06-19T13:42:35Z","receivedAt":"2009-06-19T13:42:35Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2009/6/18 Santi Béjar <santi@agolina.net>:\n> 2009/6/18 Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n>> Hi,\n>>\n>> On Thu, 18 Jun 2009, Santi Béjar wrote:\n>>\n>>> Santi B??jar (2):\n>>\n>> Seems something is wrong in the --cover-letter utf-8 handlin, no?\n>\n> In this case (the cover letter) it is send-email that handles the\n> utf-8, but I don't know why it is not working, as there is a test in\n> t9001-send-email that tests it. I think it worked, I'll try to bisect\n> if I found a working version.\n\nIn fact I've been checking some of my cover letter and almost none of\nthem have the MIME headers. One that have the MIME headers is:\n\nSubject: [PATCHv4 0/4] Show author and/or committer in some cases\nDate: Sun,  4 May 2008 18:04:48 +0200\nMessage-Id: <1209917092-12146-1-git-send-email-sbejar@gmail.com>\nX-Mailer: git-send-email 1.5.5.1.224.gadb29\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\nBut I don't know/remeber what I did differently and I cannot reproduce\nit even using the same git-send-email version.\n\nSo I don't know what else to look, and in fact I don't know who is\nresponsible (if any) for these MIME headers in a cover-letter. But\nthey are added automatically if you use the --compose flag. So maybe\ngit-send-email could be enhanced so that it adds the MIME headers to\nthe cover-letter (0000-cover-letter.patch) as if run with --compose.\n\nSanti\n"}]}