Subject: [PATCH] make --upload-pack option to git-fetch configurable

From: Uwe Kleine-König <[email-masked]>
Date: Thu, 25 Jan 2007 05:45:39 +0100

This introduces the config item remote.<name>.uploadpack to override the
default value (which is "git-upload-pack").

Signed-off-by: Uwe Kleine-König <[email-masked]>
---

> > diff --git a/git-fetch.sh b/git-fetch.sh
> > index 87b940b..7372c5f 100755
> > --- a/git-fetch.sh
> > +++ b/git-fetch.sh
> > @@ -82,6 +82,13 @@ case "$#" in
> >  	set x $origin ; shift ;;
> >  esac
> >  
> > +if test -z "$exec" && exec=$(git-repo-config "remote.$1.uploadpack")
> > +then
> > +	# No command line override and we have configuration for the remote.
> > +	upload_pack="-u $exec"
> > +	exec="--exec=$exec"
> > +fi
> > +
> >  remote_nick="$1"
> >  remote=$(get_remote_url "$@")
> >  refs=
> 
> I thought that it would be cleaner to add this code to
> git-parse-remote.sh and only do it if $(get_data_source) == 'config'.
This is, what this patch does.  Actually it was easier than I feared.

 git-fetch.sh        |    6 ++++++
 git-parse-remote.sh |   13 +++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/git-fetch.sh b/git-fetch.sh
index 07a1d05..61c8cf4 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -85,6 +85,12 @@ case "$#" in
 	set x $origin ; shift ;;
 esac
 
+if test -z "$exec"
+then
+	# No command line override and we have configuration for the remote.
+	exec="--upload-pack=$(get_uploadpack $1)"
+fi
+
 remote_nick="$1"
 remote=$(get_remote_url "$@")
 refs=
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 4fc6020..1122c83 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -279,3 +279,16 @@ resolve_alternates () {
 		esac
 	done
 }
+
+get_uploadpack () {
+	data_source=$(get_data_source "$1")
+	case "$data_source" in
+	config)
+		uplp=$(git-repo-config --get "remote.$1.uploadpack")
+		echo ${uplp:-git-upload-pack}
+		;;
+	*)
+		echo "git-upload-pack"
+		;;
+	esac
+}
-- 
1.5.0.rc2.g3ea949

Uwe Kleine-König wrote:
> 
> Best regards
> Uwe
> 
> -- 
> Uwe Kleine-König
> 
> If a lawyer and an IRS agent were both drowning, and you could only save
> one of them, would you go to lunch or read the paper?
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to [email-masked]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Uwe Kleine-König

http://www.google.com/search?q=12+divided+by+3