From 5d1a5c02e8ac1c16688ea4a44512245f25a49f8a Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 1 Oct 2005 13:24:27 -0700 Subject: [PATCH] Better error reporting for "git status" Instead of "git status" ignoring (and hiding) potential errors from the "git-update-index" call, make it exit if it fails, and show the error. In order to do this, use the "-q" flag (to ignore not-up-to-date files) and add a new "--unmerged" flag that allows unmerged entries in the index without any errors. This also avoids marking the index "changed" if an entry isn't actually modified, and makes sure that we exit with an understandable error message if the index is corrupt or unreadable. "read_cache()" no longer returns an error for the caller to check. Finally, make die() and usage() exit with recognizable error codes, if we ever want to check the failure reason in scripts. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- git-status.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git-status.sh') diff --git a/git-status.sh b/git-status.sh index ca9a15459..44398d760 100755 --- a/git-status.sh +++ b/git-status.sh @@ -37,7 +37,7 @@ refs/heads/master) ;; *) echo "# On branch $branch" ;; esac -git-update-index --refresh >/dev/null 2>&1 +git-update-index -q --unmerged --refresh || exit if GIT_DIR="$GIT_DIR" git-rev-parse --verify HEAD >/dev/null 2>&1 then -- cgit v1.2.1