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