git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] bisect: improve error message of 'bisect log' while not bisecting
@ 2010-10-10 21:48 SZEDER Gábor
  2010-10-10 21:48 ` [PATCH 2/3] bisect: improve error msg of 'bisect reset' when original HEAD is deleted SZEDER Gábor
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: SZEDER Gábor @ 2010-10-10 21:48 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, SZEDER Gábor

'git bisect log' is implemented by a direct invocation of 'cat
"$GIT_DIR/BISECT_LOG"', without any sanity checks.  Consequently,
running 'git bisect log' while not bisecting leads to an error,
because the bisect logfile doesn't exists.  The accompanying error
message

  cat: /path/to/repo/.git/BISECT_LOG: No such file or directory

is neither very helpful nor very friendly.

Instead of blindly trying to cat the log file, first check whether
there is a bisection going on (i.e. the bisect logfile exists), and
die with a more appropriate error message when not.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 git-bisect.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 6e2acb8..3a4bf81 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -412,6 +412,10 @@ bisect_run () {
     done
 }
 
+bisect_log () {
+	test -s "$GIT_DIR/BISECT_LOG" || die "We are not bisecting."
+	cat "$GIT_DIR/BISECT_LOG"
+}
 
 case "$#" in
 0)
@@ -438,7 +442,7 @@ case "$#" in
     replay)
 	bisect_replay "$@" ;;
     log)
-	cat "$GIT_DIR/BISECT_LOG" ;;
+	bisect_log ;;
     run)
         bisect_run "$@" ;;
     *)
-- 
1.7.3.1.148.g2fffa

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-10-14  7:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-10 21:48 [PATCH 1/3] bisect: improve error message of 'bisect log' while not bisecting SZEDER Gábor
2010-10-10 21:48 ` [PATCH 2/3] bisect: improve error msg of 'bisect reset' when original HEAD is deleted SZEDER Gábor
2010-10-10 21:48 ` [PATCH 3/3] bisect: check for mandatory argument of 'bisect replay' SZEDER Gábor
2010-10-12  2:35   ` Christian Couder
2010-10-12  2:56     ` Christian Couder
2010-10-13 17:58       ` Junio C Hamano
2010-10-14  7:55         ` Christian Couder
2010-10-11  6:44 ` [PATCH 1/3] bisect: improve error message of 'bisect log' while not bisecting Ævar Arnfjörð Bjarmason

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 NNTP newsgroup(s).