summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMehdi Sadeghi <mehdi@mehdix.org>2021-06-29 13:58:48 +0200
committerMehdi Sadeghi <mehdi@mehdix.org>2021-06-29 13:58:48 +0200
commitda83541f68bf47ca1fc5b03848787123664270cc (patch)
tree5925099402267656ad7d372fe14d91bad9c61adc
parent052e42e23f4d7de0acb09f8f9ae966f627aebde9 (diff)
Fix the git prompt.
-rwxr-xr-x.local/bin/prompt4
1 files changed, 2 insertions, 2 deletions
diff --git a/.local/bin/prompt b/.local/bin/prompt
index 0118ae8..0344618 100755
--- a/.local/bin/prompt
+++ b/.local/bin/prompt
@@ -1,7 +1,7 @@
#!/bin/sh
BRANCH=$(git branch --show-current 2>/dev/null)
-BRANCH=$(test -d .git && test -n $BRANCH && echo "($BRANCH)")
-PROMPT="$USER@$(hostname):$( test $PWD = $HOME && echo '~' || basename "$PWD")$BRANCH"
+BRANCH=$(test -n "$BRANCH" && echo "($BRANCH)")
+PROMPT="$USER@$(hostname):$( test $PWD = $HOME && echo '~' || echo "$PWD")$BRANCH"
case $(id -u) in
0) echo "$PROMPT# " ;;
*) echo "$PROMPT$ " ;;