From a5c3e1a1ee792d47bc64fd1ca5f42068e0a7f6d5 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 24 Oct 2021 21:10:38 -0400 Subject: Change decision whether to append "/.git" Before, AnonymousAccessCommand would append "/.git" to any name that didn't end in ".git". Now, it appends the ".git" subdir to a dirname exactly when that subdir exists. --- EndoForge/src/AnonymousAccessCommand | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'EndoForge/src/AnonymousAccessCommand') diff --git a/EndoForge/src/AnonymousAccessCommand b/EndoForge/src/AnonymousAccessCommand index 526f53d..ffdc07a 100755 --- a/EndoForge/src/AnonymousAccessCommand +++ b/EndoForge/src/AnonymousAccessCommand @@ -74,6 +74,11 @@ with_soul_bare() ) } +unsupported() +{ + echo "$0: Error: unsupported" >&2 +} + read authtype authline < "$SSH_USER_AUTH" || exit [ "$authtype" = publickey ] || exit @@ -90,12 +95,17 @@ arg=${SSH_ORIGINAL_COMMAND#* } arg=${arg%\'} arg=${arg#\'} case "$arg" in - *\'*) exit ;; # we should support these wtf - *.git) ;; - *) arg=$arg/.git ;; + *\'* ) + unsupported + exit + ;; esac -dir=$(readlink -e "$arg") || exit +if ! dir=$(readlink -e "$arg") +then exit +elif [ -d "$dir"/.git ] +then dir=$dir/.git +fi if ! is_self_forge "$dir" then -- cgit v1.2.3