1 diff a/Documentation/git-rpull.txt b/Documentation/git-rpull.txt
2 --- a/Documentation/git-rpull.txt
11 -git-rpull - Pulls from a remote repository over ssh connection
17 -'git-rpull' [-c] [-t] [-a] [-d] [-v] [--recover] commit-id url
21 -Pulls from a remote repository over ssh connection, invoking git-rpush on
27 - Get the commit objects.
29 - Get trees associated with the commit objects.
31 - Get all the objects.
33 - Do not check for delta base objects (use this option
34 - only when you know the remote repository is not
37 - Check dependency of deltified object more carefully than
38 - usual, to recover after earlier pull that was interrupted.
40 - Report what is downloaded.
45 -Written by Linus Torvalds <torvalds@osdl.org>
49 -Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
53 -Part of the link:git.html[git] suite
55 diff a/Documentation/git-rpush.txt b/Documentation/git-rpush.txt
56 --- a/Documentation/git-rpush.txt
65 -git-rpush - Helper "server-side" program used by git-rpull
74 -Helper "server-side" program used by git-rpull.
79 -Written by Linus Torvalds <torvalds@osdl.org>
83 -Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
87 -Part of the link:git.html[git] suite
89 diff a/Documentation/git-ssh-pull.txt b/Documentation/git-ssh-pull.txt
91 +++ b/Documentation/git-ssh-pull.txt
99 +git-ssh-pull - Pulls from a remote repository over ssh connection
105 +'git-ssh-pull' [-c] [-t] [-a] [-d] [-v] [--recover] commit-id url
109 +Pulls from a remote repository over ssh connection, invoking git-ssh-push
115 + Get the commit objects.
117 + Get trees associated with the commit objects.
119 + Get all the objects.
121 + Do not check for delta base objects (use this option
122 + only when you know the remote repository is not
125 + Check dependency of deltified object more carefully than
126 + usual, to recover after earlier pull that was interrupted.
128 + Report what is downloaded.
133 +Written by Linus Torvalds <torvalds@osdl.org>
137 +Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
141 +Part of the link:git.html[git] suite
143 diff a/Documentation/git-ssh-push.txt b/Documentation/git-ssh-push.txt
145 +++ b/Documentation/git-ssh-push.txt
153 +git-ssh-push - Helper "server-side" program used by git-ssh-pull
162 +Helper "server-side" program used by git-ssh-pull.
167 +Written by Linus Torvalds <torvalds@osdl.org>
171 +Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
175 +Part of the link:git.html[git] suite
177 diff a/Documentation/git.txt b/Documentation/git.txt
178 --- a/Documentation/git.txt
179 +++ b/Documentation/git.txt
180 @@ -148,7 +148,7 @@ link:git-resolve-script.html[git-resolve
181 link:git-tag-script.html[git-tag-script]::
182 An example script to create a tag object signed with GPG
184 -link:git-rpull.html[git-rpull]::
185 +link:git-ssh-pull.html[git-ssh-pull]::
186 Pulls from a remote repository over ssh connection
189 @@ -156,8 +156,8 @@ Interogators:
190 link:git-diff-helper.html[git-diff-helper]::
191 Generates patch format output for git-diff-*
193 -link:git-rpush.html[git-rpush]::
194 - Helper "server-side" program used by git-rpull
195 +link:git-ssh-push.html[git-ssh-push]::
196 + Helper "server-side" program used by git-ssh-pull
200 diff a/Makefile b/Makefile
203 @@ -30,7 +30,7 @@ PROG= git-update-cache git-diff-files
204 git-checkout-cache git-diff-tree git-rev-tree git-ls-files \
205 git-check-files git-ls-tree git-merge-base git-merge-cache \
206 git-unpack-file git-export git-diff-cache git-convert-cache \
207 - git-http-pull git-rpush git-rpull git-rev-list git-mktag \
208 + git-http-pull git-ssh-push git-ssh-pull git-rev-list git-mktag \
209 git-diff-helper git-tar-tree git-local-pull git-write-blob \
210 git-get-tar-commit-id git-mkdelta git-apply git-stripspace
212 @@ -105,8 +105,8 @@ git-diff-cache: diff-cache.c
213 git-convert-cache: convert-cache.c
214 git-http-pull: http-pull.c pull.c
215 git-local-pull: local-pull.c pull.c
217 -git-rpull: rsh.c pull.c
219 +git-ssh-pull: rsh.c pull.c
220 git-rev-list: rev-list.c
222 git-diff-helper: diff-helper.c
223 diff a/rpull.c b/rpull.c
235 -static unsigned char remote_version = 0;
236 -static unsigned char local_version = 1;
238 -int fetch(unsigned char *sha1)
241 - signed char remote;
243 - if (has_sha1_file(sha1))
245 - write(fd_out, &type, 1);
246 - write(fd_out, sha1, 20);
247 - if (read(fd_in, &remote, 1) < 1)
251 - ret = write_sha1_from_fd(sha1, fd_in);
253 - pull_say("got %s\n", sha1_to_hex(sha1));
257 -int get_version(void)
260 - write(fd_out, &type, 1);
261 - write(fd_out, &local_version, 1);
262 - if (read(fd_in, &remote_version, 1) < 1) {
263 - return error("Couldn't read version from remote end");
268 -int main(int argc, char **argv)
274 - while (arg < argc && argv[arg][0] == '-') {
275 - if (argv[arg][1] == 't') {
277 - } else if (argv[arg][1] == 'c') {
279 - } else if (argv[arg][1] == 'd') {
281 - } else if (!strcmp(argv[arg], "--recover")) {
283 - } else if (argv[arg][1] == 'a') {
287 - } else if (argv[arg][1] == 'v') {
292 - if (argc < arg + 2) {
293 - usage("git-rpull [-c] [-t] [-a] [-v] [-d] [--recover] commit-id url");
296 - commit_id = argv[arg];
297 - url = argv[arg + 1];
299 - if (setup_connection(&fd_in, &fd_out, "git-rpush", url, arg, argv + 1))
305 - if (pull(commit_id))
310 diff a/rpush.c b/rpush.c
316 -#include <sys/socket.h>
319 -unsigned char local_version = 1;
320 -unsigned char remote_version = 0;
322 -int serve_object(int fd_in, int fd_out) {
326 - unsigned long objsize;
328 - signed char remote;
330 - size = read(fd_in, sha1 + posn, 20 - posn);
332 - perror("git-rpush: read ");
338 - } while (posn < 20);
340 - /* fprintf(stderr, "Serving %s\n", sha1_to_hex(sha1)); */
343 - buf = map_sha1_file(sha1, &objsize);
346 - fprintf(stderr, "git-rpush: could not find %s\n",
347 - sha1_to_hex(sha1));
351 - write(fd_out, &remote, 1);
358 - size = write(fd_out, buf + posn, objsize - posn);
361 - fprintf(stderr, "git-rpush: write closed");
363 - perror("git-rpush: write ");
368 - } while (posn < objsize);
372 -int serve_version(int fd_in, int fd_out)
374 - if (read(fd_in, &remote_version, 1) < 1)
376 - write(fd_out, &local_version, 1);
380 -void service(int fd_in, int fd_out) {
384 - retval = read(fd_in, &type, 1);
387 - perror("rpush: read ");
390 - if (type == 'v' && serve_version(fd_in, fd_out))
392 - if (type == 'o' && serve_object(fd_in, fd_out))
397 -int main(int argc, char **argv)
403 - while (arg < argc && argv[arg][0] == '-') {
406 - if (argc < arg + 2) {
407 - usage("git-rpush [-c] [-t] [-a] commit-id url");
410 - commit_id = argv[arg];
411 - url = argv[arg + 1];
412 - if (setup_connection(&fd_in, &fd_out, "git-rpull", url, arg, argv + 1))
415 - service(fd_in, fd_out);
418 diff a/ssh-pull.c b/ssh-pull.c
430 +static unsigned char remote_version = 0;
431 +static unsigned char local_version = 1;
433 +int fetch(unsigned char *sha1)
436 + signed char remote;
438 + if (has_sha1_file(sha1))
440 + write(fd_out, &type, 1);
441 + write(fd_out, sha1, 20);
442 + if (read(fd_in, &remote, 1) < 1)
446 + ret = write_sha1_from_fd(sha1, fd_in);
448 + pull_say("got %s\n", sha1_to_hex(sha1));
452 +int get_version(void)
455 + write(fd_out, &type, 1);
456 + write(fd_out, &local_version, 1);
457 + if (read(fd_in, &remote_version, 1) < 1) {
458 + return error("Couldn't read version from remote end");
463 +int main(int argc, char **argv)
469 + while (arg < argc && argv[arg][0] == '-') {
470 + if (argv[arg][1] == 't') {
472 + } else if (argv[arg][1] == 'c') {
474 + } else if (argv[arg][1] == 'd') {
476 + } else if (!strcmp(argv[arg], "--recover")) {
478 + } else if (argv[arg][1] == 'a') {
482 + } else if (argv[arg][1] == 'v') {
487 + if (argc < arg + 2) {
488 + usage("git-ssh-pull [-c] [-t] [-a] [-v] [-d] [--recover] commit-id url");
491 + commit_id = argv[arg];
492 + url = argv[arg + 1];
494 + if (setup_connection(&fd_in, &fd_out, "git-ssh-push", url, arg, argv + 1))
500 + if (pull(commit_id))
505 diff a/ssh-push.c b/ssh-push.c
511 +#include <sys/socket.h>
514 +unsigned char local_version = 1;
515 +unsigned char remote_version = 0;
517 +int serve_object(int fd_in, int fd_out) {
521 + unsigned long objsize;
523 + signed char remote;
525 + size = read(fd_in, sha1 + posn, 20 - posn);
527 + perror("git-ssh-push: read ");
533 + } while (posn < 20);
535 + /* fprintf(stderr, "Serving %s\n", sha1_to_hex(sha1)); */
538 + buf = map_sha1_file(sha1, &objsize);
541 + fprintf(stderr, "git-ssh-push: could not find %s\n",
542 + sha1_to_hex(sha1));
546 + write(fd_out, &remote, 1);
553 + size = write(fd_out, buf + posn, objsize - posn);
556 + fprintf(stderr, "git-ssh-push: write closed");
558 + perror("git-ssh-push: write ");
563 + } while (posn < objsize);
567 +int serve_version(int fd_in, int fd_out)
569 + if (read(fd_in, &remote_version, 1) < 1)
571 + write(fd_out, &local_version, 1);
575 +void service(int fd_in, int fd_out) {
579 + retval = read(fd_in, &type, 1);
582 + perror("git-ssh-push: read ");
585 + if (type == 'v' && serve_version(fd_in, fd_out))
587 + if (type == 'o' && serve_object(fd_in, fd_out))
592 +int main(int argc, char **argv)
598 + while (arg < argc && argv[arg][0] == '-') {
601 + if (argc < arg + 2) {
602 + usage("git-ssh-push [-c] [-t] [-a] commit-id url");
605 + commit_id = argv[arg];
606 + url = argv[arg + 1];
607 + if (setup_connection(&fd_in, &fd_out, "git-ssh-pull", url, arg, argv + 1))
610 + service(fd_in, fd_out);