commit 8e61a5f863719e20dce877640bc3577e3234858a
parent ffeb55a9363f303a0bc06476af4dc3b52fac487f
Author: Oscar Benedito <oscar@oscarbenedito.com>
Date:   Tue, 24 Nov 2020 23:22:03 +0100

Fix symlinks to .git folder

Also surrounded all arguments with quotes.

Diffstat:
Mexample_create.sh | 10+++++-----
Mexample_post-receive.sh | 16++++++++--------
2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/example_create.sh b/example_create.sh @@ -40,8 +40,8 @@ for dir in "$reposdir/"*.git/; do [ ! -f "$dir/category" ] && [ -z "$stagit_uncat" ] && stagit_uncat="1" # strip .git suffix - r=$(basename "$dir") - d=$(basename "$dir" ".git") + r="$(basename "$dir")" + d="$(basename "$dir" ".git")" printf "%s... " "$d" mkdir -p "$webdir/$d" @@ -50,9 +50,9 @@ for dir in "$reposdir/"*.git/; do # symlinks [ -f "about.html" ] \ - && ln -sf about.html index.html \ - || ln -sf log.html index.html - ln -sf "$reposdir/$r" ".git" + && ln -sf "about.html" "index.html" \ + || ln -sf "log.html" "index.html" + ln -sfT "$reposdir/$r" ".git" echo "done" done diff --git a/example_post-receive.sh b/example_post-receive.sh @@ -17,7 +17,7 @@ export LC_CTYPE="en_US.UTF-8" name="$1" if test "${name}" = ""; then - name=$(basename "$(pwd)") + name="$(basename "$(pwd)")" fi # paths must be absolute @@ -40,16 +40,16 @@ while read -r old new ref; do test "${old}" = "0000000000000000000000000000000000000000" && continue test "${new}" = "0000000000000000000000000000000000000000" && continue - hasrevs=$(git rev-list "${old}" "^${new}" | sed 1q) + hasrevs="$(git rev-list "${old}" "^${new}" | sed 1q)" if test -n "${hasrevs}"; then - force=1 + force="1" break fi done # strip .git suffix -r=$(basename "${name}") -d=$(basename "${name}" ".git") +r="$(basename "${name}")" +d="$(basename "${name}" ".git")" printf "[%s] stagit HTML pages... " "${d}" # remove folder if forced update @@ -61,9 +61,9 @@ cd "${destdir}/${d}" || exit 1 # make pages stagit -c "${cachefile}" "${reposdir}/${r}" [ -f "about.html" ] \ - && ln -sf about.html index.html \ - || ln -sf log.html index.html -ln -sf "${dir}" .git + && ln -sf "about.html" "index.html" \ + || ln -sf "log.html" "index.html" +ln -sfT "${dir}" ".git" # generate index arguments args=""