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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <ukleinek@xxxxxxxxxxxxxxxxxxxxxxxxxx>
---

> > 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 majordomo@xxxxxxxxxxxxxxx
> 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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]