From: Junio C Hamano Date: Sun, 3 May 2009 23:46:34 +0000 (-0700) Subject: Sync with GIT 1.6.2.5 X-Git-Tag: v1.6.3~15 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3536ae331014c68a25c80b3fb530a19c8dee0f11?ds=inline;hp=-c Sync with GIT 1.6.2.5 --- 3536ae331014c68a25c80b3fb530a19c8dee0f11 diff --combined builtin-fetch-pack.c index cbe5f206f5,1effdc0d6b..87f46c6d07 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@@ -13,6 -13,7 +13,7 @@@ static int transfer_unpack_limit = -1; static int fetch_unpack_limit = -1; static int unpack_limit = 100; + static int prefer_ofs_delta = 1; static struct fetch_pack_args args = { /* .uploadpack = */ "git-upload-pack", }; @@@ -111,7 -112,7 +112,7 @@@ static void mark_common(struct commit * Get the next rev to send, ignoring the common. */ -static const unsigned char* get_rev(void) +static const unsigned char *get_rev(void) { struct commit *commit = NULL; @@@ -200,7 -201,7 +201,7 @@@ static int find_common(int fd[2], unsig (args.use_thin_pack ? " thin-pack" : ""), (args.no_progress ? " no-progress" : ""), (args.include_tag ? " include-tag" : ""), - " ofs-delta"); + (prefer_ofs_delta ? " ofs-delta" : "")); else packet_write(fd[1], "want %s\n", sha1_to_hex(remote)); fetching++; @@@ -216,8 -217,9 +217,8 @@@ if (args.depth > 0) { char line[1024]; unsigned char sha1[20]; - int len; - while ((len = packet_read_line(fd[0], line, sizeof(line)))) { + while (packet_read_line(fd[0], line, sizeof(line))) { if (!prefixcmp(line, "shallow ")) { if (get_sha1_hex(line + 8, sha1)) die("invalid shallow line: %s", line); @@@ -482,7 -484,7 +483,7 @@@ static int sideband_demux(int fd, void { int *xd = data; - return recv_sideband("fetch-pack", xd[0], fd, 2); + return recv_sideband("fetch-pack", xd[0], fd); } static int get_pack(int xd[2], char **pack_lockfile) @@@ -596,6 -598,11 +597,11 @@@ static struct ref *do_fetch_pack(int fd fprintf(stderr, "Server supports side-band\n"); use_sideband = 1; } + if (server_supports("ofs-delta")) { + if (args.verbose) + fprintf(stderr, "Server supports ofs-delta\n"); + } else + prefer_ofs_delta = 0; if (everything_local(&ref, nr_match, match)) { packet_flush(fd[1]); goto all_done; @@@ -605,7 -612,7 +611,7 @@@ /* When cloning, it is not unusual to have * no common commit. */ - fprintf(stderr, "warning: no common commits\n"); + warning("no common commits"); if (get_pack(fd, pack_lockfile)) die("git fetch-pack: fetch failed."); @@@ -648,6 -655,11 +654,11 @@@ static int fetch_pack_config(const cha return 0; } + if (strcmp(var, "repack.usedeltabaseoffset") == 0) { + prefer_ofs_delta = git_config_bool(var, value); + return 0; + } + return git_default_config(var, value, cb); } @@@ -800,13 -812,15 +811,13 @@@ struct ref *fetch_pack(struct fetch_pac int fd; mtime.sec = st.st_mtime; -#ifdef USE_NSEC - mtime.usec = st.st_mtim.usec; -#endif + mtime.nsec = ST_MTIME_NSEC(st); if (stat(shallow, &st)) { if (mtime.sec) die("shallow file was removed during fetch"); } else if (st.st_mtime != mtime.sec #ifdef USE_NSEC - || st.st_mtim.usec != mtime.usec + || ST_MTIME_NSEC(st) != mtime.nsec #endif ) die("shallow file was changed during fetch");