Re: [PATCH RFC] new config option remote.<name>.pushexec

Subsystems: the rest

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH RFC] new config option remote.<name>.pushexec

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:49

Uwe Kleine-König  [off-list ref] writes:
I tried to do the symmetric part for fetch, but that shell script is too
complicated for me and so I let this part to s.o. being more familiar
with git-fetch.sh.
I do not know what s.o. is but something like this untested
patch would do.

I do not have strong objection to the configuration on the push
side, but I am not sure if we want to call it pushexec -- it is
naming receive-pack so remote.*.receivepack might be more
appropriate, just in case we update the fetch/push protocol
someday to run more than one program on the other end.

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=

Re: [PATCH RFC] new config option remote.<name>.pushexec

From: Uwe Kleine-König <hidden>
Date: 2016-06-15 22:42:49

Hello Junio,

Junio C Hamano wrote:
Uwe Kleine-König  [off-list ref] writes:
quoted
I tried to do the symmetric part for fetch, but that shell script is too
complicated for me and so I let this part to s.o. being more familiar
with git-fetch.sh.
I do not know what s.o. is but something like this untested
patch would do.
s.o. = someone, I thought it's a usual abbreviation.
 
I do not have strong objection to the configuration on the push
side, but I am not sure if we want to call it pushexec -- it is
naming receive-pack so remote.*.receivepack might be more
appropriate, just in case we update the fetch/push protocol
someday to run more than one program on the other end.
I wondered about that, too.  In the docs we currently have:

	git-send-pack ... [--exec=<git-receive-pack>]
	git-fetch-pack ... [--exec=<git-upload-pack>]
	git-push ... [--exec=<receive-pack>]
	git-pull ... [--upload-pack <upload-pack>]
	git-fetch ... [--upload-pack <upload-pack>]

I have choosen 'pushexec' because that's the name of the option to push.
remote.*.receivepack is cleaner, as is

	git-push ...  [--receive-pack=...]

.  If we choose remote.*.receivepack, we should consider deprecating
--exec and introduce --receive-pack (--upload-pack resp.)
 
quoted hunk
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'.
But it's OK for me this way, too.

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?

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

From: Uwe Kleine-König <hidden>
Date: 2016-06-15 22:42:50

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 <redacted>
---
quoted
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@vger.kernel.org
> 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

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

From: Uwe Kleine-König <hidden>
Date: 2016-06-15 22:42:50

Hello,
+if test -z "$exec"
+then
+	# No command line override and we have configuration for the remote.
+	exec="--upload-pack=$(get_uploadpack $1)"
+fi
I forgot to mention that this needs the patches

	rename --exec to --upload-pack for fetch-pack and peek-remote
		(Message-ID: <20070123082017.GA10007@cepheus>)

and

	ls-remote and clone: accept --upload-pack=<path> as well.
		by Junio  (Message-ID: [off-list ref])

Best regards
Uwe

-- 
Uwe Kleine-König

dd if=/proc/self/exe bs=1 skip=1 count=3 2>/dev/null
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help