summaryrefslogtreecommitdiffstats
path: root/git/.bin/git/git-root
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2024-02-23 00:04:34 -0500
committerJesse Luehrs <doy@tozt.net>2024-02-23 00:04:34 -0500
commit5744b78be0d7ff168dcaf777c2f98818aab3862f (patch)
tree7ec8378834b61ed3ebf7c66bcaaa7d08d1b72787 /git/.bin/git/git-root
parent82afe435a24f4ea88182f3051e6837d5d6c0d68a (diff)
downloadconf-5744b78be0d7ff168dcaf777c2f98818aab3862f.tar.gz
conf-5744b78be0d7ff168dcaf777c2f98818aab3862f.zip
git helpers should be installed with git, not with the other bin files
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