{"thread":{"id":"47659","subject":"cygwin git and golang: how @{u} is handled","startedAt":"2018-01-21T18:31:52Z","lastAt":"2018-01-22T01:44:57Z","messageCount":4,"participants":["John Cheng","Ævar Arnfjörð Bjarmason","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"337032","messageId":"CAJzZBAQuOqwRmBLOdUEVMY74_xT2dWe3a+9qT9ufc4bp8gjgig@mail.gmail.com","threadId":"47659","inReplyTo":null,"subject":"cygwin git and golang: how @{u} is handled","fromName":"John Cheng","fromEmail":"johnlicheng@gmail.com","sentAt":"2018-01-21T18:31:20Z","receivedAt":"2018-01-21T18:31:52Z","isPatch":false,"sender":{"key":"johnlicheng@gmail.com","avatar":null},"body":"I am experiencing a strange behavior and I'm not certain if it is a\nproblem with golang or the cygwin version of git.\n\nSteps to reproduce:\nUse golang's os/exec library to execute\nexec.Command(os.Args[1],\"log\",\"@{u}\") // where os.Args[1] is either\ncygwin git or Windows git\n\nExpected result:\ncommit 09357db3a29909c3498143b0d06989e00f5e2442\nAuthor: John Cheng <johnlicheng@gmail.com>\nDate:   Sun Jan 14 10:57:01 2018 -0800\n...\n\nActual result:\nSuppose that cygwin git is specified, the result becomes:\nexit status 128 fatal: ambiguous argument '@u': unknown revision or\npath not in the working tree.\n\nVersion:\ngit version 2.15.1.windows.2\ngit version 2.15.1\n\nI'm not certain if this is a git problem, as I could not reproduce\nthis problem using python to script cygwin git.\n\nA list of scenarios I've tested are\n1. golang + cygwin git = \"exit code 128\"\n2. golang + windows git = \"exit code 0\"\n3. python + cygwin git = \"exit code 0\"\n4. python + windows git = \"exit code 0\"\n\nI've tried to write a simple program to echo the command line\nparameters passed by go into the process it executes - and it appears\nthat go itself does not change \"@{u}\" into \"@u\". I'm a bit stuck at\npoint to figure out which may be the cause: golang or git. I figured\nI'd start here.\n\n\n\n\n\n-- \n---\nJohn L Cheng\n"},{"id":"337034","messageId":"87372zhwiw.fsf@evledraar.gmail.com","threadId":"47659","inReplyTo":"CAJzZBAQuOqwRmBLOdUEVMY74_xT2dWe3a+9qT9ufc4bp8gjgig@mail.gmail.com","subject":"Re: cygwin git and golang: how @{u} is handled","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-01-21T18:55:19Z","receivedAt":"2018-01-21T18:55:27Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sun, Jan 21 2018, John Cheng jotted:\n\n> Actual result:\n> Suppose that cygwin git is specified, the result becomes:\n> exit status 128 fatal: ambiguous argument '@u': unknown revision or\n> path not in the working tree.\n\nGiven that:\n\n    $ git log @{x}\n    fatal: ambiguous argument '@{x}': unknown revision or path not in the working tree.\n\nSpews the output back at you as @{x} not @x the problem must be in\nwhatever is passing the argument to git, whether that's go or some other\nwrapper.\n\nTry putting a \"git\" first in your $PATH which is nothing but:\n\n    #!/bin/sh\n    echo \"args: $@\"\n    exit 1\n\nAnd seeing what you get.\n"},{"id":"337044","messageId":"0A3A0675F3984789908D19A7A39235D5@PhilipOakley","threadId":"47659","inReplyTo":"CAJzZBAQuOqwRmBLOdUEVMY74_xT2dWe3a+9qT9ufc4bp8gjgig@mail.gmail.com","subject":"Re: cygwin git and golang: how @{u} is handled","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2018-01-21T23:43:28Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"John Cheng\" <johnlicheng@gmail.com>\n>I am experiencing a strange behavior and I'm not certain if it is a\n> problem with golang or the cygwin version of git.\n>\n> Steps to reproduce:\n> Use golang's os/exec library to execute\n> exec.Command(os.Args[1],\"log\",\"@{u}\") // where os.Args[1] is either\n> cygwin git or Windows git\n>\n> Expected result:\n> commit 09357db3a29909c3498143b0d06989e00f5e2442\n> Author: John Cheng <johnlicheng@gmail.com>\n> Date:   Sun Jan 14 10:57:01 2018 -0800\n> ...\n>\n> Actual result:\n> Suppose that cygwin git is specified, the result becomes:\n> exit status 128 fatal: ambiguous argument '@u': unknown revision or\n> path not in the working tree.\n>\n> Version:\n> git version 2.15.1.windows.2\n> git version 2.15.1\n>\n> I'm not certain if this is a git problem, as I could not reproduce\n> this problem using python to script cygwin git.\n>\n> A list of scenarios I've tested are\n> 1. golang + cygwin git = \"exit code 128\"\n> 2. golang + windows git = \"exit code 0\"\n> 3. python + cygwin git = \"exit code 0\"\n> 4. python + windows git = \"exit code 0\"\n>\n> I've tried to write a simple program to echo the command line\n> parameters passed by go into the process it executes - and it appears\n> that go itself does not change \"@{u}\" into \"@u\". I'm a bit stuck at\n> point to figure out which may be the cause: golang or git. I figured\n> I'd start here.\n>\nThere is a similar problem a user is experiencing on Git-for-Windows, that \nwe/the user haven't got to the bottom of, but it appears to have a similar \nform where the braces appear to be is some form parsed twice (though thats \nstill a guess / hypothesis).\n\n\"Aliases in git are stripping curly-brackets (#1220)\" \nhttps://github.com/git-for-windows/git/issues/1220#issuecomment-340341336\n\n\n\nPhilip\n\n"},{"id":"337046","messageId":"CAJzZBARW3Cm_uF24NZOXdoT3dC0t=Uh3GCxa34_B6uK=tJ+dsQ@mail.gmail.com","threadId":"47659","inReplyTo":"0A3A0675F3984789908D19A7A39235D5@PhilipOakley","subject":"Re: cygwin git and golang: how @{u} is handled","fromName":"John Cheng","fromEmail":"johnlicheng@gmail.com","sentAt":"2018-01-22T01:44:28Z","receivedAt":"2018-01-22T01:44:57Z","isPatch":false,"sender":{"key":"johnlicheng@gmail.com","avatar":null},"body":"Hi Phillip,\n\nThanks for pointing me to the github issue. I've added my comments to\nit. For my particular issue, it was resolved by setting\n\"CYGWIN=noglob\" as an environment variable. Hopefully it resolves\nRobert's problem as well.\n\n\n\nOn Sun, Jan 21, 2018 at 3:43 PM, Philip Oakley <philipoakley@iee.org> wrote:\n> From: \"John Cheng\" <johnlicheng@gmail.com>\n>\n>> I am experiencing a strange behavior and I'm not certain if it is a\n>> problem with golang or the cygwin version of git.\n>>\n>> Steps to reproduce:\n>> Use golang's os/exec library to execute\n>> exec.Command(os.Args[1],\"log\",\"@{u}\") // where os.Args[1] is either\n>> cygwin git or Windows git\n>>\n>> Expected result:\n>> commit 09357db3a29909c3498143b0d06989e00f5e2442\n>> Author: John Cheng <johnlicheng@gmail.com>\n>> Date:   Sun Jan 14 10:57:01 2018 -0800\n>> ...\n>>\n>> Actual result:\n>> Suppose that cygwin git is specified, the result becomes:\n>> exit status 128 fatal: ambiguous argument '@u': unknown revision or\n>> path not in the working tree.\n>>\n>> Version:\n>> git version 2.15.1.windows.2\n>> git version 2.15.1\n>>\n>> I'm not certain if this is a git problem, as I could not reproduce\n>> this problem using python to script cygwin git.\n>>\n>> A list of scenarios I've tested are\n>> 1. golang + cygwin git = \"exit code 128\"\n>> 2. golang + windows git = \"exit code 0\"\n>> 3. python + cygwin git = \"exit code 0\"\n>> 4. python + windows git = \"exit code 0\"\n>>\n>> I've tried to write a simple program to echo the command line\n>> parameters passed by go into the process it executes - and it appears\n>> that go itself does not change \"@{u}\" into \"@u\". I'm a bit stuck at\n>> point to figure out which may be the cause: golang or git. I figured\n>> I'd start here.\n>>\n> There is a similar problem a user is experiencing on Git-for-Windows, that\n> we/the user haven't got to the bottom of, but it appears to have a similar\n> form where the braces appear to be is some form parsed twice (though thats\n> still a guess / hypothesis).\n>\n> \"Aliases in git are stripping curly-brackets (#1220)\"\n> https://github.com/git-for-windows/git/issues/1220#issuecomment-340341336\n>\n>\n>\n> Philip\n>\n\n\n\n-- \n---\nJohn L Cheng\n"}]}