From: Junio C Hamano Date: Mon, 9 Apr 2012 20:40:32 +0000 (-0700) Subject: Merge branch 'tr/cache-tree' into maint-1.7.8 X-Git-Tag: v1.7.8.6~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6d5c16a90ccf5724fb885d4b8af295c640da33a4?ds=inline;hp=-c Merge branch 'tr/cache-tree' into maint-1.7.8 * tr/cache-tree: t0090: be prepared that 'wc -l' writes leading blanks reset: update cache-tree data when appropriate commit: write cache-tree data when writing index anyway Refactor cache_tree_update idiom from commit Test the current state of the cache-tree optimization Add test-scrap-cache-tree --- 6d5c16a90ccf5724fb885d4b8af295c640da33a4 diff --combined Makefile index 3031be5ee6,b9400bcad3..6295422e10 --- a/Makefile +++ b/Makefile @@@ -57,8 -57,8 +57,8 @@@ all: # # Define NO_STRLCPY if you don't have strlcpy. # -# Define NO_STRTOUMAX if you don't have strtoumax in the C library. -# If your compiler also does not support long long or does not have +# Define NO_STRTOUMAX if you don't have both strtoimax and strtoumax in the +# C library. If your compiler also does not support long long or does not have # strtoull, define NO_STRTOULL. # # Define NO_SETENV if you don't have setenv in the C library. @@@ -435,6 -435,7 +435,7 @@@ TEST_PROGRAMS_NEED_X += test-ctyp TEST_PROGRAMS_NEED_X += test-date TEST_PROGRAMS_NEED_X += test-delta TEST_PROGRAMS_NEED_X += test-dump-cache-tree + TEST_PROGRAMS_NEED_X += test-scrap-cache-tree TEST_PROGRAMS_NEED_X += test-genrandom TEST_PROGRAMS_NEED_X += test-index-version TEST_PROGRAMS_NEED_X += test-line-buffer @@@ -576,7 -577,6 +577,7 @@@ LIB_H += streaming. LIB_H += string-list.h LIB_H += submodule.h LIB_H += tag.h +LIB_H += thread-utils.h LIB_H += transport.h LIB_H += tree.h LIB_H += tree-walk.h @@@ -1479,7 -1479,7 +1480,7 @@@ ifdef NO_STRLCP endif ifdef NO_STRTOUMAX COMPAT_CFLAGS += -DNO_STRTOUMAX - COMPAT_OBJS += compat/strtoumax.o + COMPAT_OBJS += compat/strtoumax.o compat/strtoimax.o endif ifdef NO_STRTOULL COMPAT_CFLAGS += -DNO_STRTOULL diff --combined builtin/commit.c index d8d6dd5eaa,5125841f92..d749cb112a --- a/builtin/commit.c +++ b/builtin/commit.c @@@ -103,7 -103,7 +103,7 @@@ static enum commit_whence whence static int use_editor = 1, include_status = 1; static int show_ignored_in_status; static const char *only_include_assumed; -static struct strbuf message; +static struct strbuf message = STRBUF_INIT; static int null_termination; static enum { @@@ -138,7 -138,7 +138,7 @@@ static struct option builtin_commit_opt OPT_STRING('C', "reuse-message", &use_message, "commit", "reuse message from specified commit"), OPT_STRING(0, "fixup", &fixup_message, "commit", "use autosquash formatted message to fixup specified commit"), OPT_STRING(0, "squash", &squash_message, "commit", "use autosquash formatted message to squash specified commit"), - OPT_BOOLEAN(0, "reset-author", &renew_authorship, "the commit is authored by me now (used with -C-c/--amend)"), + OPT_BOOLEAN(0, "reset-author", &renew_authorship, "the commit is authored by me now (used with -C/-c/--amend)"), OPT_BOOLEAN('s', "signoff", &signoff, "add Signed-off-by:"), OPT_FILENAME('t', "template", &template_file, "use specified template file"), OPT_BOOLEAN('e', "edit", &edit_flag, "force edit of commit"), @@@ -394,6 -394,7 +394,7 @@@ static char *prepare_index(int argc, co fd = hold_locked_index(&index_lock, 1); add_files_to_cache(also ? prefix : NULL, pathspec, 0); refresh_cache_or_die(refresh_flags); + update_main_cache_tree(1); if (write_cache(fd, active_cache, active_nr) || close_lock_file(&index_lock)) die(_("unable to write new_index file")); @@@ -414,6 -415,7 +415,7 @@@ fd = hold_locked_index(&index_lock, 1); refresh_cache_or_die(refresh_flags); if (active_cache_changed) { + update_main_cache_tree(1); if (write_cache(fd, active_cache, active_nr) || commit_locked_index(&index_lock)) die(_("unable to write new_index file")); @@@ -862,10 -864,7 +864,7 @@@ static int prepare_to_commit(const cha */ discard_cache(); read_cache_from(index_file); - if (!active_cache_tree) - active_cache_tree = cache_tree(); - if (cache_tree_update(active_cache_tree, - active_cache, active_nr, 0, 0) < 0) { + if (update_main_cache_tree(0)) { error(_("Error building trees")); return 0; }