{"thread":{"id":"19558","subject":"[PATCH] bash: display git prompt in case of merge conflict during rebase","startedAt":"2009-05-28T16:17:21Z","lastAt":"2009-05-29T15:03:19Z","messageCount":4,"participants":["SZEDER Gábor","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"114930","messageId":"1243527441-3394-1-git-send-email-szeder@ira.uka.de","threadId":"19558","inReplyTo":null,"subject":"[PATCH] bash: display git prompt in case of merge conflict during rebase","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2009-05-28T16:17:21Z","receivedAt":"2009-05-28T16:17:21Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"Since e5dd864a (completion: Better __git_ps1 support when not in\nworking directory, 2009-02-11) the git prompt becomes empty, if we hit\na merge conflict during a rebase.\n\ne5dd864a added an if statement at the end of __git_ps1 to only display\nanything in the prompt, if the branch name is not empty.  This caused\nthe empty prompt in the \"merge conflict during rebase\" case, because\nin this case we display neither the branch name nor the abbreviated\nSHA1, the ongoing rebase is identified.\n\nThis patch removes that check, so the git prompt is displayed even if\nthe branch name is empty.\n\nSigned-off-by: SZEDER Gábor <szeder@ira.uka.de>\n---\n contrib/completion/git-completion.bash |   10 ++++------\n 1 files changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 0c8bb53..6c78c94 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -152,12 +152,10 @@ __git_ps1 ()\n \t\t\tfi\n \t\tfi\n \n-\t\tif [ -n \"$b\" ]; then\n-\t\t\tif [ -n \"${1-}\" ]; then\n-\t\t\t\tprintf \"$1\" \"$c${b##refs/heads/}$w$i$r\"\n-\t\t\telse\n-\t\t\t\tprintf \" (%s)\" \"$c${b##refs/heads/}$w$i$r\"\n-\t\t\tfi\n+\t\tif [ -n \"${1-}\" ]; then\n+\t\t\tprintf \"$1\" \"$c${b##refs/heads/}$w$i$r\"\n+\t\telse\n+\t\t\tprintf \" (%s)\" \"$c${b##refs/heads/}$w$i$r\"\n \t\tfi\n \tfi\n }\n-- \n1.6.3.1.189.g9321\n"},{"id":"114932","messageId":"20090528170147.GN6570@neumann","threadId":"19558","inReplyTo":"1243527441-3394-1-git-send-email-szeder@ira.uka.de","subject":"Re: [PATCH] bash: display git prompt in case of merge conflict during rebase","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2009-05-28T17:01:47Z","receivedAt":"2009-05-28T17:01:47Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Thu, May 28, 2009 at 06:17:21PM +0200, SZEDER Gábor wrote:\n> Since e5dd864a (completion: Better __git_ps1 support when not in\n> working directory, 2009-02-11) the git prompt becomes empty, if we hit\n> a merge conflict during a rebase.\n> \n> e5dd864a added an if statement at the end of __git_ps1 to only display\n> anything in the prompt, if the branch name is not empty.  This caused\n> the empty prompt in the \"merge conflict during rebase\" case, because\n> in this case we display neither the branch name nor the abbreviated\n> SHA1, the ongoing rebase is identified.\n       ^- although...\n"},{"id":"115006","messageId":"1243598436-2207-1-git-send-email-szeder@ira.uka.de","threadId":"19558","inReplyTo":"1243527441-3394-1-git-send-email-szeder@ira.uka.de","subject":"[PATCH] bash: remove always true if statement from __git_ps1()","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2009-05-29T12:00:36Z","receivedAt":"2009-05-29T12:00:36Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"The recent commits 8763dbb1 (completion: fix PS1 display during a\nmerge on detached HEAD, 2009-05-16), ff790b6a (completion: simplify\n\"current branch\" in __git_ps1(), 2009-05-10), and d7107ca6\n(completion: fix PS1 display during an AM on detached HEAD,\n2009-05-26) ensure that the branch name in __git_ps1() is always set\nto something sensible.  Therefore, the condition for checking the\nnon-empty branch name is always fulfilled, and can be removed.\n\nSigned-off-by: SZEDER Gábor <szeder@ira.uka.de>\n---\n\nThe patch is the same, but the commit message is different, because\nJunio's d7107ca6 has fixed the issue.\n\n contrib/completion/git-completion.bash |   10 ++++------\n 1 files changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 0c8bb53..6c78c94 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -152,12 +152,10 @@ __git_ps1 ()\n \t\t\tfi\n \t\tfi\n \n-\t\tif [ -n \"$b\" ]; then\n-\t\t\tif [ -n \"${1-}\" ]; then\n-\t\t\t\tprintf \"$1\" \"$c${b##refs/heads/}$w$i$r\"\n-\t\t\telse\n-\t\t\t\tprintf \" (%s)\" \"$c${b##refs/heads/}$w$i$r\"\n-\t\t\tfi\n+\t\tif [ -n \"${1-}\" ]; then\n+\t\t\tprintf \"$1\" \"$c${b##refs/heads/}$w$i$r\"\n+\t\telse\n+\t\t\tprintf \" (%s)\" \"$c${b##refs/heads/}$w$i$r\"\n \t\tfi\n \tfi\n }\n-- \n1.6.3.1.189.g9321\n"},{"id":"115016","messageId":"20090529150319.GC30527@spearce.org","threadId":"19558","inReplyTo":"1243598436-2207-1-git-send-email-szeder@ira.uka.de","subject":"Re: [PATCH] bash: remove always true if statement from __git_ps1()","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-05-29T15:03:19Z","receivedAt":"2009-05-29T15:03:19Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"SZEDER G??bor <szeder@ira.uka.de> wrote:\n> The recent commits 8763dbb1 (completion: fix PS1 display during a\n> merge on detached HEAD, 2009-05-16), ff790b6a (completion: simplify\n> \"current branch\" in __git_ps1(), 2009-05-10), and d7107ca6\n> (completion: fix PS1 display during an AM on detached HEAD,\n> 2009-05-26) ensure that the branch name in __git_ps1() is always set\n> to something sensible.  Therefore, the condition for checking the\n> non-empty branch name is always fulfilled, and can be removed.\n> \n> Signed-off-by: SZEDER G??bor <szeder@ira.uka.de>\n> ---\n> \n> The patch is the same, but the commit message is different, because\n> Junio's d7107ca6 has fixed the issue.\n>\n>  contrib/completion/git-completion.bash |   10 ++++------\n>  1 files changed, 4 insertions(+), 6 deletions(-)\n\nYay, code reduction is good.  :-)\n\nTrivially-Acked-by: Shawn O. Pearce <spearce@spearce.org>\n\n-- \nShawn.\n"}]}