{"thread":{"id":"17706","subject":"[PATCH] Make 'remote show' distinguish between merged and rebased remote branches","startedAt":"2009-02-10T17:08:58Z","lastAt":"2009-02-11T21:35:23Z","messageCount":9,"participants":["Marc Branchaud","Junio C Hamano","Johannes Schindelin","Jay Soffian","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"104069","messageId":"20090210202046.8EBEC3360AC@rincewind","threadId":"17706","inReplyTo":null,"subject":"[PATCH] Make 'remote show' distinguish between merged and rebased remote branches","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-02-10T17:08:58Z","receivedAt":"2009-02-10T17:08:58Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Prints \"rebased\" instead of \"merged\" if branch.<name>.rebase is true.\n\nSigned-off-by: Marc Branchaud <marcnarc@xiplink.com>\n---\n\nI'd like to be able to tell if my \"git pull\" is going to merge or rebase...\n\n builtin-remote.c  |   13 ++++++++++---\n t/t5505-remote.sh |    5 +++++\n 2 files changed, 15 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin-remote.c b/builtin-remote.c\nindex abc8dd8..ac3a88e 100644\n--- a/builtin-remote.c\n+++ b/builtin-remote.c\n@@ -145,6 +145,7 @@ static int add(int argc, const char **argv)\n struct branch_info {\n \tchar *remote;\n \tstruct string_list merge;\n+\tint rebase;\n };\n \n static struct string_list branch_list;\n@@ -164,7 +165,7 @@ static int config_read_branches(const char *key, const char *value, void *cb)\n \t\tchar *name;\n \t\tstruct string_list_item *item;\n \t\tstruct branch_info *info;\n-\t\tenum { REMOTE, MERGE } type;\n+\t\tenum { REMOTE, MERGE, REBASE } type;\n \n \t\tkey += 7;\n \t\tif (!postfixcmp(key, \".remote\")) {\n@@ -173,6 +174,9 @@ static int config_read_branches(const char *key, const char *value, void *cb)\n \t\t} else if (!postfixcmp(key, \".merge\")) {\n \t\t\tname = xstrndup(key, strlen(key) - 6);\n \t\t\ttype = MERGE;\n+\t\t} else if (!postfixcmp(key, \".rebase\")) {\n+\t\t\tname = xstrndup(key, strlen(key) - 7);\n+\t\t\ttype = REBASE;\n \t\t} else\n \t\t\treturn 0;\n \n@@ -185,7 +189,7 @@ static int config_read_branches(const char *key, const char *value, void *cb)\n \t\t\tif (info->remote)\n \t\t\t\twarning(\"more than one branch.%s\", key);\n \t\t\tinfo->remote = xstrdup(value);\n-\t\t} else {\n+\t\t} else if (type == MERGE) {\n \t\t\tchar *space = strchr(value, ' ');\n \t\t\tvalue = abbrev_branch(value);\n \t\t\twhile (space) {\n@@ -196,6 +200,8 @@ static int config_read_branches(const char *key, const char *value, void *cb)\n \t\t\t\tspace = strchr(value, ' ');\n \t\t\t}\n \t\t\tstring_list_append(xstrdup(value), &info->merge);\n+\t\t} else {\n+\t\t\tinfo->rebase = 1;\n \t\t}\n \t}\n \treturn 0;\n@@ -678,9 +684,10 @@ static int show(int argc, const char **argv)\n \n \t\t\tif (!info->merge.nr || strcmp(*argv, info->remote))\n \t\t\t\tcontinue;\n-\t\t\tprintf(\"  Remote branch%s merged with 'git pull' \"\n+\t\t\tprintf(\"  Remote branch%s %s with 'git pull' \"\n \t\t\t\t\"while on branch %s\\n   \",\n \t\t\t\tinfo->merge.nr > 1 ? \"es\" : \"\",\n+\t\t\t\tinfo->rebase ? \"rebased\" : \"merged\",\n \t\t\t\tbranch->string);\n \t\t\tfor (j = 0; j < info->merge.nr; j++)\n \t\t\t\tprintf(\" %s\", info->merge.items[j].string);\ndiff --git a/t/t5505-remote.sh b/t/t5505-remote.sh\nindex 1f59960..be0316a 100755\n--- a/t/t5505-remote.sh\n+++ b/t/t5505-remote.sh\n@@ -112,6 +112,8 @@ cat > test/expect << EOF\n   URL: $(pwd)/one\n   Remote branch merged with 'git pull' while on branch master\n     master\n+  Remote branch rebased with 'git pull' while on branch rebaser\n+    side\n   New remote branch (next fetch will store in remotes/origin)\n     master\n   Tracked remote branches\n@@ -136,7 +138,10 @@ test_expect_success 'show' '\n \t\trefs/heads/master:refs/heads/upstream &&\n \t git config --add remote.origin.push \\\n \t\t+refs/tags/lastbackup &&\n+\t git branch --track rebaser origin/side &&\n+\t git config --add branch.rebaser.rebase true &&\n \t git remote show origin > output &&\n+\t git branch -D rebaser &&\n \t test_cmp expect output)\n '\n \n-- \n1.6.1.2.390.gba743\n"},{"id":"104078","messageId":"7v3aemm1po.fsf@gitster.siamese.dyndns.org","threadId":"17706","inReplyTo":"20090210202046.8EBEC3360AC@rincewind","subject":"Re: [PATCH] Make 'remote show' distinguish between merged and rebased remote branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-10T21:17:07Z","receivedAt":"2009-02-10T21:17:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marc Branchaud <marcnarc@xiplink.com> writes:\n\n> Prints \"rebased\" instead of \"merged\" if branch.<name>.rebase is true.\n>\n> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>\n> ...\n> diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh\n> index 1f59960..be0316a 100755\n> --- a/t/t5505-remote.sh\n> +++ b/t/t5505-remote.sh\n> @@ -112,6 +112,8 @@ cat > test/expect << EOF\n>    URL: $(pwd)/one\n>    Remote branch merged with 'git pull' while on branch master\n>      master\n> +  Remote branch rebased with 'git pull' while on branch rebaser\n> +    side\n>    New remote branch (next fetch will store in remotes/origin)\n>      master\n>    Tracked remote branches\n\nI sympathize with what you are trying to do but I do not think this is\ncorrect.  You will *never* rebase remote on top of your changes; rather\nyou will replay your changes on top of what the updated remote has.\n\nIt is more like \"if you start git pull while on branch rebaser, it will\nrebased on top of this branch from the remote\".\n"},{"id":"104082","messageId":"alpine.DEB.1.00.0902102220550.10279@pacific.mpi-cbg.de","threadId":"17706","inReplyTo":"20090210202046.8EBEC3360AC@rincewind","subject":"Re: [PATCH] Make 'remote show' distinguish between merged and rebased remote branches","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-02-10T21:22:36Z","receivedAt":"2009-02-10T21:22:36Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 10 Feb 2009, Marc Branchaud wrote:\n\n> diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh\n> index 1f59960..be0316a 100755\n> --- a/t/t5505-remote.sh\n> +++ b/t/t5505-remote.sh\n> @@ -112,6 +112,8 @@ cat > test/expect << EOF\n>    URL: $(pwd)/one\n>    Remote branch merged with 'git pull' while on branch master\n>      master\n> +  Remote branch rebased with 'git pull' while on branch rebaser\n> +    side\n\nI'm not a native speaker... but \"rebased with\" sounds wrong, but so does \n\"Remote branch rebased onto with 'git pull' while on branch rebaser\"...\n\nOtherwise, the patch looks good to me.\n\nThanks,\nDscho\n"},{"id":"104089","messageId":"4991FA18.1040200@xiplink.com","threadId":"17706","inReplyTo":"7v3aemm1po.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] Make 'remote show' distinguish between merged and rebased remote branches","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-02-10T22:05:12Z","receivedAt":"2009-02-10T22:05:12Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Junio C Hamano wrote:\n> \n> I sympathize with what you are trying to do but I do not think this is\n> correct.  You will *never* rebase remote on top of your changes; rather\n> you will replay your changes on top of what the updated remote has.\n> \n> It is more like \"if you start git pull while on branch rebaser, it will\n> rebased on top of this branch from the remote\".\n> \n\nI'm happy to use more accurate phrasing -- I was just going for a minimal change.\n\nHow about the following, consistent for both cases:\n\n'git pull' merges branch master with remote branch\n  master\n'git pull' rebases branch rebaser on top of remote branch\n  side\n\n?\n\nI like the above because the keywords & branch names are in consistent locations, making it easier to parse the output.\n\n\t\tMarc\n"},{"id":"104107","messageId":"76718490902101513i504e515ocb4a2d789ba520f0@mail.gmail.com","threadId":"17706","inReplyTo":"4991FA18.1040200@xiplink.com","subject":"Re: [PATCH] Make 'remote show' distinguish between merged and rebased remote branches","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2009-02-10T23:13:52Z","receivedAt":"2009-02-10T23:13:52Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Tue, Feb 10, 2009 at 5:05 PM, Marc Branchaud <marcnarc@xiplink.com> wrote:\n> I'm happy to use more accurate phrasing -- I was just going for a minimal change.\n>\n> How about the following, consistent for both cases:\n>\n> 'git pull' merges branch master with remote branch\n>  master\n> 'git pull' rebases branch rebaser on top of remote branch\n>  side\n>\n> ?\n>\n> I like the above because the keywords & branch names are in consistent locations, making it easier to parse the output.\n\nThe output of git remote show seems much too verbose for the\ninformation it provides. Something like this, I think, provides the\nsame information in much less space:\n\n* remote origin\n  URL: git://git.kernel.org/pub/scm/git/git.git\n  Remote branches:\n    html      Not tracked\n    maint     Tracked\n    man       Tracked\n    master    Tracked\n    next      Tracked\n    pu        Tracked\n    todo      Not tracked\n    old-next  Stale (would prune)\n  Local branches configured to pull from this remote:\n    master           upstream is master (merges)\n    wip/remote-HEAD  upstream is next   (rebases)\n\nWhen run with \"-n\" the status column would be blank or say \"Status not\navailable with -n\".\n\n$0.02. :-)\n\nj.\n"},{"id":"104213","messageId":"499303E8.6030000@xiplink.com","threadId":"17706","inReplyTo":"76718490902101513i504e515ocb4a2d789ba520f0@mail.gmail.com","subject":"Re: [PATCH] Make 'remote show' distinguish between merged and rebased remote branches","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-02-11T16:59:20Z","receivedAt":"2009-02-11T16:59:20Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Jay Soffian wrote:\n> \n> The output of git remote show seems much too verbose for the\n> information it provides.\n\nI agree.\n\nI'm happy to hammer out and implement new output for 'remote show', but is there any chance that such a change would be accepted?\n\nJunio, Dscho, (others) -- any opposition to this?\n\n> Something like this, I think, provides the\n> same information in much less space:\n> \n> * remote origin\n>   URL: git://git.kernel.org/pub/scm/git/git.git\n>   Remote branches:\n>     html      Not tracked\n>     maint     Tracked\n>     man       Tracked\n>     master    Tracked\n>     next      Tracked\n>     pu        Tracked\n>     todo      Not tracked\n>     old-next  Stale (would prune)\n>   Local branches configured to pull from this remote:\n>     master           upstream is master (merges)\n>     wip/remote-HEAD  upstream is next   (rebases)\n\nHow about something a bit tighter, merging the local branch list with the remote branch list:\n\n* remote origin\n  URL: git://git.kernel.org/pub/scm/git/git.git\n  Remote branches:\n    html      Not tracked\n    master    Tracked by local branches:\n                master (merges)\n                mywork (rebases)\n    next      Tracked by local branch:\n                wip/remote-HEAD (rebases)\n    pu        Tracked by local branch:\n                pu (merges)\n    todo      Not tracked\n    old-next  Stale (would prune)\n\n?\n\n\t\tM.\n"},{"id":"104216","messageId":"499306F7.8050404@viscovery.net","threadId":"17706","inReplyTo":"499303E8.6030000@xiplink.com","subject":"Re: [PATCH] Make 'remote show' distinguish between merged and rebased remote branches","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-02-11T17:12:23Z","receivedAt":"2009-02-11T17:12:23Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Marc Branchaud schrieb:\n> Jay Soffian wrote:\n>> * remote origin\n>>   URL: git://git.kernel.org/pub/scm/git/git.git\n>>   Remote branches:\n>>     html      Not tracked\n>>     maint     Tracked\n>>     man       Tracked\n>>     master    Tracked\n>>     next      Tracked\n>>     pu        Tracked\n>>     todo      Not tracked\n>>     old-next  Stale (would prune)\n>>   Local branches configured to pull from this remote:\n>>     master           upstream is master (merges)\n>>     wip/remote-HEAD  upstream is next   (rebases)\n\nI find this form more useful than the one below because of the clear\nseparation into remote an local branchs.\n\n> How about something a bit tighter, merging the local branch list with the remote branch list:\n> \n> * remote origin\n>   URL: git://git.kernel.org/pub/scm/git/git.git\n>   Remote branches:\n>     html      Not tracked\n>     master    Tracked by local branches:\n>                 master (merges)\n>                 mywork (rebases)\n>     next      Tracked by local branch:\n>                 wip/remote-HEAD (rebases)\n>     pu        Tracked by local branch:\n>                 pu (merges)\n>     todo      Not tracked\n>     old-next  Stale (would prune)\n\n-- Hannes\n"},{"id":"104221","messageId":"7vab8sg9m6.fsf@gitster.siamese.dyndns.org","threadId":"17706","inReplyTo":"499306F7.8050404@viscovery.net","subject":"Re: [PATCH] Make 'remote show' distinguish between merged and rebased remote branches","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-11T17:35:13Z","receivedAt":"2009-02-11T17:35:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Marc Branchaud schrieb:\n>> Jay Soffian wrote:\n>>> * remote origin\n>>>   URL: git://git.kernel.org/pub/scm/git/git.git\n>>>   Remote branches:\n>>>     html      Not tracked\n>>>     maint     Tracked\n>>>     man       Tracked\n>>>     master    Tracked\n>>>     next      Tracked\n>>>     pu        Tracked\n>>>     todo      Not tracked\n>>>     old-next  Stale (would prune)\n>>>   Local branches configured to pull from this remote:\n>>>     master           upstream is master (merges)\n>>>     wip/remote-HEAD  upstream is next   (rebases)\n>\n> I find this form more useful than the one below because of the clear\n> separation into remote an local branchs.\n\nGood point.\n"},{"id":"104303","messageId":"4993449B.2040401@xiplink.com","threadId":"17706","inReplyTo":"76718490902101513i504e515ocb4a2d789ba520f0@mail.gmail.com","subject":"Re: [PATCH] Make 'remote show' distinguish between merged and rebased remote branches","fromName":"Marc Branchaud","fromEmail":"marcnarc@xiplink.com","sentAt":"2009-02-11T21:35:23Z","receivedAt":"2009-02-11T21:35:23Z","isPatch":true,"sender":{"key":"marcnarc@xiplink.com","avatar":"https://avatars.githubusercontent.com/u/14980203?v=4"},"body":"Jay Soffian wrote:\n> \n> The output of git remote show seems much too verbose for the\n> information it provides. Something like this, I think, provides the\n> same information in much less space:\n> \n> * remote origin\n>   URL: git://git.kernel.org/pub/scm/git/git.git\n>   Remote branches:\n>     html      Not tracked\n>     maint     Tracked\n>     man       Tracked\n>     master    Tracked\n>     next      Tracked\n>     pu        Tracked\n>     todo      Not tracked\n>     old-next  Stale (would prune)\n>   Local branches configured to pull from this remote:\n>     master           upstream is master (merges)\n>     wip/remote-HEAD  upstream is next   (rebases)\n\nThe current test case for 'remote show' (without my rebase patch) is:\n\n* remote origin\n  URL: $(pwd)/one\n  Remote branch merged with 'git pull' while on branch master\n    master\n  New remote branch (next fetch will store in remotes/origin)\n    master\n  Tracked remote branches\n    side\n    master\n  Local branches pushed with 'git push'\n    master:upstream\n    +refs/tags/lastbackup\n\nShould that last bit about 'git push' change as well (I admit I don't really understand what that part is saying)?  Or should we just be consistent?  Maybe something like:\n\n* remote origin\n  URL: $(pwd)/one\n  Remote branches:\n    master  Tracked\n    side    Not tracked\n    flip    Tracked\n  New remote branch (next fetch will store in remotes/origin)\n    master\n  Local branches tracking this remote:\n    master   upstream is master (merges)\n    rebaser  upstream is flip   (rebases)\n  Local branches pushed with 'git push'\n    master:upstream\n    +refs/tags/lastbackup\n\n\t\tM.\n"}]}