summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-15 21:56:37 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-09-15 21:56:37 (GMT)
commitf71a69ab055c47056d0270b29b8f7455278c2422 (patch)
tree783a7ee17c193bb5baa6f8ebb87e6ce365ae13e6
parent0de68d28d34f915951324b9f387e6e67172e9951 (diff)
downloadgit-f71a69ab055c47056d0270b29b8f7455278c2422.zip
git-f71a69ab055c47056d0270b29b8f7455278c2422.tar.gz
git-f71a69ab055c47056d0270b29b8f7455278c2422.tar.bz2
Be more backward compatible with git-ssh-{push,pull}.
HPA reminded me that these programs knows about the name of the counterpart on the other end and simply symlinking the old name to new name locally would not be enough. Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--.gitignore2
-rw-r--r--Makefile5
-rwxr-xr-xcmd-rename.sh6
-rw-r--r--ssh-fetch.c15
-rw-r--r--ssh-pull.c4
-rw-r--r--ssh-push.c4
-rw-r--r--ssh-upload.c16
7 files changed, 46 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 9fde27f..1d4a411 100644
--- a/.gitignore
+++ b/.gitignore
@@ -78,6 +78,8 @@ git-shortlog
git-show-branch
git-show-index
git-ssh-fetch
+git-ssh-pull
+git-ssh-push
git-ssh-upload
git-status
git-stripspace
diff --git a/Makefile b/Makefile
index e8421cc..b48fe44 100644
--- a/Makefile
+++ b/Makefile
@@ -109,6 +109,9 @@ PROGRAMS = \
git-upload-pack git-verify-pack git-write-tree \
$(SIMPLE_PROGRAMS)
+# Backward compatibility -- to be removed in 0.99.8
+PROGRAMS += git-ssh-pull git-ssh-push
+
PYMODULES = \
gitMergeCommon.py
@@ -250,6 +253,8 @@ git-http-fetch: fetch.o
git-local-fetch: fetch.o
git-ssh-fetch: rsh.o fetch.o
git-ssh-upload: rsh.o
+git-ssh-pull: rsh.o fetch.o
+git-ssh-push: rsh.o
git-http-fetch: LIBS += -lcurl
git-rev-list: LIBS += $(OPENSSL_LIBSSL)
diff --git a/cmd-rename.sh b/cmd-rename.sh
index 1edb037..ada33fb 100755
--- a/cmd-rename.sh
+++ b/cmd-rename.sh
@@ -42,12 +42,14 @@ git-tag-script git-tag
git-verify-tag-script git-verify-tag
git-http-pull git-http-fetch
git-local-pull git-local-fetch
-git-ssh-pull git-ssh-fetch
git-checkout-cache git-checkout-index
git-diff-cache git-diff-index
git-merge-cache git-merge-index
git-update-cache git-update-index
-git-ssh-push git-ssh-upload
git-convert-cache git-convert-objects
git-fsck-cache git-fsck-objects
EOF
+
+# These two are a bit more than symlinks now.
+# git-ssh-push git-ssh-upload
+# git-ssh-pull git-ssh-fetch
diff --git a/ssh-fetch.c b/ssh-fetch.c
index d8f4368..683a1e4 100644
--- a/ssh-fetch.c
+++ b/ssh-fetch.c
@@ -1,3 +1,13 @@
+#ifndef COUNTERPART_ENV_NAME
+#define COUNTERPART_ENV_NAME "GIT_SSH_UPLOAD"
+#endif
+#ifndef COUNTERPART_PROGRAM_NAME
+#define COUNTERPART_PROGRAM_NAME "git-ssh-upload"
+#endif
+#ifndef MY_PROGRAM_NAME
+#define MY_PROGRAM_NAME "git-ssh-fetch"
+#endif
+
#include "cache.h"
#include "commit.h"
#include "rsh.h"
@@ -82,6 +92,9 @@ int fetch_ref(char *ref, unsigned char *sha1)
return 0;
}
+static const char ssh_fetch_usage[] =
+ MY_PROGRAM_NAME
+ " [-c] [-t] [-a] [-v] [-d] [--recover] [-w ref] commit-id url";
int main(int argc, char **argv)
{
char *commit_id;
@@ -110,7 +123,7 @@ int main(int argc, char **argv)
arg++;
}
if (argc < arg + 2) {
- usage("git-ssh-fetch [-c] [-t] [-a] [-v] [-d] [--recover] [-w ref] commit-id url");
+ usage(ssh_fetch_usage);
return 1;
}
commit_id = argv[arg];
diff --git a/ssh-pull.c b/ssh-pull.c
new file mode 100644
index 0000000..868ce4d
--- /dev/null
+++ b/ssh-pull.c
@@ -0,0 +1,4 @@
+#define COUNTERPART_ENV_NAME "GIT_SSH_PUSH"
+#define COUNTERPART_PROGRAM_NAME "git-ssh-push"
+#define MY_PROGRAM_NAME "git-ssh-pull"
+#include "ssh-fetch.c"
diff --git a/ssh-push.c b/ssh-push.c
new file mode 100644
index 0000000..a562df1
--- /dev/null
+++ b/ssh-push.c
@@ -0,0 +1,4 @@
+#define COUNTERPART_ENV_NAME "GIT_SSH_PULL"
+#define COUNTERPART_PROGRAM_NAME "git-ssh-pull"
+#define MY_PROGRAM_NAME "git-ssh-push"
+#include "ssh-upload.c"
diff --git a/ssh-upload.c b/ssh-upload.c
index 10a3687..603abcc 100644
--- a/ssh-upload.c
+++ b/ssh-upload.c
@@ -1,3 +1,13 @@
+#ifndef COUNTERPART_ENV_NAME
+#define COUNTERPART_ENV_NAME "GIT_SSH_FETCH"
+#endif
+#ifndef COUNTERPART_PROGRAM_NAME
+#define COUNTERPART_PROGRAM_NAME "git-ssh-fetch"
+#endif
+#ifndef MY_PROGRAM_NAME
+#define MY_PROGRAM_NAME "git-ssh-upload"
+#endif
+
#include "cache.h"
#include "rsh.h"
#include "refs.h"
@@ -97,7 +107,7 @@ static void service(int fd_in, int fd_out) {
}
static const char ssh_push_usage[] =
- "git-ssh-upload [-c] [-t] [-a] [-w ref] commit-id url";
+ MY_PROGRAM_NAME " [-c] [-t] [-a] [-w ref] commit-id url";
int main(int argc, char **argv)
{
@@ -109,8 +119,8 @@ int main(int argc, char **argv)
unsigned char sha1[20];
char hex[41];
- prog = getenv("GIT_SSH_PULL");
- if (!prog) prog = "git-ssh-fetch";
+ prog = getenv(COUNTERPART_ENV_NAME);
+ if (!prog) prog = COUNTERPART_PROGRAM_NAME;
while (arg < argc && argv[arg][0] == '-') {
if (argv[arg][1] == 'w')
arg++;