summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 972d1bb)
raw | patch | inline | side by side (parent: 972d1bb)
author | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Tue, 7 Jun 2005 21:23:46 +0000 (14:23 -0700) | ||
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | |
Tue, 7 Jun 2005 21:23:46 +0000 (14:23 -0700) |
Allow traditional ssh path specifiers (host:path), and let the user
override the command name on the other end.
With this, I can push to kernel.org with this script
export GIT_SSH_PULL=/home/torvalds/bin/git-ssh-pull
git-ssh-push -a -v -w heads/master heads/master master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
which while not pretty is at least workable.
override the command name on the other end.
With this, I can push to kernel.org with this script
export GIT_SSH_PULL=/home/torvalds/bin/git-ssh-pull
git-ssh-push -a -v -w heads/master heads/master master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
which while not pretty is at least workable.
rsh.c | patch | blob | history | |
rsh.h | patch | blob | history | |
ssh-pull.c | patch | blob | history | |
ssh-push.c | patch | blob | history |
index 3eb9d9160531de91cbccfc1fdea2e9007a9cbfec..8eea1d0233164a5d0d4977593538289dd93f722d 100644 (file)
--- a/rsh.c
+++ b/rsh.c
#define COMMAND_SIZE 4096
-int setup_connection(int *fd_in, int *fd_out, char *remote_prog,
+int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
char *url, int rmt_argc, char **rmt_argv)
{
char *host;
}
host = strstr(url, "//");
- if (!host) {
- return error("Bad URL: %s", url);
+ if (host) {
+ host += 2;
+ path = strchr(host, '/');
+ } else {
+ host = url;
+ path = strchr(host, ':');
}
- host += 2;
- path = strchr(host, '/');
if (!path) {
return error("Bad URL: %s", url);
}
index 97e4f20b2b80662269827d77f3104025143087e7..3b4194239dc419c38910012b129c4c92b72ef8ad 100644 (file)
--- a/rsh.h
+++ b/rsh.h
#ifndef RSH_H
#define RSH_H
-int setup_connection(int *fd_in, int *fd_out, char *remote_prog,
+int setup_connection(int *fd_in, int *fd_out, const char *remote_prog,
char *url, int rmt_argc, char **rmt_argv);
#endif
diff --git a/ssh-pull.c b/ssh-pull.c
index c2cb59a65571fa25a7c0f5334c29d4562f0e2383..27484126dd899cd9a6d4a14d2f41a60fc3a36a52 100644 (file)
--- a/ssh-pull.c
+++ b/ssh-pull.c
char *commit_id;
char *url;
int arg = 1;
+ const char *prog = getenv("GIT_SSH_PUSH") ? : "git-ssh-push";
while (arg < argc && argv[arg][0] == '-') {
if (argv[arg][1] == 't') {
commit_id = argv[arg];
url = argv[arg + 1];
- if (setup_connection(&fd_in, &fd_out, "git-ssh-push", url, arg, argv + 1))
+ if (setup_connection(&fd_in, &fd_out, prog, url, arg, argv + 1))
return 1;
if (get_version())
diff --git a/ssh-push.c b/ssh-push.c
index b67a95b9ab15ecd8bb0332a7d8ef5757b5efa60c..18c0b65d5b18271bc29a0be62f75ee524e51b0e1 100644 (file)
--- a/ssh-push.c
+++ b/ssh-push.c
char *commit_id;
char *url;
int fd_in, fd_out;
+ const char *prog = getenv("GIT_SSH_PULL") ? : "git-ssh-pull";
+
while (arg < argc && argv[arg][0] == '-') {
if (argv[arg][1] == 'w')
arg++;
}
commit_id = argv[arg];
url = argv[arg + 1];
- if (setup_connection(&fd_in, &fd_out, "git-ssh-pull", url, arg, argv + 1))
+ if (setup_connection(&fd_in, &fd_out, prog, url, arg, argv + 1))
return 1;
service(fd_in, fd_out);