{"thread":{"id":"30466","subject":"git checkout creates strange '(null)'-branch","startedAt":"2012-05-08T11:24:15Z","lastAt":"2012-05-10T16:49:30Z","messageCount":12,"participants":["Erik Faye-Lund","Johannes Sixt","Andreas Schwab","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"191079","messageId":"CABPQNSZbgZsQBReSqOskNQ4oZokHSibVr=yHdn6oSFjtdRvVVA@mail.gmail.com","threadId":"30466","inReplyTo":null,"subject":"git checkout creates strange '(null)'-branch","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-05-08T11:24:15Z","receivedAt":"2012-05-08T11:24:15Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"I'm not very familiar with submodules, but I gave them a go today, and\nquite quickly bumped into something I consider a bit... odd behavior:\nWhen I add an empty submodule and commit to it, a strangely named\n\"(null)\"-branch gets created.\n\nHere's a test that illustrate the issue:\n\n---8<---\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 81827e6..ce47b0a 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -520,4 +520,16 @@ test_expect_success 'moving the superproject does\nnot break submodules' '\n \t)\n '\n\n+test_expect_failure 'committing to empty submodule does not create\n(null) branch' '\n+\ttest_create_repo empty-repo &&\n+\tgit submodule add ./empty-repo empty-submodule &&\n+\t(\n+\t\tcd empty-submodule &&\n+\t\techo \"foo\" > bar.txt &&\n+\t\tgit add bar.txt &&\n+\t\tgit commit -m. &&\n+\t\tgit show-ref | !grep \"(null)\"\n+\t)\n+'\n+\n test_done\n---8<---\n\nNow, it could very well be that the best move here would be \"don't do\nthat\". But in that case, I think we should error out instead of\ncreating a cryptic branch.\n\nSo, I decided to dig a bit and see if I could figure out where this\nstrange branch-name came from. So I inserted a few calls to\ntest_pause, and noticed that:\n1) empty-repo/.git/HEAD contains \"ref: refs/heads/master\"\n2) .git/modules/empty-submodule/HEAD contains \"ref: refs/heads/(null)\"\n\nDigging further, it turns out that this magical \"(null)\"-branch\ncreation can be reproduced without the use of \"git submodule\":\n$ git init empty\n$ cd empty\n$ cat .git/HEAD\nref: refs/heads/master\n$ git checkout\n$ cat .git/HEAD\nref: refs/heads/(null)\n\nThe offending code seems to be switch_unborn_to_new_branch, when\nopts->new_branch is NULL. This is relatively new code, introduced in\nJanuary this year by commit abe1998 (\"git checkout -b: allow switching\nout of an unborn branch\") .\n\nBefore this commit, the checkout would error out with \"fatal: You are\non a branch yet to be born\". Perhaps abe1998 was too optimistic about\nallowing this, and something like this would be in order?\n\n---8<---\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 23fc56d..35924d4 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -1091,7 +1091,7 @@ int cmd_checkout(int argc, const char **argv,\nconst char *prefix)\n \tif (opts.writeout_stage)\n \t\tdie(_(\"--ours/--theirs is incompatible with switching branches.\"));\n\n-\tif (!new.commit) {\n+\tif (!new.commit && opts.new_branch) {\n \t\tunsigned char rev[20];\n \t\tint flag;\n---8<---\n\nNow, doing this doesn't make my test above pass, but it makes the \"git\nsubmodule add\" call fail when the submodule is empty, which is much\nbetter than what we do now IMO.\n"},{"id":"191080","messageId":"4FA904C3.7070208@viscovery.net","threadId":"30466","inReplyTo":"CABPQNSZbgZsQBReSqOskNQ4oZokHSibVr=yHdn6oSFjtdRvVVA@mail.gmail.com","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2012-05-08T11:34:27Z","receivedAt":"2012-05-08T11:34:27Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 5/8/2012 13:24, schrieb Erik Faye-Lund:\n> +\t\tgit show-ref | !grep \"(null)\"\n...\n> Now, doing this doesn't make my test above pass,\n\nIt is unlikely to pass if you used this test script literally, because\n\n   $ !grep\n   !grep: command not found\n\n\"!\" is not an operator in a shell script. Insert a space.\n"},{"id":"191081","messageId":"CABPQNSZjdpz8zqYOwBQ_SPeh0JqyxQ1bjrghG1vzxt0GiLR22w@mail.gmail.com","threadId":"30466","inReplyTo":"4FA904C3.7070208@viscovery.net","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-05-08T11:50:35Z","receivedAt":"2012-05-08T11:50:35Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Tue, May 8, 2012 at 1:34 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Am 5/8/2012 13:24, schrieb Erik Faye-Lund:\n>> +             git show-ref | !grep \"(null)\"\n> ...\n>> Now, doing this doesn't make my test above pass,\n>\n> It is unlikely to pass if you used this test script literally, because\n>\n>   $ !grep\n>   !grep: command not found\n>\n> \"!\" is not an operator in a shell script. Insert a space.\n\nWhoops, you are of course right, my bad. Actually, inserting a space\ndoesn't quite do the trick, but doing\n\"! (git show-ref | grep \"(null)\")\" instead seems to work. I'm no\nshell-script wizard ;)\n\nThe test still fails, though :)\n\nI didn't actually fix up the code so the test failed, so I guess\nthat's why I didn't see a false negative. Instead, I fixed up the code\nso it failed earlier.\n\nBut if I apply the following patch, the test passes. I'm not saying\nit's the right thing to do, though.\n\n(Warning: white-space damaged because of copying diffs between terminals)\n\n---8<---\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 23fc56d..d70e819 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -1096,8 +1096,11 @@ int cmd_checkout(int argc, const char **argv,\nconst char *prefix)\n                int flag;\n\n                if (!read_ref_full(\"HEAD\", rev, 0, &flag) &&\n-                   (flag & REF_ISSYMREF) && is_null_sha1(rev))\n+                   (flag & REF_ISSYMREF) && is_null_sha1(rev)) {\n+                       if (!opts.new_branch)\n+                               return 0;\n                        return switch_unborn_to_new_branch(&opts);\n+               }\n        }\n        return switch_branches(&opts, &new);\n }\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 81827e6..5b1932c 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -520,4 +520,16 @@ test_expect_success 'moving the superproject does\nnot break submodules' '\n        )\n '\n\n+test_expect_failure 'committing to empty submodule does not create\n(null) branch' '\n+       test_create_repo empty-repo &&\n+       git submodule add ./empty-repo empty-submodule &&\n+       (\n+               cd empty-submodule &&\n+               echo \"foo\" > bar.txt &&\n+               git add bar.txt &&\n+               git commit -m. &&\n+               ! (git show-ref | grep \"(null)\")\n+       )\n+'\n+\n test_done\n---8<---\n"},{"id":"191082","messageId":"m2r4uuhnzm.fsf@igel.home","threadId":"30466","inReplyTo":"CABPQNSZjdpz8zqYOwBQ_SPeh0JqyxQ1bjrghG1vzxt0GiLR22w@mail.gmail.com","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2012-05-08T12:10:53Z","receivedAt":"2012-05-08T12:10:53Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Erik Faye-Lund <kusmabite@gmail.com> writes:\n\n> +test_expect_failure 'committing to empty submodule does not create\n> (null) branch' '\n> +       test_create_repo empty-repo &&\n> +       git submodule add ./empty-repo empty-submodule &&\n> +       (\n> +               cd empty-submodule &&\n> +               echo \"foo\" > bar.txt &&\n> +               git add bar.txt &&\n> +               git commit -m. &&\n> +               ! (git show-ref | grep \"(null)\")\n\nYou don't need the parens, since ! operates on the whole pipeline.  (And\nfor grouping the shell language uses { } instead of ( ).)\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"191099","messageId":"7vhavqzpa3.fsf@alter.siamese.dyndns.org","threadId":"30466","inReplyTo":"CABPQNSZbgZsQBReSqOskNQ4oZokHSibVr=yHdn6oSFjtdRvVVA@mail.gmail.com","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-08T15:05:40Z","receivedAt":"2012-05-08T15:05:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Faye-Lund <kusmabite@gmail.com> writes:\n\n> Before this commit, the checkout would error out with \"fatal: You are\n> on a branch yet to be born\". Perhaps abe1998 was too optimistic about\n> allowing this, and something like this would be in order?\n\n> ---8<---\n> diff --git a/builtin/checkout.c b/builtin/checkout.c\n> index 23fc56d..35924d4 100644\n> --- a/builtin/checkout.c\n> +++ b/builtin/checkout.c\n> @@ -1091,7 +1091,7 @@ int cmd_checkout(int argc, const char **argv,\n> const char *prefix)\n>  \tif (opts.writeout_stage)\n>  \t\tdie(_(\"--ours/--theirs is incompatible with switching branches.\"));\n>\n> -\tif (!new.commit) {\n> +\tif (!new.commit && opts.new_branch) {\n>  \t\tunsigned char rev[20];\n>  \t\tint flag;\n> ---8<---\n\nThe patch looks like it will avoid flipping the HEAD, and in that case we\nwould go to switch_branches() codepath and will resurrect the old error\nmessage, so it seems correct.\n\nThanks for digging.\n"},{"id":"191100","messageId":"7vaa1izp3h.fsf@alter.siamese.dyndns.org","threadId":"30466","inReplyTo":"4FA904C3.7070208@viscovery.net","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-08T15:09:38Z","receivedAt":"2012-05-08T15:09:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Am 5/8/2012 13:24, schrieb Erik Faye-Lund:\n>> +\t\tgit show-ref | !grep \"(null)\"\n> ...\n>> Now, doing this doesn't make my test above pass,\n>\n> It is unlikely to pass if you used this test script literally, because\n>\n>    $ !grep\n>    !grep: command not found\n>\n> \"!\" is not an operator in a shell script. Insert a space.\n\nGood eyes.  Also wouldn't it be a bit pointless to grep for (null) in the\nfirst place?  It comes only because a particular implementation of\nvsnprintf() happens to emit it when asked to turn a NULL pointer into a\nstring, and on other platforms it is allowed to segfault.\n"},{"id":"191101","messageId":"7v62c6zon4.fsf@alter.siamese.dyndns.org","threadId":"30466","inReplyTo":"CABPQNSZbgZsQBReSqOskNQ4oZokHSibVr=yHdn6oSFjtdRvVVA@mail.gmail.com","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-08T15:19:27Z","receivedAt":"2012-05-08T15:19:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Faye-Lund <kusmabite@gmail.com> writes:\n\n> +\ttest_create_repo empty-repo &&\n> +\tgit submodule add ./empty-repo empty-submodule\n\nYou have an empty-repo but that is not part of the superproject; the\nsuperproject will have empty-submodule submodule which is a clone of\nempty-repo.\n\n    $ git submodule add ./empty-repo empty-submodule\n    Cloning into 'empty-submodule'...\n    warning: You appear to have cloned an empty repository.\n    done.\n\nAnd after that, without you doing anything in empty-submodule, that\nrepository already exhibits the (null) problem.  Perhaps somebody, after\ncalling a successfull \"git clone\" of an empty repository (which is a silly\nthing to do to begin with, with or without submodules involved, but at\nleast we do have a defined semantics of what happens when you do that),\ntried to run \"git checkout\", even though there is nothing to be checked\nout?  The culprit in that case to suspect would be \"git submodule\" script.\nDoes it blindly assume that it can do a \"git checkout\" and runs that\ncommand?\n"},{"id":"191107","messageId":"CABPQNSYzxDoer_Xhf+8EEU4zz58PLRQiZAsg_CWzP3ps6f_4rw@mail.gmail.com","threadId":"30466","inReplyTo":"7v62c6zon4.fsf@alter.siamese.dyndns.org","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-05-08T16:04:58Z","receivedAt":"2012-05-08T16:04:58Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Tue, May 8, 2012 at 5:19 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Erik Faye-Lund <kusmabite@gmail.com> writes:\n>\n>> +     test_create_repo empty-repo &&\n>> +     git submodule add ./empty-repo empty-submodule\n>\n> You have an empty-repo but that is not part of the superproject; the\n> superproject will have empty-submodule submodule which is a clone of\n> empty-repo.\n>\n>    $ git submodule add ./empty-repo empty-submodule\n>    Cloning into 'empty-submodule'...\n>    warning: You appear to have cloned an empty repository.\n>    done.\n>\n> And after that, without you doing anything in empty-submodule, that\n> repository already exhibits the (null) problem.  Perhaps somebody, after\n> calling a successfull \"git clone\" of an empty repository (which is a silly\n> thing to do to begin with, with or without submodules involved, but at\n> least we do have a defined semantics of what happens when you do that),\n> tried to run \"git checkout\", even though there is nothing to be checked\n> out?  The culprit in that case to suspect would be \"git submodule\" script.\n> Does it blindly assume that it can do a \"git checkout\" and runs that\n> command?\n\nYes, it does. Basically, it calls \"git checkout -f -q\" from cmd_add if\n$branch is empty. And it fails if the checkout-call fails.\n\nI'm not saying it's a sane thing to do. But to me, it kind of feels\nnatural to initialize the shared (i.e bare) repos for both the\nsuperproject and the submodule, clone the superproject, add the\nsubmodule, and populate these from there. But that won't work the way\nthings currently are, because you can't \"git submodule add\" an empty\nproject.\n\nTo allow that, we would have to make sure \"git submodule add\" works\nwith empty repositories. And we can probably archive this in multiple\nways.\n\nBut for now, I'm happy with just erroring out on the \"git submodule\nadd\"-call. I didn't really expect adding an empty submodule to work, I\nwas just hoping it did ;)\n\nI'm sending a proper patch with a saner test soon.\n"},{"id":"191109","messageId":"7vhavqy75q.fsf@alter.siamese.dyndns.org","threadId":"30466","inReplyTo":"CABPQNSYzxDoer_Xhf+8EEU4zz58PLRQiZAsg_CWzP3ps6f_4rw@mail.gmail.com","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-08T16:22:25Z","receivedAt":"2012-05-08T16:22:25Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Faye-Lund <kusmabite@gmail.com> writes:\n\n> Yes, it does. Basically, it calls \"git checkout -f -q\" from cmd_add if\n> $branch is empty. And it fails if the checkout-call fails.\n>\n> I'm not saying it's a sane thing to do. But to me, it kind of feels\n> natural to initialize the shared (i.e bare) repos for both the\n> superproject and the submodule, clone the superproject, add the\n> submodule, and populate these from there.\n\nI sense a bit of slipperly slope here.  After doing this, the superproject\nwould have its .gitmodules file set up to point at something, but what\ndoes its first commit look like?  Other files and .gitmodules, but no\nempty-submodule?  Can you commit the superproject _with_ empty-submodule\nwithout having any commit in that empty-submodule?  I think \"git add\"\nshould fail when there is no commit there in the first place, so you won't\ncreate such a superproject commit that does not have anything in the\nsubmodule.  Is that OK for everybody?  Or would we add yet another funny\nspecial case for such a setting, perhaps by contaminating the index and\nthe tree in the superproject with a stand-in value to represent a \"does\nnot yet exist\" commit that ought to be at the tip of submodule's history?\n\n> But that won't work the way\n> things currently are, because you can't \"git submodule add\" an empty\n> project.\n>\n> To allow that,...\n\nYes, allowing that does not seem to make sense at all in the larger\npicture. What benefit would we get from that slipperly slope?\n"},{"id":"191110","messageId":"7vd36ey70y.fsf@alter.siamese.dyndns.org","threadId":"30466","inReplyTo":"CABPQNSZjdpz8zqYOwBQ_SPeh0JqyxQ1bjrghG1vzxt0GiLR22w@mail.gmail.com","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-08T16:25:17Z","receivedAt":"2012-05-08T16:25:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Faye-Lund <kusmabite@gmail.com> writes:\n\n> But if I apply the following patch, the test passes. I'm not saying\n> it's the right thing to do, though.\n>\n> (Warning: white-space damaged because of copying diffs between terminals)\n>\n> diff --git a/builtin/checkout.c b/builtin/checkout.c\n> index 23fc56d..d70e819 100644\n> --- a/builtin/checkout.c\n> +++ b/builtin/checkout.c\n> @@ -1096,8 +1096,11 @@ int cmd_checkout(int argc, const char **argv,\n> const char *prefix)\n>                 int flag;\n>\n>                 if (!read_ref_full(\"HEAD\", rev, 0, &flag) &&\n> -                   (flag & REF_ISSYMREF) && is_null_sha1(rev))\n> +                   (flag & REF_ISSYMREF) && is_null_sha1(rev)) {\n> +                       if (!opts.new_branch)\n> +                               return 0;\n>                         return switch_unborn_to_new_branch(&opts);\n> +               }\n>         }\n>         return switch_branches(&opts, &new);\n>  }\n\nThis patch, if we ignore submodules for a while, actually makes sense to\nme.  If you have a commit, you are on that commit and you haven't done\nanything since you have checked out that commit, \"git checkout\" (no other\nparameters) would be a no-op.  If you \"git init\" a repository, and you\nhaven't done anything since then, the above makes \"git checkout\" (no other\nparameters) a no-op.\n\nAm I missing some corner cases that we _should_ error out, perhaps for the\nsake of safety?\n"},{"id":"191293","messageId":"CABPQNSbBwpVJUx9BSSO2nqAnPxUESZBz-GEqOPPEyqvdcutb6w@mail.gmail.com","threadId":"30466","inReplyTo":"7vd36ey70y.fsf@alter.siamese.dyndns.org","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2012-05-10T14:22:47Z","receivedAt":"2012-05-10T14:22:47Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Tue, May 8, 2012 at 6:25 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Erik Faye-Lund <kusmabite@gmail.com> writes:\n>\n>> But if I apply the following patch, the test passes. I'm not saying\n>> it's the right thing to do, though.\n>>\n>> (Warning: white-space damaged because of copying diffs between terminals)\n>>\n>> diff --git a/builtin/checkout.c b/builtin/checkout.c\n>> index 23fc56d..d70e819 100644\n>> --- a/builtin/checkout.c\n>> +++ b/builtin/checkout.c\n>> @@ -1096,8 +1096,11 @@ int cmd_checkout(int argc, const char **argv,\n>> const char *prefix)\n>>                 int flag;\n>>\n>>                 if (!read_ref_full(\"HEAD\", rev, 0, &flag) &&\n>> -                   (flag & REF_ISSYMREF) && is_null_sha1(rev))\n>> +                   (flag & REF_ISSYMREF) && is_null_sha1(rev)) {\n>> +                       if (!opts.new_branch)\n>> +                               return 0;\n>>                         return switch_unborn_to_new_branch(&opts);\n>> +               }\n>>         }\n>>         return switch_branches(&opts, &new);\n>>  }\n>\n> This patch, if we ignore submodules for a while, actually makes sense to\n> me.  If you have a commit, you are on that commit and you haven't done\n> anything since you have checked out that commit, \"git checkout\" (no other\n> parameters) would be a no-op.  If you \"git init\" a repository, and you\n> haven't done anything since then, the above makes \"git checkout\" (no other\n> parameters) a no-op.\n\nI agree. It does seem to make sense.\n\n> Am I missing some corner cases that we _should_ error out, perhaps for the\n> sake of safety?\n\nI don't know, and I was kind of hoping someone would jump in and\nenlighten me of something, but that didn't happen (yet).\n\nI have a slight preference for this operation, though I'm not\nreligious; it simply seem more consistent with other \"git checkout\"\noperation.\n\nDo you want me to prepare a proper patch including a variation of the\ntest-case from the other patch?\n"},{"id":"191322","messageId":"7v4nronfqd.fsf@alter.siamese.dyndns.org","threadId":"30466","inReplyTo":"CABPQNSbBwpVJUx9BSSO2nqAnPxUESZBz-GEqOPPEyqvdcutb6w@mail.gmail.com","subject":"Re: git checkout creates strange '(null)'-branch","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-10T16:49:30Z","receivedAt":"2012-05-10T16:49:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Faye-Lund <kusmabite@gmail.com> writes:\n\n> On Tue, May 8, 2012 at 6:25 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> ...\n>> Am I missing some corner cases that we _should_ error out, perhaps for the\n>> sake of safety?\n>\n> I don't know, and I was kind of hoping someone would jump in and\n> enlighten me of something, but that didn't happen (yet).\n>\n> I have a slight preference for this operation, though I'm not\n> religious; it simply seem more consistent with other \"git checkout\"\n> operation.\n>\n> Do you want me to prepare a proper patch including a variation of the\n> test-case from the other patch?\n\nI think an official looking patch would draw more attention from others\nand may uncover cases we did not anticipate if this turns out to be a bad\nidea.\n"}]}