{"thread":{"id":"57837","subject":"Incorrect branch information after fetching (local branch != remote branch)","startedAt":"2022-05-03T04:58:18Z","lastAt":"2022-05-03T06:49:32Z","messageCount":4,"participants":["Bagas Sanjaya","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"454762","messageId":"9b3a9023-cd73-2e9d-64f1-7cc7e53d9b54@gmail.com","threadId":"57837","inReplyTo":null,"subject":"Incorrect branch information after fetching (local branch != remote branch)","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2022-05-03T04:58:10Z","receivedAt":"2022-05-03T04:58:18Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"Hi,\n\nI have a copy of linux.git (Linux kernel) repository, with following\nbranch mapping:\n\n  * master -> torvalds/master (Linus' mainline tree)\n  * linux-5.*.y -> stable/linux-5.*.y (Stable tree)\n  * net-next -> net-next/master (net-next tree)\n\nWhen I fetch the mainline tree (torvalds/master), I get the expected\nbranch fetching info:\n\nFrom https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux\n   672c0c5173427e..9050ba3a61a4b5  master     -> torvalds/master\n\nWhen I fetch net-next, I get possibly incorrect branch name instead:\n\nFrom https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next\n   6e28f56c0d1d97..0530a683fc858a  master     -> net-next/master\n\nI expected that net-next (local branch name) is displayed instead of\nmaster in this case.\n\nThanks.\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"454763","messageId":"xmqq7d73rwnq.fsf@gitster.g","threadId":"57837","inReplyTo":"9b3a9023-cd73-2e9d-64f1-7cc7e53d9b54@gmail.com","subject":"Re: Incorrect branch information after fetching (local branch != remote branch)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-05-03T05:51:37Z","receivedAt":"2022-05-03T05:51:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bagas Sanjaya <bagasdotme@gmail.com> writes:\n\n> I have a copy of linux.git (Linux kernel) repository, with following\n> branch mapping:\n>\n>   * master -> torvalds/master (Linus' mainline tree)\n>   * linux-5.*.y -> stable/linux-5.*.y (Stable tree)\n>   * net-next -> net-next/master (net-next tree)\n>\n> When I fetch the mainline tree (torvalds/master), I get the expected\n> branch fetching info:\n>\n> From https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux\n>    672c0c5173427e..9050ba3a61a4b5  master     -> torvalds/master\n>\n> When I fetch net-next, I get possibly incorrect branch name instead:\n>\n> From https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next\n>    6e28f56c0d1d97..0530a683fc858a  master     -> net-next/master\n>\n> I expected that net-next (local branch name) is displayed instead of\n> master in this case.\n>\n> Thanks.\n\nI may be entirely missing what you are raising as a problem, but visiting\n\nhttps://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/\n\nshows that their primary branch is called 'master'.\n\nThe verbose report left by \"git fetch\" tells us what branch they\nhave is used to update what branch we have, so I think this is\npretty much expected.\n\nI am puzzled by your mention of 'net-next' (local).\n\nYou may have\n\n    [branch \"net-next\"]\n        remote = net-next\n\tmerge = master\n\nand that is where your expectation on the local may be coming from,\nbut it wouldn't be all that relevant to \"git fetch\". The update of\nthe local branch will happen long after \"git fetch\" is done.\n\nBesides, you may have more than one local branch that is forked from\nthe same remotes/net-next/master remote-tracking branch and at that\npoint \"git fetch\" wouldn't be able to tell which one of these\nmultiple local branches to show.\n"},{"id":"454764","messageId":"bcb069c7-f104-a494-1862-30709dc6f8a0@gmail.com","threadId":"57837","inReplyTo":"xmqq7d73rwnq.fsf@gitster.g","subject":"Re: Incorrect branch information after fetching (local branch != remote branch)","fromName":"Bagas Sanjaya","fromEmail":"bagasdotme@gmail.com","sentAt":"2022-05-03T06:42:06Z","receivedAt":"2022-05-03T06:42:21Z","isPatch":false,"sender":{"key":"bagasdotme@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40219486?v=4"},"body":"On 5/3/22 12:51, Junio C Hamano wrote:\n> The verbose report left by \"git fetch\" tells us what branch they\n> have is used to update what branch we have, so I think this is\n> pretty much expected.\n> \n> I am puzzled by your mention of 'net-next' (local).\n> \n> You may have\n> \n>     [branch \"net-next\"]\n>         remote = net-next\n> \tmerge = master\n> \n> and that is where your expectation on the local may be coming from,\n> but it wouldn't be all that relevant to \"git fetch\". The update of\n> the local branch will happen long after \"git fetch\" is done.\n> \n\nAh I see.\n\nSo the left-hand side of verbose report (local branch) is actually\nthe value of branch.\"net-next\".merge, right?\n\n-- \nAn old man doll... just what I always wanted! - Clara\n"},{"id":"454765","messageId":"xmqq35hrrtze.fsf@gitster.g","threadId":"57837","inReplyTo":"bcb069c7-f104-a494-1862-30709dc6f8a0@gmail.com","subject":"Re: Incorrect branch information after fetching (local branch != remote branch)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-05-03T06:49:25Z","receivedAt":"2022-05-03T06:49:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bagas Sanjaya <bagasdotme@gmail.com> writes:\n\n> On 5/3/22 12:51, Junio C Hamano wrote:\n>> The verbose report left by \"git fetch\" tells us what branch they\n>> have is used to update what branch we have, so I think this is\n>> pretty much expected.\n>> \n>> I am puzzled by your mention of 'net-next' (local).\n>> \n>> You may have\n>> \n>>     [branch \"net-next\"]\n>>         remote = net-next\n>> \tmerge = master\n>> \n>> and that is where your expectation on the local may be coming from,\n>> but it wouldn't be all that relevant to \"git fetch\". The update of\n>> the local branch will happen long after \"git fetch\" is done.\n>> \n>\n> Ah I see.\n>\n> So the left-hand side of verbose report (local branch) is actually\n> the value of branch.\"net-next\".merge, right?\n\nNot really.  It comes from\n\n\t[remote \"net-next\"]\n\t    remote = https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next\n\t    fetch = refs/heads/*:refs/remotes/net-next/*\n\nand the fact that the remote happens to have only one branch under\nits refs/heads/ hierarchy.  Fetch does not care all that much about\n\"branch.*.merge\" (which is what I said---the configuration is not\nall that relevant to \"git fetch\").\n\n"}]}