summaryrefslogtreecommitdiffstats
path: root/git/.bin/git/git-root
diff options
context:
space:
mode:
Diffstat (limited to 'git/.bin/git/git-root')
-rwxr-xr-xgit/.bin/git/git-root9
1 files changed, 9 insertions, 0 deletions
diff --git a/git/.bin/git/git-root b/git/.bin/git/git-root
new file mode 100755
index 0000000..96fb395
--- /dev/null
+++ b/git/.bin/git/git-root
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -eu
+
+root="$(git rev-parse --show-superproject-working-tree 2>/dev/null)"
+if [ -n "$root" ]; then
+ echo "$root"
+else
+ git rev-parse --show-toplevel
+fi