Put the main loop for the git protocol in a function

This commit is contained in:
root 2013-01-06 18:20:39 -07:00
parent 2261a5e7af
commit cd90cea0fe

View file

@ -762,59 +762,67 @@ cleanup_atexit()
rm -f "$Localdir"/tmp_*".$$" >&2 rm -f "$Localdir"/tmp_*".$$" >&2
} }
NAME=$1 # Remote name # handle git-remote-helpers protocol
URL=$2 # Remote URL gcrypt_main_loop()
{
local input_= input_inner= args_=
mkdir -p "$Localdir" NAME=$1 # Remote name
trap cleanup_atexit EXIT 1 2 3 15 URL=$2 # Remote URL
echo_info "Development version -- Repository format MAY CHANGE" mkdir -p "$Localdir"
trap cleanup_atexit EXIT 1 2 3 15
while read Input echo_info "Development version -- Repository format MAY CHANGE"
do
case "$Input" in while read input_
capabilities) do
do_capabilities case "$input_" in
;; capabilities)
list|list\ for-push) do_capabilities
do_list
;;
fetch\ *)
args_="${Input##fetch }"
while read InputX
do
case "$InputX" in
fetch*)
args_= #ignored
;; ;;
*) list|list\ for-push)
break do_list
;; ;;
esac fetch\ *)
done args_="${input_##fetch }"
do_fetch "$args_" while read input_inner
;; do
push\ *) case "$input_inner" in
args_="${Input##push }" fetch*)
while read InputX args_= #ignored
do ;;
case "$InputX" in *)
push\ *)
append_to args_ "${InputX#push }"
;;
*)
break break
;;
esac
done
do_fetch "$args_"
;; ;;
esac push\ *)
done args_="${input_##push }"
do_push "$args_" while read input_inner
;; do
?*) case "$input_inner" in
echo_die "Unknown input!" push\ *)
;; append_to args_ "${input_inner#push }"
*) ;;
CLEAN_FINAL "$URL" *)
exit 0 break
;; ;;
esac esac
done done
do_push "$args_"
;;
?*)
echo_die "Unknown input!"
;;
*)
CLEAN_FINAL "$URL"
exit 0
;;
esac
done
}
gcrypt_main_loop "$@"