Show the branch name more prominently in "git status".
PATCH 1/1 Show the branch name more prominently in "git status".
When not working on "master" branch, remind the user at the beginning of the status message, not at the end.
Adjust git-revert-script for this change as well. The way it detected a clean working tree was depending on the git status behaviour too much.
Signed-off-by Junio C Hamano <[email protected]>
---
git-revert-script | 10 ++++++---- git-status-script | 12 ++++++------ 2 files changed, 12 insertions(+), 10 deletions(-)
0f60ee0f83468393fb3bca2b5e4c8e78a8896cf5
git-revert-script +6 -4
@@ -2,11 +2,13 @@ . git-sh-setup-script || die "Not a git archive" # We want a clean tree and clean index to be able to revert. -status=$(git status) -case "$status" in -'nothing to commit') ;; +dirty=`git-diff-cache --name-only --cached HEAD` +case "$dirty" in '') dirty=`git-diff-cache --name-only HEAD` ;; esac +case "$dirty" in +'') ;; *) - echo "$status" + echo >&2 "Modified:" + echo "$dirty" | sed >&2 -e 's/^/ /' die "Your working tree is dirty; cannot revert a previous patch." ;; esac
git-status-script +6 -6
@@ -28,6 +28,12 @@ report () { [ "$header" ] } +branch=`readlink "$GIT_DIR/HEAD"` +case "$branch" in +refs/heads/master) ;; +*) echo "# +# On branch $branch" ;; +esac git-update-cache --refresh >/dev/null 2>&1 git-diff-cache -M --cached HEAD | sed 's/^://' | report "Updated but not checked in" "will commit" committable="$?"
@@ -37,10 +43,4 @@ then echo "nothing to commit" exit 1 fi -branch=`readlink "$GIT_DIR/HEAD"` -case "$branch" in -refs/heads/master) ;; -*) echo "# -# On branch $branch" ;; -esac exit 0