aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorroot <root@localhost>2013-01-06 18:20:39 -0700
committerroot <root@localhost>2013-01-06 18:20:39 -0700
commitcd90cea0fe72e6bb1a8f2992b642b28398111ebb (patch)
treed44d40bc824a77d1c9ee05baf7243e876f70c523
parent2261a5e7af4d3f83b74857b3a50e366a9064b4ad (diff)
downloadgit-remote-gcrypt-cd90cea0fe72e6bb1a8f2992b642b28398111ebb.zip
git-remote-gcrypt-cd90cea0fe72e6bb1a8f2992b642b28398111ebb.tar.gz
git-remote-gcrypt-cd90cea0fe72e6bb1a8f2992b642b28398111ebb.tar.bz2
Put the main loop for the git protocol in a function
-rwxr-xr-xgit-remote-gcrypt112
1 files changed, 60 insertions, 52 deletions
diff --git a/git-remote-gcrypt b/git-remote-gcrypt
index 73f75e2..e12d355 100755
--- a/git-remote-gcrypt
+++ b/git-remote-gcrypt
@@ -762,59 +762,67 @@ cleanup_atexit()
rm -f "$Localdir"/tmp_*".$$" >&2
}
-NAME=$1 # Remote name
-URL=$2 # Remote URL
-
-mkdir -p "$Localdir"
-trap cleanup_atexit EXIT 1 2 3 15
-
-echo_info "Development version -- Repository format MAY CHANGE"
-
-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
+# handle git-remote-helpers protocol
+gcrypt_main_loop()
+{
+ local input_= input_inner= args_=
+
+ NAME=$1 # Remote name
+ URL=$2 # Remote URL
+
+ mkdir -p "$Localdir"
+ trap cleanup_atexit EXIT 1 2 3 15
+
+ 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 "$@"