diff options
-rwxr-xr-x | EndoForge/src/AnonymousAccessCommand | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/EndoForge/src/AnonymousAccessCommand b/EndoForge/src/AnonymousAccessCommand index b06dd93..5146da4 100755 --- a/EndoForge/src/AnonymousAccessCommand +++ b/EndoForge/src/AnonymousAccessCommand | |||
@@ -66,6 +66,20 @@ check_if_self_forge() | |||
66 | fi | 66 | fi |
67 | } | 67 | } |
68 | 68 | ||
69 | with_soul_bare() | ||
70 | { | ||
71 | ( | ||
72 | set -eC | ||
73 | lockfile=$GIT_DIR/index.lock | ||
74 | echo $$ > "$lockfile" | ||
75 | trap 'rm -f "$lockfile"' EXIT | ||
76 | |||
77 | git config core.bare true | ||
78 | "$@" | ||
79 | git config core.bare false | ||
80 | ) | ||
81 | } | ||
82 | |||
69 | read authtype authline < "$SSH_USER_AUTH" || exit | 83 | read authtype authline < "$SSH_USER_AUTH" || exit |
70 | [ "$authtype" = publickey ] || exit | 84 | [ "$authtype" = publickey ] || exit |
71 | 85 | ||
@@ -97,24 +111,9 @@ dir=$(readlink -e "$arg") || exit | |||
97 | 111 | ||
98 | check_if_self_forge "$dir" | 112 | check_if_self_forge "$dir" |
99 | 113 | ||
100 | with_allowCurrentBranch() | ||
101 | { | ||
102 | local cmd="$1" dir="$2" | ||
103 | ( | ||
104 | set -eC | ||
105 | lockfile=$GIT_DIR/index.lock | ||
106 | echo $$ > "$lockfile" | ||
107 | trap 'rm -f "$lockfile"' EXIT | ||
108 | |||
109 | git config core.bare true | ||
110 | "$@" | ||
111 | git config core.bare false | ||
112 | ) | ||
113 | } | ||
114 | |||
115 | if [ "$GIT_NAMESPACE" ] | 114 | if [ "$GIT_NAMESPACE" ] |
116 | then | 115 | then |
117 | GIT_DIR=$dir with_allowCurrentBranch "$cmd" "$dir" | 116 | GIT_DIR=$dir with_soul_bare "$cmd" "$dir" |
118 | else | 117 | else |
119 | "$cmd" "$dir" | 118 | "$cmd" "$dir" |
120 | fi | 119 | fi |