chiark / gitweb /
changedir_git_toplevel: Special error for not in git tree
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 11 Oct 2018 00:18:52 +0000 (01:18 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 11 Oct 2018 00:18:52 +0000 (01:18 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Debian/Dgit.pm

index bfe2ab9..458017d 100644 (file)
@@ -502,6 +502,10 @@ sub git_rev_parse ($) {
 
 sub changedir_git_toplevel () {
     my $toplevel = cmdoutput qw(git rev-parse --show-toplevel);
+    length $toplevel or fail __ <<END;
+not in a git working tree?
+(git rev-parse --show-toplevel produced no output)
+END
     chdir $toplevel or fail f_ "chdir toplevel %s: %s\n", $toplevel, $!;
 }