git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] bash: display git prompt in case of merge conflict during rebase
@ 2009-05-28 16:17 SZEDER Gábor
  2009-05-28 17:01 ` SZEDER Gábor
  2009-05-29 12:00 ` [PATCH] bash: remove always true if statement from __git_ps1() SZEDER Gábor
  0 siblings, 2 replies; 4+ messages in thread
From: SZEDER Gábor @ 2009-05-28 16:17 UTC (permalink / raw
  To: Shawn O. Pearce; +Cc: Ted Pavlic, git, SZEDER Gábor

Since e5dd864a (completion: Better __git_ps1 support when not in
working directory, 2009-02-11) the git prompt becomes empty, if we hit
a merge conflict during a rebase.

e5dd864a added an if statement at the end of __git_ps1 to only display
anything in the prompt, if the branch name is not empty.  This caused
the empty prompt in the "merge conflict during rebase" case, because
in this case we display neither the branch name nor the abbreviated
SHA1, the ongoing rebase is identified.

This patch removes that check, so the git prompt is displayed even if
the branch name is empty.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 0c8bb53..6c78c94 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -152,12 +152,10 @@ __git_ps1 ()
 			fi
 		fi
 
-		if [ -n "$b" ]; then
-			if [ -n "${1-}" ]; then
-				printf "$1" "$c${b##refs/heads/}$w$i$r"
-			else
-				printf " (%s)" "$c${b##refs/heads/}$w$i$r"
-			fi
+		if [ -n "${1-}" ]; then
+			printf "$1" "$c${b##refs/heads/}$w$i$r"
+		else
+			printf " (%s)" "$c${b##refs/heads/}$w$i$r"
 		fi
 	fi
 }
-- 
1.6.3.1.189.g9321

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] bash: display git prompt in case of merge conflict during rebase
  2009-05-28 16:17 [PATCH] bash: display git prompt in case of merge conflict during rebase SZEDER Gábor
@ 2009-05-28 17:01 ` SZEDER Gábor
  2009-05-29 12:00 ` [PATCH] bash: remove always true if statement from __git_ps1() SZEDER Gábor
  1 sibling, 0 replies; 4+ messages in thread
From: SZEDER Gábor @ 2009-05-28 17:01 UTC (permalink / raw
  To: Shawn O. Pearce; +Cc: Ted Pavlic, git

On Thu, May 28, 2009 at 06:17:21PM +0200, SZEDER Gábor wrote:
> Since e5dd864a (completion: Better __git_ps1 support when not in
> working directory, 2009-02-11) the git prompt becomes empty, if we hit
> a merge conflict during a rebase.
> 
> e5dd864a added an if statement at the end of __git_ps1 to only display
> anything in the prompt, if the branch name is not empty.  This caused
> the empty prompt in the "merge conflict during rebase" case, because
> in this case we display neither the branch name nor the abbreviated
> SHA1, the ongoing rebase is identified.
       ^- although...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] bash: remove always true if statement from __git_ps1()
  2009-05-28 16:17 [PATCH] bash: display git prompt in case of merge conflict during rebase SZEDER Gábor
  2009-05-28 17:01 ` SZEDER Gábor
@ 2009-05-29 12:00 ` SZEDER Gábor
  2009-05-29 15:03   ` Shawn O. Pearce
  1 sibling, 1 reply; 4+ messages in thread
From: SZEDER Gábor @ 2009-05-29 12:00 UTC (permalink / raw
  To: Shawn O. Pearce; +Cc: Ted Pavlic, Junio C Hamano, git, SZEDER Gábor

The recent commits 8763dbb1 (completion: fix PS1 display during a
merge on detached HEAD, 2009-05-16), ff790b6a (completion: simplify
"current branch" in __git_ps1(), 2009-05-10), and d7107ca6
(completion: fix PS1 display during an AM on detached HEAD,
2009-05-26) ensure that the branch name in __git_ps1() is always set
to something sensible.  Therefore, the condition for checking the
non-empty branch name is always fulfilled, and can be removed.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---

The patch is the same, but the commit message is different, because
Junio's d7107ca6 has fixed the issue.

 contrib/completion/git-completion.bash |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 0c8bb53..6c78c94 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -152,12 +152,10 @@ __git_ps1 ()
 			fi
 		fi
 
-		if [ -n "$b" ]; then
-			if [ -n "${1-}" ]; then
-				printf "$1" "$c${b##refs/heads/}$w$i$r"
-			else
-				printf " (%s)" "$c${b##refs/heads/}$w$i$r"
-			fi
+		if [ -n "${1-}" ]; then
+			printf "$1" "$c${b##refs/heads/}$w$i$r"
+		else
+			printf " (%s)" "$c${b##refs/heads/}$w$i$r"
 		fi
 	fi
 }
-- 
1.6.3.1.189.g9321

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] bash: remove always true if statement from __git_ps1()
  2009-05-29 12:00 ` [PATCH] bash: remove always true if statement from __git_ps1() SZEDER Gábor
@ 2009-05-29 15:03   ` Shawn O. Pearce
  0 siblings, 0 replies; 4+ messages in thread
From: Shawn O. Pearce @ 2009-05-29 15:03 UTC (permalink / raw
  To: SZEDER G??bor; +Cc: Ted Pavlic, Junio C Hamano, git

SZEDER G??bor <szeder@ira.uka.de> wrote:
> The recent commits 8763dbb1 (completion: fix PS1 display during a
> merge on detached HEAD, 2009-05-16), ff790b6a (completion: simplify
> "current branch" in __git_ps1(), 2009-05-10), and d7107ca6
> (completion: fix PS1 display during an AM on detached HEAD,
> 2009-05-26) ensure that the branch name in __git_ps1() is always set
> to something sensible.  Therefore, the condition for checking the
> non-empty branch name is always fulfilled, and can be removed.
> 
> Signed-off-by: SZEDER G??bor <szeder@ira.uka.de>
> ---
> 
> The patch is the same, but the commit message is different, because
> Junio's d7107ca6 has fixed the issue.
>
>  contrib/completion/git-completion.bash |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)

Yay, code reduction is good.  :-)

Trivially-Acked-by: Shawn O. Pearce <spearce@spearce.org>

-- 
Shawn.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-29 15:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28 16:17 [PATCH] bash: display git prompt in case of merge conflict during rebase SZEDER Gábor
2009-05-28 17:01 ` SZEDER Gábor
2009-05-29 12:00 ` [PATCH] bash: remove always true if statement from __git_ps1() SZEDER Gábor
2009-05-29 15:03   ` Shawn O. Pearce

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).