{"thread":{"id":"38689","subject":"[PATCH] git: make \"git -C '' <cmd>\" not to barf","startedAt":"2015-03-03T15:41:31Z","lastAt":"2015-03-04T08:41:16Z","messageCount":4,"participants":["Karthik Nayak","Matthieu Moy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"256906","messageId":"1425397291-25435-1-git-send-email-karthik.188@gmail.com","threadId":"38689","inReplyTo":null,"subject":"[PATCH] git: make \"git -C '' <cmd>\" not to barf","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-03-03T15:41:31Z","receivedAt":"2015-03-03T15:41:31Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"now it works like cd \"\" which silently succeeds\n\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n git.c | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/git.c b/git.c\nindex 8c7ee9c..f4c2285 100644\n--- a/git.c\n+++ b/git.c\n@@ -204,7 +204,9 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\t\tfprintf(stderr, \"No directory given for -C.\\n\" );\n \t\t\t\tusage(git_usage_string);\n \t\t\t}\n-\t\t\tif (chdir((*argv)[1]))\n+\t\t\tif (*(*argv)[1] == 0)\n+\t\t\t\t; /* Ignore \"\" as a directory */\n+\t\t\telse if (chdir((*argv)[1]))\n \t\t\t\tdie_errno(\"Cannot change to '%s'\", (*argv)[1]);\n \t\t\tif (envchanged)\n \t\t\t\t*envchanged = 1;\n-- \n2.3.1.167.g7f4ba4b.dirty\n"},{"id":"256912","messageId":"vpq385mgifi.fsf@anie.imag.fr","threadId":"38689","inReplyTo":"1425397291-25435-1-git-send-email-karthik.188@gmail.com","subject":"Re: [PATCH] git: make \"git -C '' <cmd>\" not to barf","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-03-03T16:22:09Z","receivedAt":"2015-03-03T16:22:09Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Karthik Nayak <karthik.188@gmail.com> writes:\n\n> now it works like cd \"\" which silently succeeds\n\nMissing \".\" at end of sentence.\n\n>  git.c | 4 +++-\n\nThat would probably also deserve a test.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"256915","messageId":"CAPc5daWFAV2P_MCCo=oz2Be=2_L5NVxNweY+rUbU5OcK84wVaQ@mail.gmail.com","threadId":"38689","inReplyTo":"vpq385mgifi.fsf@anie.imag.fr","subject":"Re: [PATCH] git: make \"git -C '' <cmd>\" not to barf","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-03-03T18:00:13Z","receivedAt":"2015-03-03T18:00:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"On Tue, Mar 3, 2015 at 8:22 AM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> Karthik Nayak <karthik.188@gmail.com> writes:\n>\n>> now it works like cd \"\" which silently succeeds\n>\n> Missing \".\" at end of sentence.\n\nAnd lack of capitalization at the beginning.\n\nMore importantly, lack of justification--why is it a good idea to make\n\"it works like cd ''\" in the first place?\n\n>\n>>  git.c | 4 +++-\n>\n> That would probably also deserve a test.\n\nAnother \"huh?\" I had on the actual code was if this counts as \"envchanged\", if\nyou are not actually changing the directory at all.\n\nIs this meant as a \"micro\" for GSoC, by the way?\n"},{"id":"256976","messageId":"E3F15B02-CDDA-473C-86D0-2A337FBDF185@gmail.com","threadId":"38689","inReplyTo":"CAPc5daWFAV2P_MCCo=oz2Be=2_L5NVxNweY+rUbU5OcK84wVaQ@mail.gmail.com","subject":"Re: [PATCH] git: make \"git -C '' <cmd>\" not to barf","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-03-04T08:41:16Z","receivedAt":"2015-03-04T08:41:16Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"\n\nOn March 3, 2015 11:30:13 PM GMT+05:30, Junio C Hamano <gitster@pobox.com> wrote:\n>On Tue, Mar 3, 2015 at 8:22 AM, Matthieu Moy\n><Matthieu.Moy@grenoble-inp.fr> wrote:\n>> Karthik Nayak <karthik.188@gmail.com> writes:\n>>\n>>> now it works like cd \"\" which silently succeeds\n>>\n>> Missing \".\" at end of sentence.\n>\n>And lack of capitalization at the beginning.\nYes, noted, Will fix with next patch.\n>\n>More importantly, lack of justification--why is it a good idea to make\n>\"it works like cd ''\" in the first place?\n>\n>>\n>>>  git.c | 4 +++-\n>>\n>> That would probably also deserve a test.\nWill include a patch with next patch version.\n>\n>Another \"huh?\" I had on the actual code was if this counts as\n>\"envchanged\", if\n>you are not actually changing the directory at all.\n>\n>Is this meant as a \"micro\" for GSoC, by the way?\nYes, it's meant for GSoC.\nI did overlook that. Will fix in next patch version. \nThanks for your suggestions\n"}]}