From: Junio C Hamano Date: Wed, 9 Sep 2015 21:30:35 +0000 (-0700) Subject: Sync with 2.5.2 X-Git-Tag: v2.6.0-rc2~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f0bc85462332644ecd2386e0f4fdc9948b9f47dc?ds=inline;hp=-c Sync with 2.5.2 --- f0bc85462332644ecd2386e0f4fdc9948b9f47dc diff --combined Documentation/git.txt index 4e5d55be6a,629e62c925..75ffb16d96 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@@ -43,15 -43,17 +43,17 @@@ unreleased) version of Git, that is ava branch of the `git.git` repository. Documentation for older releases are available here: - * link:v2.5.1/git.html[documentation for release 2.5.1] + * link:v2.5.2/git.html[documentation for release 2.5.2] * release notes for + link:RelNotes/2.5.2.txt[2.5.2], link:RelNotes/2.5.1.txt[2.5.1], link:RelNotes/2.5.0.txt[2.5]. - * link:v2.4.8/git.html[documentation for release 2.4.8] + * link:v2.4.9/git.html[documentation for release 2.4.9] * release notes for + link:RelNotes/2.4.9.txt[2.4.9], link:RelNotes/2.4.8.txt[2.4.8], link:RelNotes/2.4.7.txt[2.4.7], link:RelNotes/2.4.6.txt[2.4.6], @@@ -62,9 -64,10 +64,10 @@@ link:RelNotes/2.4.1.txt[2.4.1], link:RelNotes/2.4.0.txt[2.4]. - * link:v2.3.8/git.html[documentation for release 2.3.8] + * link:v2.3.9/git.html[documentation for release 2.3.9] * release notes for + link:RelNotes/2.3.9.txt[2.3.9], link:RelNotes/2.3.8.txt[2.3.8], link:RelNotes/2.3.7.txt[2.3.7], link:RelNotes/2.3.6.txt[2.3.6], @@@ -75,9 -78,10 +78,10 @@@ link:RelNotes/2.3.1.txt[2.3.1], link:RelNotes/2.3.0.txt[2.3]. - * link:v2.2.2/git.html[documentation for release 2.2.2] + * link:v2.2.3/git.html[documentation for release 2.2.3] * release notes for + link:RelNotes/2.2.3.txt[2.2.3], link:RelNotes/2.2.2.txt[2.2.2], link:RelNotes/2.2.1.txt[2.2.1], link:RelNotes/2.2.0.txt[2.2]. @@@ -1011,20 -1015,9 +1015,20 @@@ Unsetting the variable, or setting it t Enables trace messages for all packets coming in or out of a given program. This can help with debugging object negotiation or other protocol issues. Tracing is turned off at a packet - starting with "PACK". + starting with "PACK" (but see 'GIT_TRACE_PACKFILE' below). See 'GIT_TRACE' for available trace output options. +'GIT_TRACE_PACKFILE':: + Enables tracing of packfiles sent or received by a + given program. Unlike other trace output, this trace is + verbatim: no headers, and no quoting of binary data. You almost + certainly want to direct into a file (e.g., + `GIT_TRACE_PACKFILE=/tmp/my.pack`) rather than displaying it on + the terminal or mixing it with other trace output. ++ +Note that this is currently only implemented for the client side +of clones and fetches. + 'GIT_TRACE_PERFORMANCE':: Enables performance related trace messages, e.g. total execution time of each Git command. diff --combined builtin/show-branch.c index c87c46eb38,344ae4ce2a..408ce70307 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@@ -730,7 -730,6 +730,6 @@@ int cmd_show_branch(int ac, const char if (reflog) { struct object_id oid; - char nth_desc[256]; char *ref; int base = 0; unsigned int flags = 0; @@@ -769,6 -768,7 +768,7 @@@ for (i = 0; i < reflog; i++) { char *logmsg; + char *nth_desc; const char *msg; unsigned long timestamp; int tz; @@@ -784,12 -784,13 +784,14 @@@ else msg++; reflog_msg[i] = xstrfmt("(%s) %s", - show_date(timestamp, tz, 1), + show_date(timestamp, tz, + DATE_MODE(RELATIVE)), msg); free(logmsg); - sprintf(nth_desc, "%s@{%d}", *av, base+i); + + nth_desc = xstrfmt("%s@{%d}", *av, base+i); append_ref(nth_desc, &oid, 1); + free(nth_desc); } free(ref); } diff --combined sha1_file.c index 08302f5857,17262e1826..d295a3225a --- a/sha1_file.c +++ b/sha1_file.c @@@ -377,15 -377,12 +377,12 @@@ void read_info_alternates(const char * char *map; size_t mapsz; struct stat st; - const char alt_file_name[] = "info/alternates"; - /* Given that relative_base is no longer than PATH_MAX, - ensure that "path" has enough space to append "/", the - file name, "info/alternates", and a trailing NUL. */ - char path[PATH_MAX + 1 + sizeof alt_file_name]; + char *path; int fd; - sprintf(path, "%s/%s", relative_base, alt_file_name); + path = xstrfmt("%s/info/alternates", relative_base); fd = git_open_noatime(path); + free(path); if (fd < 0) return; if (fstat(fd, &st) || (st.st_size == 0)) { @@@ -404,46 -401,13 +401,46 @@@ void add_to_alternates_file(const char *reference) { struct lock_file *lock = xcalloc(1, sizeof(struct lock_file)); - int fd = hold_lock_file_for_append(lock, git_path("objects/info/alternates"), LOCK_DIE_ON_ERROR); - const char *alt = mkpath("%s\n", reference); - write_or_die(fd, alt, strlen(alt)); - if (commit_lock_file(lock)) - die("could not close alternates file"); - if (alt_odb_tail) - link_alt_odb_entries(alt, strlen(alt), '\n', NULL, 0); + char *alts = git_pathdup("objects/info/alternates"); + FILE *in, *out; + + hold_lock_file_for_update(lock, alts, LOCK_DIE_ON_ERROR); + out = fdopen_lock_file(lock, "w"); + if (!out) + die_errno("unable to fdopen alternates lockfile"); + + in = fopen(alts, "r"); + if (in) { + struct strbuf line = STRBUF_INIT; + int found = 0; + + while (strbuf_getline(&line, in, '\n') != EOF) { + if (!strcmp(reference, line.buf)) { + found = 1; + break; + } + fprintf_or_die(out, "%s\n", line.buf); + } + + strbuf_release(&line); + fclose(in); + + if (found) { + rollback_lock_file(lock); + lock = NULL; + } + } + else if (errno != ENOENT) + die_errno("unable to read alternates file"); + + if (lock) { + fprintf_or_die(out, "%s\n", reference); + if (commit_lock_file(lock)) + die_errno("unable to move new alternates file into place"); + if (alt_odb_tail) + link_alt_odb_entries(reference, strlen(reference), '\n', NULL, 0); + } + free(alts); } int foreach_alt_odb(alt_odb_fn fn, void *cb) @@@ -2944,8 -2908,11 +2941,8 @@@ static void write_sha1_file_prepare(con /* * Move the just written object into its final resting place. - * NEEDSWORK: this should be renamed to finalize_temp_file() as - * "moving" is only a part of what it does, when no patch between - * master to pu changes the call sites of this function. */ -int move_temp_to_file(const char *tmpfile, const char *filename) +int finalize_object_file(const char *tmpfile, const char *filename) { int ret = 0; @@@ -3118,7 -3085,7 +3115,7 @@@ static int write_loose_object(const uns tmp_file, strerror(errno)); } - return move_temp_to_file(tmp_file, filename); + return finalize_object_file(tmp_file, filename); } static int freshen_loose_object(const unsigned char *sha1) diff --combined unpack-trees.c index bb09b1ed27,6e9f75549d..f932e80e86 --- a/unpack-trees.c +++ b/unpack-trees.c @@@ -1029,12 -1029,10 +1029,12 @@@ int unpack_trees(unsigned len, struct t if (!core_apply_sparse_checkout || !o->update) o->skip_sparse_checkout = 1; if (!o->skip_sparse_checkout) { - if (add_excludes_from_file_to_list(git_path("info/sparse-checkout"), "", 0, &el, 0) < 0) + char *sparse = git_pathdup("info/sparse-checkout"); + if (add_excludes_from_file_to_list(sparse, "", 0, &el, 0) < 0) o->skip_sparse_checkout = 1; else o->el = ⪙ + free(sparse); } memset(&o->result, 0, sizeof(o->result)); @@@ -1162,14 -1160,6 +1162,14 @@@ o->src_index = NULL; ret = check_updates(o) ? (-2) : 0; if (o->dst_index) { + if (!ret) { + if (!o->result.cache_tree) + o->result.cache_tree = cache_tree(); + if (!cache_tree_fully_valid(o->result.cache_tree)) + cache_tree_update(&o->result, + WRITE_TREE_SILENT | + WRITE_TREE_REPAIR); + } discard_index(o->dst_index); *o->dst_index = o->result; } else { @@@ -1451,15 -1441,18 +1451,18 @@@ static int verify_absent_1(const struc if (!len) return 0; else if (len > 0) { - char path[PATH_MAX + 1]; - memcpy(path, ce->name, len); - path[len] = 0; + char *path; + int ret; + + path = xmemdupz(ce->name, len); if (lstat(path, &st)) - return error("cannot stat '%s': %s", path, + ret = error("cannot stat '%s': %s", path, strerror(errno)); - - return check_ok_to_remove(path, len, DT_UNKNOWN, NULL, &st, - error_type, o); + else + ret = check_ok_to_remove(path, len, DT_UNKNOWN, NULL, + &st, error_type, o); + free(path); + return ret; } else if (lstat(ce->name, &st)) { if (errno != ENOENT) return error("cannot stat '%s': %s", ce->name,