[igt-dev] [PATCH 1/3] dim: pass git directory via parameter in dim cite, don't cd

Jani Nikula
2019-01-14T11:39:33Z

Make dim_cite safer to use within dim.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
dim | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index b2fddff1010c..9aac817be567 100755
--- a/dim
+++ b/dim
@@ -2275,9 +2275,8 @@ function dim_cite

sha1=${1:?$usage}

- cd $DIM_PREFIX/$DIM_REPO
-
- git log -1 $sha1 "--pretty=format:%H (\"%s\")%n" | \
+ git --git-dir="$DIM_PREFIX/$DIM_REPO/.git" log -1 $sha1 \
+ "--pretty=format:%H (\"%s\")%n" | \
sed -e 's/\([0-f]\{12\}\)[0-f]*/\1/'
}