Show the presence of untracked files in the bash prompt.
Added the envvar GIT_PS1_SHOWUNTRACKEDFILES to 'git-completion.bash'. When set to a nonempty value, then the char '%' will be shown next to the branch name in the bash prompt. Signed-off-by: Daniel Trstenjak <daniel.trstenjak@science-computing.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f87dd2152a
commit
397f7c6371
@ -44,6 +44,10 @@
|
|||||||
# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
|
# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed,
|
||||||
# then a '$' will be shown next to the branch name.
|
# then a '$' will be shown next to the branch name.
|
||||||
#
|
#
|
||||||
|
# If you would like to see if there're untracked files, then you can
|
||||||
|
# set GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're
|
||||||
|
# untracked files, then a '%' will be shown next to the branch name.
|
||||||
|
#
|
||||||
# To submit patches:
|
# To submit patches:
|
||||||
#
|
#
|
||||||
# *) Read Documentation/SubmittingPatches
|
# *) Read Documentation/SubmittingPatches
|
||||||
@ -132,6 +136,7 @@ __git_ps1 ()
|
|||||||
local w
|
local w
|
||||||
local i
|
local i
|
||||||
local s
|
local s
|
||||||
|
local u
|
||||||
local c
|
local c
|
||||||
|
|
||||||
if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
|
if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then
|
||||||
@ -156,12 +161,18 @@ __git_ps1 ()
|
|||||||
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
|
if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then
|
||||||
git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
|
git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then
|
||||||
|
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
|
||||||
|
u="%"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${1-}" ]; then
|
if [ -n "${1-}" ]; then
|
||||||
printf "$1" "$c${b##refs/heads/}$w$i$s$r"
|
printf "$1" "$c${b##refs/heads/}$w$i$s$u$r"
|
||||||
else
|
else
|
||||||
printf " (%s)" "$c${b##refs/heads/}$w$i$s$r"
|
printf " (%s)" "$c${b##refs/heads/}$w$i$s$u$r"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user