{"thread":{"id":"39858","subject":"A few \"linked checkout\" niggles","startedAt":"2015-07-15T23:13:35Z","lastAt":"2015-07-17T17:07:14Z","messageCount":11,"participants":["Junio C Hamano","Duy Nguyen","Eric Sunshine","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"266167","messageId":"xmqqoajdui8w.fsf@gitster.dls.corp.google.com","threadId":"39858","inReplyTo":null,"subject":"A few \"linked checkout\" niggles","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-15T23:13:35Z","receivedAt":"2015-07-15T23:13:35Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I've tried to set up a non-bare clone of git.git at ~/w/src and\nattached one of its branches to a separate work tree at ~/w/rerere\n\n ~/w/src$ git worktree add ../rerere jc/rerere\n\nThen I tried the \"multiple checkout not allowed\".\n\n ~/w/src$ git checkout jc/rerere\n fatal: 'jc/rerere' is already checked out at '/home/gitster/w/rerere/.git'\n\nYou see the first \"niggle\" above.  Do we need \"/.git\" at the end?\nThat is hopefully merely cosmetic and I am guessing that we can\nunconditionally drop \"/.git\" from the end, but maybe there are\nsubtle reasons why it may not be a good idea (e.g. introduces some\nambiguities?)\n\nThere is another, a more serious one.\n\n ~/w/src$ git fetch ../git.git jc/rerere:jc/rerere\n\nThis succeeds, without checking if there is a work tree that has it\nchecked out.  I think the safety in \"git fetch\" that can be disabled\nby \"--update-head-ok\" option should be updated to reuse the same\nprotection used by the updated \"git checkout\".\n\nSomething to work on for 2.5.x maintenance track, aiming for 2.5.1.\n\nThanks.\n"},{"id":"266171","messageId":"CACsJy8CLYz7HqScS5Bxo47kTbrNj=qsaZnkKQ9ob4UVbjGG62Q@mail.gmail.com","threadId":"39858","inReplyTo":"xmqqoajdui8w.fsf@gitster.dls.corp.google.com","subject":"Re: A few \"linked checkout\" niggles","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2015-07-16T05:24:21Z","receivedAt":"2015-07-16T05:24:21Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Jul 16, 2015 at 6:13 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> I've tried to set up a non-bare clone of git.git at ~/w/src and\n> attached one of its branches to a separate work tree at ~/w/rerere\n>\n>  ~/w/src$ git worktree add ../rerere jc/rerere\n>\n> Then I tried the \"multiple checkout not allowed\".\n>\n>  ~/w/src$ git checkout jc/rerere\n>  fatal: 'jc/rerere' is already checked out at '/home/gitster/w/rerere/.git'\n>\n> You see the first \"niggle\" above.  Do we need \"/.git\" at the end?\n> That is hopefully merely cosmetic and I am guessing that we can\n> unconditionally drop \"/.git\" from the end, but maybe there are\n> subtle reasons why it may not be a good idea (e.g. introduces some\n> ambiguities?)\n>\n> There is another, a more serious one.\n>\n>  ~/w/src$ git fetch ../git.git jc/rerere:jc/rerere\n>\n> This succeeds, without checking if there is a work tree that has it\n> checked out.  I think the safety in \"git fetch\" that can be disabled\n> by \"--update-head-ok\" option should be updated to reuse the same\n> protection used by the updated \"git checkout\".\n>\n> Something to work on for 2.5.x maintenance track, aiming for 2.5.1.\n\nTo keep things clear, Eric if you want these they are yours :-) I'll\nfocus on the submodule support after i'm done with all my bug fix\npatches.\n-- \nDuy\n"},{"id":"266172","messageId":"CAPig+cQ9V0rmZZrhB=dCu01kiCGpyNVmx7PeXQqBQ=zvk_DF3g@mail.gmail.com","threadId":"39858","inReplyTo":"CACsJy8CLYz7HqScS5Bxo47kTbrNj=qsaZnkKQ9ob4UVbjGG62Q@mail.gmail.com","subject":"Re: A few \"linked checkout\" niggles","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-07-16T05:40:18Z","receivedAt":"2015-07-16T05:40:18Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Jul 16, 2015 at 1:24 AM, Duy Nguyen <pclouds@gmail.com> wrote:\n> On Thu, Jul 16, 2015 at 6:13 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> I've tried to set up a non-bare clone of git.git at ~/w/src and\n>> attached one of its branches to a separate work tree at ~/w/rerere\n>>\n>>  ~/w/src$ git worktree add ../rerere jc/rerere\n>>\n>> Then I tried the \"multiple checkout not allowed\".\n>>\n>>  ~/w/src$ git checkout jc/rerere\n>>  fatal: 'jc/rerere' is already checked out at '/home/gitster/w/rerere/.git'\n>>\n>> You see the first \"niggle\" above.  Do we need \"/.git\" at the end?\n>> That is hopefully merely cosmetic and I am guessing that we can\n>> unconditionally drop \"/.git\" from the end, but maybe there are\n>> subtle reasons why it may not be a good idea (e.g. introduces some\n>> ambiguities?)\n\nI can't think of any ambiguities which might arise from stripping the\n.git suffix. Even when playing with GIT_COMMON_DIR and GIT_WORK_TREE,\nI don't notice any ambiguities.\n\nSince I'm already touching this code and am wrapping up v2 of [1], I\ncan easily plop in a fix for this cosmetic issue.\n\n>> There is another, a more serious one.\n>>\n>>  ~/w/src$ git fetch ../git.git jc/rerere:jc/rerere\n>>\n>> This succeeds, without checking if there is a work tree that has it\n>> checked out.  I think the safety in \"git fetch\" that can be disabled\n>> by \"--update-head-ok\" option should be updated to reuse the same\n>> protection used by the updated \"git checkout\".\n>>\n>> Something to work on for 2.5.x maintenance track, aiming for 2.5.1.\n>\n> To keep things clear, Eric if you want these they are yours :-) I'll\n> focus on the submodule support after i'm done with all my bug fix\n> patches.\n\nI want to focus on getting v2 of [1] out and finalized. After that, I\nmight be able to take a look at the git-fetch issue (but I won't\ncomplain if you get to it first).\n\n[1]: http://thread.gmane.org/gmane.comp.version-control.git/273856\n"},{"id":"266208","messageId":"xmqqd1zr4z28.fsf@gitster.dls.corp.google.com","threadId":"39858","inReplyTo":"xmqqoajdui8w.fsf@gitster.dls.corp.google.com","subject":"Re: A few \"linked checkout\" niggles","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-16T20:39:27Z","receivedAt":"2015-07-16T20:39:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Also in a linked checkout of git.git itself, t5601.21 seems to fail\nwith:\n\nfatal: Not a git repository: /home/gitster/w/src/.git/worktrees/rerere\nnot ok 21 - clone respects global branch.autosetuprebase\n#\n#               (\n#                       test_config=\"$HOME/.gitconfig\" &&\n#                       git config -f \"$test_config\" branch.autosetuprebase remote &&\n#                       rm -fr dst &&\n#                       git clone src dst &&\n#                       cd dst &&\n#                       actual=\"z$(git config branch.master.rebase)\" &&\n#                       test ztrue = $actual\n#               )\n#\n\nThis test is running in /home/gitster/w/rerere, whose .git points at\nthat directory the fatail: message complains about.\n"},{"id":"266215","messageId":"CACsJy8CC_fju1Vy-hN69rKdpZ=XDUdZ_H_pmUb0bJdt-LdiPew@mail.gmail.com","threadId":"39858","inReplyTo":"xmqqd1zr4z28.fsf@gitster.dls.corp.google.com","subject":"Re: A few \"linked checkout\" niggles","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2015-07-16T23:13:48Z","receivedAt":"2015-07-16T23:13:48Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Jul 17, 2015 at 3:39 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Also in a linked checkout of git.git itself, t5601.21 seems to fail\n> with:\n>\n> fatal: Not a git repository: /home/gitster/w/src/.git/worktrees/rerere\n> not ok 21 - clone respects global branch.autosetuprebase\n> #\n> #               (\n> #                       test_config=\"$HOME/.gitconfig\" &&\n> #                       git config -f \"$test_config\" branch.autosetuprebase remote &&\n> #                       rm -fr dst &&\n> #                       git clone src dst &&\n> #                       cd dst &&\n> #                       actual=\"z$(git config branch.master.rebase)\" &&\n> #                       test ztrue = $actual\n> #               )\n> #\n>\n> This test is running in /home/gitster/w/rerere, whose .git points at\n> that directory the fatail: message complains about.\n\nI can't reproduce with either master, next or pu. Seems strange that\ngit.git info is leaking into this test..\n-- \nDuy\n"},{"id":"266222","messageId":"CAPig+cSB67wMs0T4OE9YS=2067bTvHeidx32PDGtu4O4q=nT2Q@mail.gmail.com","threadId":"39858","inReplyTo":"CACsJy8CC_fju1Vy-hN69rKdpZ=XDUdZ_H_pmUb0bJdt-LdiPew@mail.gmail.com","subject":"Re: A few \"linked checkout\" niggles","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-07-17T03:11:15Z","receivedAt":"2015-07-17T03:11:15Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Jul 16, 2015 at 7:13 PM, Duy Nguyen <pclouds@gmail.com> wrote:\n> On Fri, Jul 17, 2015 at 3:39 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Also in a linked checkout of git.git itself, t5601.21 seems to fail\n>> with:\n>>\n>> fatal: Not a git repository: /home/gitster/w/src/.git/worktrees/rerere\n>> not ok 21 - clone respects global branch.autosetuprebase\n>> #\n>> #               (\n>> #                       test_config=\"$HOME/.gitconfig\" &&\n>> #                       git config -f \"$test_config\" branch.autosetuprebase remote &&\n>> #                       rm -fr dst &&\n>> #                       git clone src dst &&\n>> #                       cd dst &&\n>> #                       actual=\"z$(git config branch.master.rebase)\" &&\n>> #                       test ztrue = $actual\n>> #               )\n>> #\n>>\n>> This test is running in /home/gitster/w/rerere, whose .git points at\n>> that directory the fatail: message complains about.\n>\n> I can't reproduce with either master, next or pu. Seems strange that\n> git.git info is leaking into this test..\n\nI also am unable to reproduce the failure...\n"},{"id":"266232","messageId":"55A8F4B1.9060304@drmicha.warpmail.net","threadId":"39858","inReplyTo":"xmqqoajdui8w.fsf@gitster.dls.corp.google.com","subject":"Re: A few \"linked checkout\" niggles","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2015-07-17T12:27:29Z","receivedAt":"2015-07-17T12:27:29Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Two more observations:\n\n$ git worktree add /tmp/gitwt\nEnter /tmp/gitwt (identifier gitwt)\nSwitched to a new branch 'gitwt'\n\nNow I'm in /tmp/gitwt at branch gitwt. Right? No. I'm in the original wd\nat the original branch.\n\nSo either we cd to the new location or quelch these messages or add a\nmessage that we're actually back.\n\nThe other:\n\nlinked worktrees are prefect for short term tests on detached heads.\nEven the manual page advertises detach. But:\n\n$ git worktree add  --detach /tmp/gitwtt\nEnter /tmp/gitwtt (identifier gitwtt)\nfatal: '--detach' cannot be used with '-b/-B/--orphan'\n\nMaybe it's the auto-naming logic stepping on detached toes ;)\n\nMichael\n"},{"id":"266233","messageId":"CACsJy8BZEhMJPdw4K_kihA1kTPBVsAt=zW-cemzO7V+xfDih8Q@mail.gmail.com","threadId":"39858","inReplyTo":"55A8F4B1.9060304@drmicha.warpmail.net","subject":"Re: A few \"linked checkout\" niggles","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2015-07-17T12:49:57Z","receivedAt":"2015-07-17T12:49:57Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Jul 17, 2015 at 7:27 PM, Michael J Gruber\n<git@drmicha.warpmail.net> wrote:\n> Two more observations:\n>\n> $ git worktree add /tmp/gitwt\n> Enter /tmp/gitwt (identifier gitwt)\n> Switched to a new branch 'gitwt'\n>\n> Now I'm in /tmp/gitwt at branch gitwt. Right? No. I'm in the original wd\n> at the original branch.\n>\n> So either we cd to the new location or quelch these messages or add a\n> message that we're actually back.\n\ns/Enter/Preparing/ ?\n\n> The other:\n>\n> linked worktrees are prefect for short term tests on detached heads.\n> Even the manual page advertises detach. But:\n>\n> $ git worktree add  --detach /tmp/gitwtt\n> Enter /tmp/gitwtt (identifier gitwtt)\n> fatal: '--detach' cannot be used with '-b/-B/--orphan'\n>\n> Maybe it's the auto-naming logic stepping on detached toes ;)\n\nProblem with master (but not with pu) because \"-b gitwtt\" is\nautomatically added. I think this is 1eb07d8 (worktree: add:\nauto-vivify new branch when <branch> is omitted - 2015-07-06)\nforgetting about --detach. Actually it's still a problem with 'pu'\nbecause the branch 'gitwtt' is created unnecessarily.\n-- \nDuy\n"},{"id":"266240","messageId":"xmqqzj2u3j7m.fsf@gitster.dls.corp.google.com","threadId":"39858","inReplyTo":"CACsJy8BZEhMJPdw4K_kihA1kTPBVsAt=zW-cemzO7V+xfDih8Q@mail.gmail.com","subject":"Re: A few \"linked checkout\" niggles","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-17T15:19:25Z","receivedAt":"2015-07-17T15:19:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> On Fri, Jul 17, 2015 at 7:27 PM, Michael J Gruber\n> <git@drmicha.warpmail.net> wrote:\n>> Two more observations:\n>>\n>> $ git worktree add /tmp/gitwt\n>> Enter /tmp/gitwt (identifier gitwt)\n>> Switched to a new branch 'gitwt'\n>>\n>> Now I'm in /tmp/gitwt at branch gitwt. Right? No. I'm in the original wd\n>> at the original branch.\n>>\n>> So either we cd to the new location or quelch these messages or add a\n>> message that we're actually back.\n>\n> s/Enter/Preparing/ ?\n\nHmm, do we even need that message?  I assumed it was a leftover\ndebugging stuff ;-)\n"},{"id":"266248","messageId":"CAPig+cRSHwmmF9cCUbRrDCCW4kvg9PeOUxP5VQpSGfxzMxHWOQ@mail.gmail.com","threadId":"39858","inReplyTo":"CACsJy8BZEhMJPdw4K_kihA1kTPBVsAt=zW-cemzO7V+xfDih8Q@mail.gmail.com","subject":"Re: A few \"linked checkout\" niggles","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-07-17T17:02:57Z","receivedAt":"2015-07-17T17:02:57Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jul 17, 2015 at 8:49 AM, Duy Nguyen <pclouds@gmail.com> wrote:\n> On Fri, Jul 17, 2015 at 7:27 PM, Michael J Gruber\n> <git@drmicha.warpmail.net> wrote:\n>> Two more observations:\n>>\n>> $ git worktree add /tmp/gitwt\n>> Enter /tmp/gitwt (identifier gitwt)\n>> Switched to a new branch 'gitwt'\n>>\n>> Now I'm in /tmp/gitwt at branch gitwt. Right? No. I'm in the original wd\n>> at the original branch.\n>>\n>> So either we cd to the new location or quelch these messages or add a\n>> message that we're actually back.\n>\n> s/Enter/Preparing/ ?\n\nPresumably you're using 'master'. The \"Switched to a new branch\"\nmessage is an artifact of using git-checkout for the back-end\noperation, however, what is queued in 'pu' no long uses git-checkout\nat all, so that message is gone.\n\nI agree with Duy that s/Enter/Prepare/ would be a good idea. I don't\nthink we want to drop the message altogether as Junio suggested since\nother messages such as \"Checking out files:...\" and \"HEAD is now\nat....\" follow it, thus \"Prepare...\" provides context indicating that\nthose additional messages apply to the new worktree rather than the\ncurrent one.\n\n>> The other:\n>>\n>> linked worktrees are prefect for short term tests on detached heads.\n>> Even the manual page advertises detach. But:\n>>\n>> $ git worktree add  --detach /tmp/gitwtt\n>> Enter /tmp/gitwtt (identifier gitwtt)\n>> fatal: '--detach' cannot be used with '-b/-B/--orphan'\n>>\n>> Maybe it's the auto-naming logic stepping on detached toes ;)\n>\n> Problem with master (but not with pu) because \"-b gitwtt\" is\n> automatically added. I think this is 1eb07d8 (worktree: add:\n> auto-vivify new branch when <branch> is omitted - 2015-07-06)\n> forgetting about --detach. Actually it's still a problem with 'pu'\n> because the branch 'gitwtt' is created unnecessarily.\n\nYep. Again, that fatal error is an artifact from git-checkout being\nused as the back-end on 'master'. What is queued on 'pu' doesn't fail,\nhowever, as Duy notes, the auto-vivication incorrectly kicks in and\ncreates a new branch unnecessarily. That'll have to be fixed in v3.\n"},{"id":"266250","messageId":"CAPig+cSLs4-uKicVMBSKnEro_FYD722Hs1_U6qzTriM8Ciok2Q@mail.gmail.com","threadId":"39858","inReplyTo":"xmqqzj2u3j7m.fsf@gitster.dls.corp.google.com","subject":"Re: A few \"linked checkout\" niggles","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-07-17T17:07:14Z","receivedAt":"2015-07-17T17:07:14Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Jul 17, 2015 at 11:19 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Duy Nguyen <pclouds@gmail.com> writes:\n>\n>> On Fri, Jul 17, 2015 at 7:27 PM, Michael J Gruber\n>> <git@drmicha.warpmail.net> wrote:\n>>> Two more observations:\n>>>\n>>> $ git worktree add /tmp/gitwt\n>>> Enter /tmp/gitwt (identifier gitwt)\n>>> Switched to a new branch 'gitwt'\n>>>\n>>> Now I'm in /tmp/gitwt at branch gitwt. Right? No. I'm in the original wd\n>>> at the original branch.\n>>>\n>>> So either we cd to the new location or quelch these messages or add a\n>>> message that we're actually back.\n>>\n>> s/Enter/Preparing/ ?\n>\n> Hmm, do we even need that message?  I assumed it was a leftover\n> debugging stuff ;-)\n\nIt helps give context to messages which follow it, such as \"Checking\nout files:...\" and \"HEAD is now at...\", letting the user know that\nthose messages apply to the new worktree rather than the current one.\nIn this case, s/Enter/Preparing/ makes sense.\n\n(\"Switched to a new branch...\" is gone in 'pu'.)\n"}]}