git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] completion: fix PS1 display during an AM on detached HEAD
@ 2009-05-26  5:56 Junio C Hamano
  0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2009-05-26  5:56 UTC (permalink / raw)
  To: git; +Cc: Shawn O. Pearce

This is a companion patch to previous 8763dbb (completion: fix PS1 display
during a merge on detached HEAD, 2009-05-16).  While rebasing or running am
on a detached HEAD, the code failed to set $b (branch description) that
enables the whole status display business.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 The original incorrectly indents the "rebase-apply" case, which gives
 the patch some "Huh?" effect, which this patch also fixes.

 contrib/completion/git-completion.bash |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 0c8bb53..c84d765 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -84,26 +84,24 @@ __git_ps1 ()
 	if [ -n "$g" ]; then
 		local r
 		local b
-		if [ -d "$g/rebase-apply" ]; then
-			if [ -f "$g/rebase-apply/rebasing" ]; then
-				r="|REBASE"
-		elif [ -f "$g/rebase-apply/applying" ]; then
-				r="|AM"
-			else
-				r="|AM/REBASE"
-			fi
-			b="$(git symbolic-ref HEAD 2>/dev/null)"
-		elif [ -f "$g/rebase-merge/interactive" ]; then
+		if [ -f "$g/rebase-merge/interactive" ]; then
 			r="|REBASE-i"
 			b="$(cat "$g/rebase-merge/head-name")"
 		elif [ -d "$g/rebase-merge" ]; then
 			r="|REBASE-m"
 			b="$(cat "$g/rebase-merge/head-name")"
 		else
-			if [ -f "$g/MERGE_HEAD" ]; then
+			if [ -d "$g/rebase-apply" ]; then
+				if [ -f "$g/rebase-apply/rebasing" ]; then
+					r="|REBASE"
+				elif [ -f "$g/rebase-apply/applying" ]; then
+					r="|AM"
+				else
+					r="|AM/REBASE"
+				fi
+			elif [ -f "$g/MERGE_HEAD" ]; then
 				r="|MERGING"
-			fi
-			if [ -f "$g/BISECT_LOG" ]; then
+			elif [ -f "$g/BISECT_LOG" ]; then
 				r="|BISECTING"
 			fi
 
-- 
1.6.3.1.169.g33fd7

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-26  5:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-26  5:56 [PATCH] completion: fix PS1 display during an AM on detached HEAD Junio C Hamano

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 NNTP newsgroup(s).