git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <zeisberg@informatik.uni-freiburg.de>
To: git@vger.kernel.org
Cc: "Shawn O. Pearce" <spearce@spearce.org>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH RFC] new config option remote.<name>.pushexec
Date: Wed, 17 Jan 2007 17:44:10 +0100	[thread overview]
Message-ID: <20070117164410.GA5950@cepheus> (raw)
In-Reply-To: <Pine.LNX.4.63.0701162129430.22628@wbgn013.biozentrum.uni-wuerzburg.de>

git push --exec=... is fine, but having it to specify every time is
annoying.

This sets the default remote program for pushing to remote <name>.

Signed-off-by: Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de>
---
 Documentation/config.txt |    4 ++++
 builtin-push.c           |   11 +++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

This patch fixes two of three shortcomings pointed out at initial
sending.  The compiler warning is gone (but I'm not 100% sure if it is
fixed correctly or if only my compiler doesn't warn) and the commandline
can overwrite the value now without a warning.

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.

Best regards
Uwe

diff --git a/Documentation/config.txt b/Documentation/config.txt
index da7fde5..bd4f72a 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -356,6 +356,10 @@ remote.<name>.push::
 	The default set of "refspec" for gitlink:git-push[1]. See
 	gitlink:git-push[1].
 
+remote.<name>.pushexec::
+	The default program to execute on the remote side when pulling.  See
+	option \--exec of gitlink:git-push[1].
+
 repack.usedeltabaseoffset::
 	Allow gitlink:git-repack[1] to create packs that uses
 	delta-base offset.  Defaults to false.
diff --git a/builtin-push.c b/builtin-push.c
index 7a3d2bb..8ca5aee 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -143,6 +143,7 @@ static const char *config_repo;
 static int config_repo_len;
 static int config_current_uri;
 static int config_get_refspecs;
+static int config_get_pushexec;
 
 static int get_remote_config(const char* key, const char* value)
 {
@@ -157,6 +158,15 @@ static int get_remote_config(const char* key, const char* value)
 		else if (config_get_refspecs &&
 			 !strcmp(key + 7 + config_repo_len, ".push"))
 			add_refspec(xstrdup(value));
+		else if (config_get_pushexec &&
+			 !strcmp(key + 7 + config_repo_len, ".pushexec")) {
+			if (!execute) {
+				char *ex = xmalloc(strlen(value) + 8);
+				sprintf(ex, "--exec=%s", value);
+				execute = ex;
+			} else
+				error("more than one pushexec given, using the first");
+		}
 	}
 	return 0;
 }
@@ -168,6 +178,7 @@ static int get_config_remotes_uri(const char *repo, const char *uri[MAX_URI])
 	config_current_uri = 0;
 	config_uri = uri;
 	config_get_refspecs = !(refspec_nr || all || tags);
+	config_get_pushexec = (execute == NULL);
 
 	git_config(get_remote_config);
 	return config_current_uri;
-- 
1.5.0.rc1.g581a

-- 
Uwe Kleine-König

main(){char*a="main(){char*a=%c%s%c;printf(a,34,a,34%c";printf(a,34,a,34
,10);a=",10);a=%c%s%c;printf(a,34,a,34,10);}%c";printf(a,34,a,34,10);}

  reply	other threads:[~2007-01-17 16:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-16 15:02 [PATCH RFC] new config option remote.<name>.pushexec Uwe Kleine-König
2007-01-16 15:16 ` Johannes Schindelin
2007-01-16 16:26   ` Uwe Kleine-König
2007-01-16 17:37     ` How to merge FETCH_HEAD? Michael S. Tsirkin
2007-01-16 19:59       ` Shawn O. Pearce
2007-01-16 21:33         ` Michael S. Tsirkin
2007-01-16 21:36           ` Johannes Schindelin
2007-01-17  5:09             ` Michael S. Tsirkin
2007-01-17  6:14               ` Junio C Hamano
2007-01-17  6:33                 ` Michael S. Tsirkin
2007-01-16 20:15       ` Junio C Hamano
2007-01-16 20:08     ` [PATCH RFC] new config option remote.<name>.pushexec Shawn O. Pearce
2007-01-16 20:30       ` Johannes Schindelin
2007-01-17 16:44         ` Uwe Kleine-König [this message]
2007-01-17 17:32           ` Junio C Hamano
2007-01-18  7:17             ` Uwe Kleine-König
2007-01-25  4:45               ` [PATCH] make --upload-pack option to git-fetch configurable Uwe Kleine-König
2007-01-25  4:53                 ` Uwe Kleine-König
2007-01-16 16:27   ` [PATCH RFC] new config option remote.<name>.pushexec Brian Gernhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070117164410.GA5950@cepheus \
    --to=zeisberg@informatik.uni-freiburg.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).