chiark / gitweb /
dgit: Change to git toplevel dir before starting
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 5b223af..3591231 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -7376,7 +7376,10 @@ $cmd =~ y/-/_/;
 my $pre_fn = ${*::}{"pre_$cmd"};
 $pre_fn->() if $pre_fn;
 
-record_maindir if $invoked_in_git_tree;
+if ($invoked_in_git_tree) {
+    changedir_git_toplevel();
+    record_maindir();
+}
 git_slurp_config();
 
 my $fn = ${*::}{"cmd_$cmd"};