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>
Junio C Hamano committed
Sep 15, 2005 at 14:56 UTC
f71a69ab055c47056d0270b29b8f7455278c2422
7 files changed
+46
-6
.gitignore
+2
@@ -78,6 +78,8 @@ git-shortlog
78
git-show-branch
79
git-show-index
80
git-ssh-fetch
81
+git-ssh-pull
82
+git-ssh-push
83
git-ssh-upload
84
git-status
85
git-stripspace
Makefile
+5
@@ -109,6 +109,9 @@ PROGRAMS = \
109
git-upload-pack git-verify-pack git-write-tree \
110
$(SIMPLE_PROGRAMS)
111
112
+# Backward compatibility -- to be removed in 0.99.8
113
+PROGRAMS += git-ssh-pull git-ssh-push
114
+
115
PYMODULES = \
116
gitMergeCommon.py
117
@@ -250,6 +253,8 @@ git-http-fetch: fetch.o
253
git-local-fetch: fetch.o
254
git-ssh-fetch: rsh.o fetch.o
255
git-ssh-upload: rsh.o
256
+git-ssh-pull: rsh.o fetch.o
257
+git-ssh-push: rsh.o
258
259
git-http-fetch: LIBS += -lcurl
260
git-rev-list: LIBS += $(OPENSSL_LIBSSL)
cmd-rename.sh
+4
-2
@@ -42,12 +42,14 @@ git-tag-script git-tag
42
git-verify-tag-script git-verify-tag
43
git-http-pull git-http-fetch
44
git-local-pull git-local-fetch
45
-git-ssh-pull git-ssh-fetch
45
git-checkout-cache git-checkout-index
46
git-diff-cache git-diff-index
47
git-merge-cache git-merge-index
48
git-update-cache git-update-index
50
-git-ssh-push git-ssh-upload
49
git-convert-cache git-convert-objects
50
git-fsck-cache git-fsck-objects
51
EOF
52
+
53
+# These two are a bit more than symlinks now.
54
+# git-ssh-push git-ssh-upload
55
+# git-ssh-pull git-ssh-fetch
ssh-fetch.c
+14
-1
@@ -1,3 +1,13 @@
1
+#ifndef COUNTERPART_ENV_NAME
2
+#define COUNTERPART_ENV_NAME "GIT_SSH_UPLOAD"
3
+#endif
4
+#ifndef COUNTERPART_PROGRAM_NAME
5
+#define COUNTERPART_PROGRAM_NAME "git-ssh-upload"
6
+#endif
7
+#ifndef MY_PROGRAM_NAME
8
+#define MY_PROGRAM_NAME "git-ssh-fetch"
9
+#endif
10
+
11
#include "cache.h"
12
#include "commit.h"
13
#include "rsh.h"
@@ -82,6 +92,9 @@ int fetch_ref(char *ref, unsigned char *sha1)
92
return 0;
93
}
94
95
+static const char ssh_fetch_usage[] =
96
+ MY_PROGRAM_NAME
97
+ " [-c] [-t] [-a] [-v] [-d] [--recover] [-w ref] commit-id url";
98
int main(int argc, char **argv)
99
{
100
char *commit_id;
@@ -110,7 +123,7 @@ int main(int argc, char **argv)
123
arg++;
124
}
125
if (argc < arg + 2) {
113
- usage("git-ssh-fetch [-c] [-t] [-a] [-v] [-d] [--recover] [-w ref] commit-id url");
126
+ usage(ssh_fetch_usage);
127
return 1;
128
}
129
commit_id = argv[arg];
ssh-pull.c
new
+4
@@ -0,0 +1,4 @@
1
+#define COUNTERPART_ENV_NAME "GIT_SSH_PUSH"
2
+#define COUNTERPART_PROGRAM_NAME "git-ssh-push"
3
+#define MY_PROGRAM_NAME "git-ssh-pull"
4
+#include "ssh-fetch.c"
ssh-push.c
new
+4
@@ -0,0 +1,4 @@
1
+#define COUNTERPART_ENV_NAME "GIT_SSH_PULL"
2
+#define COUNTERPART_PROGRAM_NAME "git-ssh-pull"
3
+#define MY_PROGRAM_NAME "git-ssh-push"
4
+#include "ssh-upload.c"
ssh-upload.c
+13
-3
@@ -1,3 +1,13 @@
1
+#ifndef COUNTERPART_ENV_NAME
2
+#define COUNTERPART_ENV_NAME "GIT_SSH_FETCH"
3
+#endif
4
+#ifndef COUNTERPART_PROGRAM_NAME
5
+#define COUNTERPART_PROGRAM_NAME "git-ssh-fetch"
6
+#endif
7
+#ifndef MY_PROGRAM_NAME
8
+#define MY_PROGRAM_NAME "git-ssh-upload"
9
+#endif
10
+
11
#include "cache.h"
12
#include "rsh.h"
13
#include "refs.h"
@@ -97,7 +107,7 @@ static void service(int fd_in, int fd_out) {
107
}
108
109
static const char ssh_push_usage[] =
100
- "git-ssh-upload [-c] [-t] [-a] [-w ref] commit-id url";
110
+ MY_PROGRAM_NAME " [-c] [-t] [-a] [-w ref] commit-id url";
111
112
int main(int argc, char **argv)
113
{
@@ -109,8 +119,8 @@ int main(int argc, char **argv)
119
unsigned char sha1[20];
120
char hex[41];
121
112
- prog = getenv("GIT_SSH_PULL");
113
- if (!prog) prog = "git-ssh-fetch";
122
+ prog = getenv(COUNTERPART_ENV_NAME);
123
+ if (!prog) prog = COUNTERPART_PROGRAM_NAME;
124
while (arg < argc && argv[arg][0] == '-') {
125
if (argv[arg][1] == 'w')
126
arg++;