Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH] Show the branch name more prominently in "git status".
Date: Fri, 26 Aug 2005 01:02:46 -0700	[thread overview]
Message-ID: <7vr7chgm6x.fsf@assigned-by-dhcp.cox.net> (raw)

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

                 reply	other threads:[~2005-08-26  8:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vr7chgm6x.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox