git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sven Verdoolaege <skimo@liacs.nl>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Daniel Barkalow <barkalow@iabervon.org>, git@vger.kernel.org
Subject: [PATCH] git-ssh-pull: commit-id consistency
Date: Mon, 27 Jun 2005 21:03:07 +0200	[thread overview]
Message-ID: <20050627210307.A3189@tin.liacs.nl> (raw)
In-Reply-To: <20050626214547.A29432@tin.liacs.nl>; from skimo@liacs.nl on Sun, Jun 26, 2005 at 09:45:47PM +0200

As requested by Daniel, this new version leaves *-pull alone
and only changes the behaviour of git-ssh-push.

skimo
--
In contrast to other plumbing tools, git-ssh-push only
allow a very restrictive form of commit-id filenames.
This patch removes this restriction.

Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>

---
commit 28ec093e92206cd907249e741ca1d19f14da4cf3
tree 5ad7b33ec80c2c04272cb0abd4531e1d9abfbbe1
parent e18088451d92fbf83bfb57fd48201eda117f8103
author Sven Verdoolaege <skimo@kotnet.org> Mon, 27 Jun 2005 20:12:40 +0200
committer Sven Verdoolaege <skimo@kotnet.org> Mon, 27 Jun 2005 20:12:40 +0200

 Documentation/git-ssh-push.txt |    2 +-
 ssh-push.c                     |   18 ++++++++++++++----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-ssh-push.txt b/Documentation/git-ssh-push.txt
--- a/Documentation/git-ssh-push.txt
+++ b/Documentation/git-ssh-push.txt
@@ -20,7 +20,7 @@ git-ssh-pull, aside from which end you r
 OPTIONS
 -------
 commit-id::
-        Either the hash or the filename under $GIT_DIR/refs/ to push.
+        Id of commit to push.
 
 -c::
         Get the commit objects.
diff --git a/ssh-push.c b/ssh-push.c
--- a/ssh-push.c
+++ b/ssh-push.c
@@ -2,6 +2,8 @@
 #include "rsh.h"
 #include "refs.h"
 
+#include <string.h>
+
 unsigned char local_version = 1;
 unsigned char remote_version = 0;
 
@@ -103,6 +105,9 @@ void service(int fd_in, int fd_out) {
 	} while (1);
 }
 
+static const char *ssh_push_usage =
+	"git-ssh-push [-c] [-t] [-a] [-w ref] commit-id url";
+
 int main(int argc, char **argv)
 {
 	int arg = 1;
@@ -110,18 +115,23 @@ int main(int argc, char **argv)
         char *url;
 	int fd_in, fd_out;
 	const char *prog = getenv("GIT_SSH_PULL") ? : "git-ssh-pull";
+	unsigned char sha1[20];
+	char hex[41];
 
 	while (arg < argc && argv[arg][0] == '-') {
 		if (argv[arg][1] == 'w')
 			arg++;
                 arg++;
         }
-        if (argc < arg + 2) {
-		usage("git-ssh-push [-c] [-t] [-a] [-w ref] commit-id url");
-                return 1;
-        }
+	if (argc < arg + 2)
+		usage(ssh_push_usage);
 	commit_id = argv[arg];
 	url = argv[arg + 1];
+	if (get_sha1(commit_id, sha1))
+		usage(ssh_push_usage);
+	memcpy(hex, sha1_to_hex(sha1), sizeof(hex));
+	argv[arg] = hex;
+
 	if (setup_connection(&fd_in, &fd_out, prog, url, arg, argv + 1))
 		return 1;
 

      parent reply	other threads:[~2005-06-27 18:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-26 19:45 [PATCH] git-ssh-pull: commit-id consistency Sven Verdoolaege
2005-06-26 20:11 ` Daniel Barkalow
2005-06-27 19:03 ` Sven Verdoolaege [this message]

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=20050627210307.A3189@tin.liacs.nl \
    --to=skimo@liacs.nl \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.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).