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 diff --git a/git-revert-script b/git-revert-script --- a/git-revert-script +++ b/git-revert-script @@ -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 diff --git a/git-status-script b/git-status-script --- a/git-status-script +++ b/git-status-script @@ -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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html