From c351a360ca05127499a7d19e7d31f2f4226d7689 Mon Sep 17 00:00:00 2001 From: "Carl D. Roth" Date: Mon, 27 Aug 2018 14:05:29 -0700 Subject: [PATCH] Compute top-of-tree for docker volumes --- docker/tools/gitroot | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 docker/tools/gitroot diff --git a/docker/tools/gitroot b/docker/tools/gitroot new file mode 100755 index 00000000..908c3eec --- /dev/null +++ b/docker/tools/gitroot @@ -0,0 +1,14 @@ +#!/bin/sh + +if test $# -gt 0; then + dir=$(realpath $1) +else + dir=$(pwd) +fi +while test $dir != /; do + if test -d $dir/.git; then + echo $dir + break + fi + dir=${dir%/*} +done