Skip to content

Commit

Permalink
bash: remove always true if statement from __git_ps1()
Browse files Browse the repository at this point in the history
The recent commits 8763dbb (completion: fix PS1 display during a
merge on detached HEAD, 2009-05-16), ff790b6 (completion: simplify
"current branch" in __git_ps1(), 2009-05-10), and d7107ca
(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>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
SZEDER Gábor authored and Junio C Hamano committed May 31, 2009
1 parent c4d5359 commit ee6b711
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,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
}
Expand Down

0 comments on commit ee6b711

Please sign in to comment.