From 203bfc28616a25b9001cea0a447612362dc8d7ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 14 Jun 2021 07:33:40 +0200 Subject: conv: Find root directory for Git repository --- conv | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conv b/conv index f5d2ebc..c7b6ffb 100755 --- a/conv +++ b/conv @@ -11,7 +11,7 @@ IFS=' # get patch description if [ x"$1" = x"-i" ]; then - f=`mktemp` + f=`mktemp -t ${0##*/}` || exit 1 echo 'Edit patch description...' > $f /dev/tty vi $f c=`cat $f` @@ -34,6 +34,7 @@ while read line; do '--- a/'*) file=${line#--- a/} echo -n "--- $file.orig " + file=$(git rev-parse --show-toplevel)/$file echo "$(stat -x "$file")" | sed -n 's/^Access: //p' ;; '+++ b/'*) echo "+++ ${line#+++ b/}" ;; @@ -68,7 +69,7 @@ if [ x"$1" = x"-i" ]; then # write patch if it doesn't already exist if [ -e $dir/$name ]; then - f=`mktemp` + f=`mktemp -t ${0##*/}` || exit 1 echo error: $dir/$name already exists; saving to $f 1>&2 exit 1 else -- cgit v1.2.3