git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Show the branch name more prominently in "git status".
@ 2005-08-26  8:02 Junio C Hamano
  0 siblings, 0 replies; only message in thread
From: Junio C Hamano @ 2005-08-26  8:02 UTC (permalink / raw
  To: git

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 <junkio@cox.net>

---

 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-26  8:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-26  8:02 [PATCH] Show the branch name more prominently in "git status" Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).