{"thread":{"id":"31150","subject":"Return code in cmd (git describe)","startedAt":"2012-07-31T12:02:50Z","lastAt":"2012-07-31T12:54:40Z","messageCount":3,"participants":["Manuela Hutter","Konstantin Khomoutov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"196228","messageId":"op.wia7q0jqt21y7h@id-c1003.oslo.osa","threadId":"31150","inReplyTo":null,"subject":"Return code in cmd (git describe)","fromName":"Manuela Hutter","fromEmail":"manuelah@opera.com","sentAt":"2012-07-31T12:02:50Z","receivedAt":"2012-07-31T12:02:50Z","isPatch":false,"sender":{"key":"manuelah@opera.com","avatar":null},"body":"Hi,\n\nwe have some python scripts that are run from Visual Studio, and one of  \nthem fails because of a wrong git return code when calling 'git describe  \n--dirty'\n\nHere's the issue:\n\n=============\nimport subprocess\n\nGIT_EXE = \"<path to git exe>\"\nGIT_SRC = \"<path to git repo>\"\n\n\n# call 'git describe --dirty':\nrun_git = subprocess.Popen([GIT_EXE, \"describe\", \"--dirty\"],\n                            cwd=GIT_SRC,\n                            stdout=subprocess.PIPE,\n                            stderr=subprocess.PIPE)\n(output, output_err) = run_git.communicate()\nprint \"Returncode: %s\" % run_git.returncode\nprint \"Output:     %s\" % output.strip()\n=============\n\nRun from wingw, the return code is 0.\nRun from cmd, the return code is 1.\n\nWhy?\n\nThanks,\nManuela\n"},{"id":"196229","messageId":"20120731162715.f1f01a825a7a0f74a2e3b412@domain007.com","threadId":"31150","inReplyTo":"op.wia7q0jqt21y7h@id-c1003.oslo.osa","subject":"Re: Return code in cmd (git describe)","fromName":"Konstantin Khomoutov","fromEmail":"flatworm@users.sourceforge.net","sentAt":"2012-07-31T12:27:15Z","receivedAt":"2012-07-31T12:27:15Z","isPatch":false,"sender":{"key":"flatworm@users.sourceforge.net","avatar":null},"body":"On Tue, 31 Jul 2012 14:02:50 +0200\n\"Manuela Hutter\" <manuelah@opera.com> wrote:\n\n> we have some python scripts that are run from Visual Studio, and one\n> of them fails because of a wrong git return code when calling\n> 'git describe --dirty'\n[...]\n> Run from wingw, the return code is 0.\n> Run from cmd, the return code is 1.\n> \n> Why?\nSupposedly, when you run Git from cmd.exe, the git.cmd top-level script\n(which wraps the git.exe binary) gets executed, and it's currently\naffected by this bug [1] (fixed).  When you run Git from Git bash, the\ngit.exe binary runs directly and hence the bug is not exposed.\n\n1. https://github.com/msysgit/msysgit/issues/43\n"},{"id":"196231","messageId":"op.wia95es4t21y7h@id-c1003.oslo.osa","threadId":"31150","inReplyTo":"20120731162715.f1f01a825a7a0f74a2e3b412@domain007.com","subject":"Re: Return code in cmd (git describe)","fromName":"Manuela Hutter","fromEmail":"manuelah@opera.com","sentAt":"2012-07-31T12:54:40Z","receivedAt":"2012-07-31T12:54:40Z","isPatch":false,"sender":{"key":"manuelah@opera.com","avatar":null},"body":"On Tue, 31 Jul 2012 14:27:15 +0200, Konstantin Khomoutov  \n<flatworm@users.sourceforge.net> wrote:\n\n> On Tue, 31 Jul 2012 14:02:50 +0200\n> \"Manuela Hutter\" <manuelah@opera.com> wrote:\n>\n>> we have some python scripts that are run from Visual Studio, and one\n>> of them fails because of a wrong git return code when calling\n>> 'git describe --dirty'\n> [...]\n>> Run from wingw, the return code is 0.\n>> Run from cmd, the return code is 1.\n>>\n>> Why?\n> Supposedly, when you run Git from cmd.exe, the git.cmd top-level script\n> (which wraps the git.exe binary) gets executed, and it's currently\n> affected by this bug [1] (fixed).  When you run Git from Git bash, the\n> git.exe binary runs directly and hence the bug is not exposed.\n>\n> 1. https://github.com/msysgit/msysgit/issues/43\n\nGreat, thanks for the info!\n/Manuela\n"}]}