mirror of
https://github.com/git/git.git
synced 2024-10-31 06:17:56 +01:00
4a62b61939
When a remote repository is deltified, we need to get the objects that a deltified object we want to obtain is based upon. The initial parts of each retrieved SHA1 file is inflated and inspected to see if it is deltified, and its base object is asked from the remote side when it is. Since this partial inflation and inspection has a small performance hit, it can optionally be skipped by giving -d flag to git-*-pull commands. This flag should be used only when the remote repository is known to have no deltified objects. Rsync transport does not have this problem since it fetches everything the remote side has. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
55 lines
1,015 B
C
55 lines
1,015 B
C
#include "cache.h"
|
|
#include "commit.h"
|
|
#include "rsh.h"
|
|
#include "pull.h"
|
|
|
|
static int fd_in;
|
|
static int fd_out;
|
|
|
|
int fetch(unsigned char *sha1)
|
|
{
|
|
int ret;
|
|
write(fd_out, sha1, 20);
|
|
ret = write_sha1_from_fd(sha1, fd_in);
|
|
if (!ret)
|
|
pull_say("got %s\n", sha1_to_hex(sha1));
|
|
return ret;
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
char *commit_id;
|
|
char *url;
|
|
int arg = 1;
|
|
|
|
while (arg < argc && argv[arg][0] == '-') {
|
|
if (argv[arg][1] == 't') {
|
|
get_tree = 1;
|
|
} else if (argv[arg][1] == 'c') {
|
|
get_history = 1;
|
|
} else if (argv[arg][1] == 'd') {
|
|
get_delta = 0;
|
|
} else if (argv[arg][1] == 'a') {
|
|
get_all = 1;
|
|
get_tree = 1;
|
|
get_history = 1;
|
|
} else if (argv[arg][1] == 'v') {
|
|
get_verbosely = 1;
|
|
}
|
|
arg++;
|
|
}
|
|
if (argc < arg + 2) {
|
|
usage("git-rpull [-c] [-t] [-a] [-v] [-d] commit-id url");
|
|
return 1;
|
|
}
|
|
commit_id = argv[arg];
|
|
url = argv[arg + 1];
|
|
|
|
if (setup_connection(&fd_in, &fd_out, "git-rpush", url, arg, argv + 1))
|
|
return 1;
|
|
|
|
if (pull(commit_id))
|
|
return 1;
|
|
|
|
return 0;
|
|
}
|