ref: bf1166558a633c47495e14f2c8666fa05b3d2599
parent: fa2eda237bec91d222c22459601bfc995cc2d37f
author: Jacob Moody <moody@posixcafe.org>
date: Wed Jul 13 16:29:19 EDT 2022
git-remote-hjgit: make compliant with actual /bin/sh Also make it a bit more portable with respect to awk, openBSD's awk is not capable of printing null characters.
--- a/git-remote-hjgit
+++ b/git-remote-hjgit
@@ -8,27 +8,15 @@
dir="$GIT_DIR/hjgit/$alias"
prefix="refs/hjgit/$alias"
+refspec="refs/heads/*:$prefix/heads/*"
-default_refspec="refs/heads/*:${prefix}/heads/*"
-
-refspec="${GIT_REMOTE_HJGIT_REFSPEC-$default_refspec}"
-
+test $GIT_REMOTE_HJGIT_REFSPEC && refspec=$GIT_REMOTE_HJGIT_REFSPEC
test -z "$refspec" && prefix="refs"
-force=
-
mkdir -p "$dir"
-if test -z "$GIT_REMOTE_HJGIT_NO_MARKS"
-then
- gitmarks="$dir/git.marks"
- hjgitmarks="$dir/hjgit.marks"
- test -e "$gitmarks" || >"$gitmarks"
- test -e "$hjgitmarks" || >"$hjgitmarks"
-fi
-
packinitfmt(){
- printf "%s %s\0host=%s" $1 $2 $3 | awk '{ printf("%04x%s\0", length($0)+1+4, $0) }'
+ printf "%s %s\0host=%s\0" $1 $2 $3 | awk '{ printf("%04x%s", length($0)+4, $0) }'
}
while read line
@@ -43,7 +31,7 @@
# lie that the connection works
echo
{
- packinitfmt $(echo $line | awk '{ print $2 }') $path $host
+ packinitfmt `echo $line | awk '{ print $2 }'` $path $host
cat
} | CPU=$host AUTH='p9auth.'$host tlsclient -p 17021
exit