{"thread":{"id":"38790","subject":"[PATCH v2] git prompt: Use toplevel to find untracked files.","startedAt":"2015-03-13T02:24:50Z","lastAt":"2015-03-15T21:18:50Z","messageCount":4,"participants":["Cody A Taylor","Junio C Hamano","SZEDER Gábor"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"257619","messageId":"20150313021910.11996.54041@catuvm","threadId":"38790","inReplyTo":null,"subject":"[PATCH v2] git prompt: Use toplevel to find untracked files.","fromName":"Cody A Taylor","fromEmail":"cody.taylor@maternityneighborhood.com","sentAt":"2015-03-13T02:24:50Z","receivedAt":"2015-03-13T02:24:50Z","isPatch":true,"sender":{"key":"cody.taylor@maternityneighborhood.com","avatar":null},"body":">From c861d5cb401110ce7d86b76c1eaa8e89e80f484e Mon Sep 17 00:00:00 2001\nFrom: Cody A Taylor <codemister99@yahoo.com>\nDate: Thu, 12 Mar 2015 20:36:44 -0400\nSubject: [PATCH] git prompt: Use toplevel to find untracked files.\n\nThe __git_ps1() prompt function would not show an untracked\nstate when the current working directory was not a parent of\nthe untracked file.\n\nSigned-off-by: Cody A Taylor <codemister99@yahoo.com>\n---\n contrib/completion/git-prompt.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\nindex 214e859f99e7..f18aedc73be9 100644\n--- a/contrib/completion/git-prompt.sh\n+++ b/contrib/completion/git-prompt.sh\n@@ -487,7 +487,7 @@ __git_ps1 ()\n \n \t\tif [ -n \"${GIT_PS1_SHOWUNTRACKEDFILES-}\" ] &&\n \t\t   [ \"$(git config --bool bash.showUntrackedFiles)\" != \"false\" ] &&\n-\t\t   git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null\n+\t\t   git ls-files --others --exclude-standard --error-unmatch -- ':/*' >/dev/null 2>/dev/null\n \t\tthen\n \t\t\tu=\"%${ZSH_VERSION+%}\"\n \t\tfi\n-- \n2.3.2\n"},{"id":"257632","messageId":"xmqqmw3hzakn.fsf@gitster.dls.corp.google.com","threadId":"38790","inReplyTo":"20150313021910.11996.54041@catuvm","subject":"Re: [PATCH v2] git prompt: Use toplevel to find untracked files.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-03-13T06:16:24Z","receivedAt":"2015-03-13T06:16:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Cody A Taylor <cody.taylor@maternityneighborhood.com> writes:\n\n> From c861d5cb401110ce7d86b76c1eaa8e89e80f484e Mon Sep 17 00:00:00 2001\n> From: Cody A Taylor <codemister99@yahoo.com>\n> Date: Thu, 12 Mar 2015 20:36:44 -0400\n> Subject: [PATCH] git prompt: Use toplevel to find untracked files.\n\nAll of the above four lines are unwanted in the e-mail body.\n\n * The first line is a separating line to make format-patch output\n   look like a mbox file, and does not even belong to this patch.\n\n * From: line, when you are not relaying somebody else's patch,\n   should not be necessary, as long as you set up your MUA correctly\n   so that the e-mail shows a correct From: in its header.\n\n * Date: is the same; unless you are relaying somebody else's patch,\n   in which case you might want to preserve the author timestamp,\n   the first time _we_ the recipients see your patch matters more,\n   which should be available from the e-mail header.\n\n * Subject: should be in the e-mail header.  Sometimes when sending\n   a patch to an ongoing discussion that has its own subject, it is\n   handy to be able to override the title with in-body Subject:, but\n   this patch submission is not such a case.  The subjects are the\n   same in the fourth line in the body (which should be dropped) and\n   in the header anyway in this message, so please edit it out.\n\nIn short\n\n (1) If you cannot convince your mailer to show your @yahoo.com\n     address on the e-mail header From: line, then having the\n     in-body From: line above (i.e. the second line) is OK as a\n     workaround.  We however would prefer if you didn't.\n\n (2) Edit the other three lines out.\n\n> The __git_ps1() prompt function would not show an untracked\n> state when the current working directory was not a parent of\n> the untracked file.\n\nGood find, and nicely explained.  I wonder if we can add a test\nor two to t9903-bash-prompt.sh?\n\nThe patch itself makes sense.  Thanks.\n\n> Signed-off-by: Cody A Taylor <codemister99@yahoo.com>\n> ---\n>  contrib/completion/git-prompt.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh\n> index 214e859f99e7..f18aedc73be9 100644\n> --- a/contrib/completion/git-prompt.sh\n> +++ b/contrib/completion/git-prompt.sh\n> @@ -487,7 +487,7 @@ __git_ps1 ()\n>  \n>  \t\tif [ -n \"${GIT_PS1_SHOWUNTRACKEDFILES-}\" ] &&\n>  \t\t   [ \"$(git config --bool bash.showUntrackedFiles)\" != \"false\" ] &&\n> -\t\t   git ls-files --others --exclude-standard --error-unmatch -- '*' >/dev/null 2>/dev/null\n> +\t\t   git ls-files --others --exclude-standard --error-unmatch -- ':/*' >/dev/null 2>/dev/null\n>  \t\tthen\n>  \t\t\tu=\"%${ZSH_VERSION+%}\"\n>  \t\tfi\n"},{"id":"257716","messageId":"1426420144-10584-1-git-send-email-szeder@ira.uka.de","threadId":"38790","inReplyTo":"xmqqmw3hzakn.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v2] git prompt: Use toplevel to find untracked files.","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2015-03-15T11:49:04Z","receivedAt":"2015-03-15T11:49:04Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Hi,\n\nQuoting Junio C Hamano <gitster@pobox.com>:\n\n> Cody A Taylor <cody.taylor@maternityneighborhood.com> writes:\n>> The __git_ps1() prompt function would not show an untracked\n>> state when the current working directory was not a parent of\n>> the untracked file.\n>\n> Good find, and nicely explained.\n\nSomehow I had a hard time making sense out of \"when the current working\ndirectory was not a parent of the untracked file\".  Perhaps \"when the\nuntracked files are outside of the current working directory\" would be\neasier to grok?\n\n> I wonder if we can add a test\n> or two to t9903-bash-prompt.sh?\n\nThis test fails without the patch in question and succeeds with it.\n\n-- 8< --\n\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex 51ecd3e..3d1a95f 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -397,6 +397,16 @@ test_expect_success 'prompt - untracked files status indicator - untracked files\n \ttest_cmp expected \"$actual\"\n '\n \n+test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '\n+\tprintf \" (master %%)\" >expected &&\n+\t(\n+\t\tcd ignored_dir &&\n+\t\tGIT_PS1_SHOWUNTRACKEDFILES=y &&\n+\t\t__git_ps1 >\"$actual\"\n+\t) &&\n+\ttest_cmp expected \"$actual\"\n+'\n+\n test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '\n \tprintf \" (master)\" >expected &&\n \ttest_config bash.showUntrackedFiles false &&\n"},{"id":"257751","messageId":"xmqqd24at0w5.fsf@gitster.dls.corp.google.com","threadId":"38790","inReplyTo":"1426420144-10584-1-git-send-email-szeder@ira.uka.de","subject":"Re: [PATCH v2] git prompt: Use toplevel to find untracked files.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-03-15T21:18:50Z","receivedAt":"2015-03-15T21:18:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"SZEDER Gábor <szeder@ira.uka.de> writes:\n\n> Hi,\n>\n> Quoting Junio C Hamano <gitster@pobox.com>:\n>\n>> Cody A Taylor <cody.taylor@maternityneighborhood.com> writes:\n>>> The __git_ps1() prompt function would not show an untracked\n>>> state when the current working directory was not a parent of\n>>> the untracked file.\n>>\n>> Good find, and nicely explained.\n>\n> Somehow I had a hard time making sense out of \"when the current working\n> directory was not a parent of the untracked file\".  Perhaps \"when the\n> untracked files are outside of the current working directory\" would be\n> easier to grok?\n\nSounds good; let me use that when squashing your test updates in.\n\nThanks, both.\n\n>\n>> I wonder if we can add a test\n>> or two to t9903-bash-prompt.sh?\n>\n> This test fails without the patch in question and succeeds with it.\n>\n> -- 8< --\n>\n> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n> index 51ecd3e..3d1a95f 100755\n> --- a/t/t9903-bash-prompt.sh\n> +++ b/t/t9903-bash-prompt.sh\n> @@ -397,6 +397,16 @@ test_expect_success 'prompt - untracked files status indicator - untracked files\n>  \ttest_cmp expected \"$actual\"\n>  '\n>  \n> +test_expect_success 'prompt - untracked files status indicator - untracked files outside cwd' '\n> +\tprintf \" (master %%)\" >expected &&\n> +\t(\n> +\t\tcd ignored_dir &&\n> +\t\tGIT_PS1_SHOWUNTRACKEDFILES=y &&\n> +\t\t__git_ps1 >\"$actual\"\n> +\t) &&\n> +\ttest_cmp expected \"$actual\"\n> +'\n> +\n>  test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '\n>  \tprintf \" (master)\" >expected &&\n>  \ttest_config bash.showUntrackedFiles false &&\n"}]}