gitweb.git
add: free leaked pathspec after add_files_to_cache()Jeff King Tue, 5 Sep 2017 13:04:10 +0000 (09:04 -0400)

add: free leaked pathspec after add_files_to_cache()

After run_diff_files, we throw away the rev_info struct,
including the pathspec that we copied into it, leaking the
memory. this is probably not a big deal in practice. We
usually only run this once per process, and the leak is
proportional to the pathspec list we're already holding in
memory.

But it's still a leak, and it pollutes leak-checker output,
making it harder to find important leaks.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib: set LSAN_OPTIONS to abort by defaultJeff King Tue, 5 Sep 2017 13:04:04 +0000 (09:04 -0400)

test-lib: set LSAN_OPTIONS to abort by default

We already set ASAN_OPTIONS to abort if it finds any errors.
As we start to experiment with LSAN, the leak sanitizer,
it's convenient if we give it the same treatment.

Note that ASAN is actually a superset of LSAN and can do the
leak detection itself. So this only has an effect if you
specifically build with "make SANITIZE=leak" (leak detection
but not the rest of ASAN). Building with just LSAN results
in a build that runs much faster. That makes the
build-test-fix cycle more pleasant.

In the long run, once we've fixed or suppressed all the
leaks, it will probably be worth turning leak-detection on
for ASAN and just using that (to check both leaks _and_
memory errors in a single test run). But there's still a lot
of work before we get there.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib: --valgrind should not override --verbose-logJeff King Tue, 5 Sep 2017 13:03:54 +0000 (09:03 -0400)

test-lib: --valgrind should not override --verbose-log

The --verbose test option cannot be used with test harnesses
like "prove". Instead, you must use --verbose-log.

Since the --valgrind option implies --verbose, that means
that it cannot be used with prove. I.e., this does not work:

prove t0000-basic.sh :: --valgrind

You'd think it could be fixed by doing:

prove t0000-basic.sh :: --valgrind --verbose-log

but that doesn't work either, because the implied --verbose
takes precedence over --verbose-log. If the user has given
us a specific option, we should prefer that.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

The sixth batch post 2.14Junio C Hamano Wed, 6 Sep 2017 04:15:24 +0000 (13:15 +0900)

The sixth batch post 2.14

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'rs/archive-excluded-directory'Junio C Hamano Wed, 6 Sep 2017 04:11:25 +0000 (13:11 +0900)

Merge branch 'rs/archive-excluded-directory'

"git archive" did not work well with pathspecs and the
export-ignore attribute.

* rs/archive-excluded-directory:
archive: don't queue excluded directories
archive: factor out helper functions for handling attributes
t5001: add tests for export-ignore attributes and exclude pathspecs

Merge branch 'po/read-graft-line'Junio C Hamano Wed, 6 Sep 2017 04:11:25 +0000 (13:11 +0900)

Merge branch 'po/read-graft-line'

Conversion from uchar[20] to struct object_id continues; this is to
ensure that we do not assume sizeof(struct object_id) is the same
as the length of SHA-1 hash (or length of longest hash we support).

* po/read-graft-line:
commit: rewrite read_graft_line
commit: allocate array using object_id size
commit: replace the raw buffer with strbuf in read_graft_line
sha1_file: fix definition of null_sha1

Merge branch 'ks/branch-set-upstream'Junio C Hamano Wed, 6 Sep 2017 04:11:24 +0000 (13:11 +0900)

Merge branch 'ks/branch-set-upstream'

"branch --set-upstream" that has been deprecated in Git 1.8 has
finally been retired.

* ks/branch-set-upstream:
branch: quote branch/ref names to improve readability
builtin/branch: stop supporting the "--set-upstream" option
t3200: cleanup cruft of a test

The fifth batch post 2.14Junio C Hamano Sun, 27 Aug 2017 06:00:01 +0000 (23:00 -0700)

The fifth batch post 2.14

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'mg/killed-merge'Junio C Hamano Sun, 27 Aug 2017 05:55:10 +0000 (22:55 -0700)

Merge branch 'mg/killed-merge'

Killing "git merge --edit" before the editor returns control left
the repository in a state with MERGE_MSG but without MERGE_HEAD,
which incorrectly tells the subsequent "git commit" that there was
a squash merge in progress. This has been fixed.

* mg/killed-merge:
merge: save merge state earlier
merge: split write_merge_state in two
merge: clarify call chain
Documentation/git-merge: explain --continue

Merge branch 'jt/packmigrate'Junio C Hamano Sun, 27 Aug 2017 05:55:09 +0000 (22:55 -0700)

Merge branch 'jt/packmigrate'

Code movement to make it easier to hack later.

* jt/packmigrate: (23 commits)
pack: move for_each_packed_object()
pack: move has_pack_index()
pack: move has_sha1_pack()
pack: move find_pack_entry() and make it global
pack: move find_sha1_pack()
pack: move find_pack_entry_one(), is_pack_valid()
pack: move check_pack_index_ptr(), nth_packed_object_offset()
pack: move nth_packed_object_{sha1,oid}
pack: move clear_delta_base_cache(), packed_object_info(), unpack_entry()
pack: move unpack_object_header()
pack: move get_size_from_delta()
pack: move unpack_object_header_buffer()
pack: move {,re}prepare_packed_git and approximate_object_count
pack: move install_packed_git()
pack: move add_packed_git()
pack: move unuse_pack()
pack: move use_pack()
pack: move pack-closing functions
pack: move release_pack_memory()
pack: move open_pack_index(), parse_pack_index()
...

Merge branch 'mh/ref-lock-entry'Junio C Hamano Sun, 27 Aug 2017 05:55:09 +0000 (22:55 -0700)

Merge branch 'mh/ref-lock-entry'

The code to acquire a lock on a reference (e.g. while accepting a
push from a client) used to immediately fail when the reference is
already locked---now it waits for a very short while and retries,
which can make it succeed if the lock holder was holding it during
a read-only operation.

* mh/ref-lock-entry:
refs: retry acquiring reference locks for 100ms

Merge branch 'jt/doc-pack-objects-fix'Junio C Hamano Sun, 27 Aug 2017 05:55:09 +0000 (22:55 -0700)

Merge branch 'jt/doc-pack-objects-fix'

Doc updates.

* jt/doc-pack-objects-fix:
Doc: clarify that pack-objects makes packs, plural

Merge branch 'jc/cutoff-config'Junio C Hamano Sun, 27 Aug 2017 05:55:08 +0000 (22:55 -0700)

Merge branch 'jc/cutoff-config'

"[gc] rerereResolved = 5.days" used to be invalid, as the variable
is defined to take an integer counting the number of days. It now
is allowed.

* jc/cutoff-config:
rerere: allow approxidate in gc.rerereResolved/gc.rerereUnresolved
rerere: represent time duration in timestamp_t internally
t4200: parameterize "rerere gc" custom expiry test
t4200: gather "rerere gc" together
t4200: make "rerere gc" test more robust
t4200: give us a clean slate after "rerere gc" tests

Merge branch 'kw/write-index-reduce-alloc'Junio C Hamano Sun, 27 Aug 2017 05:55:08 +0000 (22:55 -0700)

Merge branch 'kw/write-index-reduce-alloc'

We used to spend more than necessary cycles allocating and freeing
piece of memory while writing each index entry out. This has been
optimized.

* kw/write-index-reduce-alloc:
read-cache: avoid allocating every ondisk entry when writing
read-cache: fix memory leak in do_write_index
perf: add test for writing the index

Merge branch 'bw/submodule-config-cleanup'Junio C Hamano Sun, 27 Aug 2017 05:55:07 +0000 (22:55 -0700)

Merge branch 'bw/submodule-config-cleanup'

Code clean-up to avoid mixing values read from the .gitmodules file
and values read from the .git/config file.

* bw/submodule-config-cleanup:
submodule: remove gitmodules_config
unpack-trees: improve loading of .gitmodules
submodule-config: lazy-load a repository's .gitmodules file
submodule-config: move submodule-config functions to submodule-config.c
submodule-config: remove support for overlaying repository config
diff: stop allowing diff to have submodules configured in .git/config
submodule: remove submodule_config callback routine
unpack-trees: don't respect submodule.update
submodule: don't rely on overlayed config when setting diffopts
fetch: don't overlay config with submodule-config
submodule--helper: don't overlay config in update-clone
submodule--helper: don't overlay config in remote_submodule_branch
add, reset: ensure submodules can be added or reset
submodule: don't use submodule_from_name
t7411: check configuration parsing errors

Merge branch 'js/gitweb-raw-blob-link-in-history'Junio C Hamano Sun, 27 Aug 2017 05:55:07 +0000 (22:55 -0700)

Merge branch 'js/gitweb-raw-blob-link-in-history'

"gitweb" shows a link to visit the 'raw' contents of blbos in the
history overview page.

* js/gitweb-raw-blob-link-in-history:
gitweb: add 'raw' blob_plain link in history overview

Merge branch 'po/object-id'Junio C Hamano Sun, 27 Aug 2017 05:55:06 +0000 (22:55 -0700)

Merge branch 'po/object-id'

* po/object-id:
sha1_file: convert index_stream to struct object_id
sha1_file: convert hash_sha1_file_literally to struct object_id
sha1_file: convert index_fd to struct object_id
sha1_file: convert index_path to struct object_id
read-cache: convert to struct object_id
builtin/hash-object: convert to struct object_id

Merge branch 'jn/vcs-svn-cleanup'Junio C Hamano Sun, 27 Aug 2017 05:55:06 +0000 (22:55 -0700)

Merge branch 'jn/vcs-svn-cleanup'

Code clean-up.

* jn/vcs-svn-cleanup:
vcs-svn: move remaining repo_tree functions to fast_export.h
vcs-svn: remove repo_delete wrapper function
vcs-svn: remove custom mode constants
vcs-svn: remove more unused prototypes and declarations

Merge branch 'bc/vcs-svn-cleanup'Junio C Hamano Sun, 27 Aug 2017 05:55:05 +0000 (22:55 -0700)

Merge branch 'bc/vcs-svn-cleanup'

Code clean-up.

* bc/vcs-svn-cleanup:
vcs-svn: rename repo functions to "svn_repo"
vcs-svn: remove unused prototypes

Merge branch 'tb/apply-with-crlf'Junio C Hamano Sun, 27 Aug 2017 05:55:05 +0000 (22:55 -0700)

Merge branch 'tb/apply-with-crlf'

"git apply" that is used as a better "patch -p1" failed to apply a
taken from a file with CRLF line endings to a file with CRLF line
endings. The root cause was because it misused convert_to_git()
that tried to do "safe-crlf" processing by looking at the index
entry at the same path, which is a nonsense---in that mode, "apply"
is not working on the data in (or derived from) the index at all.
This has been fixed.

* tb/apply-with-crlf:
apply: file commited with CRLF should roundtrip diff and apply
convert: add SAFE_CRLF_KEEP_CRLF

Merge branch 'jt/stash-tests'Junio C Hamano Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)

Merge branch 'jt/stash-tests'

Test update to improve coverage for "git stash" operations.

* jt/stash-tests:
stash: add a test for stashing in a detached state
stash: add a test for when apply fails during stash branch
stash: add a test for stash create with no files

Merge branch 'jk/trailers-parse'Junio C Hamano Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)

Merge branch 'jk/trailers-parse'

"git interpret-trailers" has been taught a "--parse" and a few
other options to make it easier for scripts to grab existing
trailer lines from a commit log message.

* jk/trailers-parse:
doc/interpret-trailers: fix "the this" typo
pretty: support normalization options for %(trailers)
t4205: refactor %(trailers) tests
pretty: move trailer formatting to trailer.c
interpret-trailers: add --parse convenience option
interpret-trailers: add an option to unfold values
interpret-trailers: add an option to show only existing trailers
interpret-trailers: add an option to show only the trailers
trailer: put process_trailers() options into a struct

Merge branch 'pb/trailers-from-command-line'Junio C Hamano Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)

Merge branch 'pb/trailers-from-command-line'

"git interpret-trailers" learned to take the trailer specifications
from the command line that overrides the configured values.

* pb/trailers-from-command-line:
interpret-trailers: fix documentation typo
interpret-trailers: add options for actions
trailers: introduce struct new_trailer_item
trailers: export action enums and corresponding lookup functions

Merge branch 'jt/diff-color-move-fix'Junio C Hamano Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)

Merge branch 'jt/diff-color-move-fix'

A handful of bugfixes and an improvement to "diff --color-moved".

* jt/diff-color-move-fix:
diff: define block by number of alphanumeric chars
diff: respect MIN_BLOCK_LENGTH for last block
diff: avoid redundantly clearing a flag

Merge branch 'sb/diff-color-move'Junio C Hamano Sun, 27 Aug 2017 05:55:03 +0000 (22:55 -0700)

Merge branch 'sb/diff-color-move'

"git diff" has been taught to optionally paint new lines that are
the same as deleted lines elsewhere differently from genuinely new
lines.

* sb/diff-color-move: (25 commits)
diff: document the new --color-moved setting
diff.c: add dimming to moved line detection
diff.c: color moved lines differently, plain mode
diff.c: color moved lines differently
diff.c: buffer all output if asked to
diff.c: emit_diff_symbol learns about DIFF_SYMBOL_SUMMARY
diff.c: emit_diff_symbol learns about DIFF_SYMBOL_STAT_SEP
diff.c: convert word diffing to use emit_diff_symbol
diff.c: convert show_stats to use emit_diff_symbol
diff.c: convert emit_binary_diff_body to use emit_diff_symbol
submodule.c: migrate diff output to use emit_diff_symbol
diff.c: emit_diff_symbol learns DIFF_SYMBOL_REWRITE_DIFF
diff.c: emit_diff_symbol learns about DIFF_SYMBOL_BINARY_FILES
diff.c: emit_diff_symbol learns DIFF_SYMBOL_HEADER
diff.c: emit_diff_symbol learns DIFF_SYMBOL_FILEPAIR_{PLUS, MINUS}
diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_INCOMPLETE
diff.c: emit_diff_symbol learns DIFF_SYMBOL_WORDS[_PORCELAIN]
diff.c: migrate emit_line_checked to use emit_diff_symbol
diff.c: emit_diff_symbol learns DIFF_SYMBOL_NO_LF_EOF
diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_FRAGINFO
...

The fourth batch post 2.14Junio C Hamano Thu, 24 Aug 2017 17:37:44 +0000 (10:37 -0700)

The fourth batch post 2.14

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jk/doc-the-this'Junio C Hamano Thu, 24 Aug 2017 17:20:03 +0000 (10:20 -0700)

Merge branch 'jk/doc-the-this'

Doc clean-up.

* jk/doc-the-this:
doc: fix typo in sendemail.identity

Merge branch 'rs/commit-h-single-parent-cleanup'Junio C Hamano Thu, 24 Aug 2017 17:20:03 +0000 (10:20 -0700)

Merge branch 'rs/commit-h-single-parent-cleanup'

Code clean-up.

* rs/commit-h-single-parent-cleanup:
commit: remove unused inline function single_parent()

Merge branch 'jc/simplify-progress'Junio C Hamano Thu, 24 Aug 2017 17:20:02 +0000 (10:20 -0700)

Merge branch 'jc/simplify-progress'

The API to start showing progress meter after a short delay has
been simplified.

* jc/simplify-progress:
progress: simplify "delayed" progress API

Merge branch 'tc/curl-with-backports'Junio C Hamano Thu, 24 Aug 2017 17:20:02 +0000 (10:20 -0700)

Merge branch 'tc/curl-with-backports'

Updates to the HTTP layer we made recently unconditionally used
features of libCurl without checking the existence of them, causing
compilation errors, which has been fixed. Also migrate the code to
check feature macros, not version numbers, to cope better with
libCurl that vendor ships with backported features.

* tc/curl-with-backports:
http: use a feature check to enable GSSAPI delegation control
http: fix handling of missing CURLPROTO_*

Merge branch 'cc/subprocess-handshake-missing-capabilities'Junio C Hamano Thu, 24 Aug 2017 17:20:02 +0000 (10:20 -0700)

Merge branch 'cc/subprocess-handshake-missing-capabilities'

When handshake with a subprocess filter notices that the process
asked for an unknown capability, Git did not report what program
the offending subprocess was running. This has been corrected.

* cc/subprocess-handshake-missing-capabilities:
sub-process: print the cmd when a capability is unsupported

Merge branch 'rs/object-id'Junio C Hamano Thu, 24 Aug 2017 17:20:02 +0000 (10:20 -0700)

Merge branch 'rs/object-id'

Conversion from uchar[20] to struct object_id continues.

* rs/object-id:
tree-walk: convert fill_tree_descriptor() to object_id

Merge branch 'lg/merge-signoff'Junio C Hamano Thu, 24 Aug 2017 17:20:01 +0000 (10:20 -0700)

Merge branch 'lg/merge-signoff'

"git merge" learned a "--signoff" option to add the Signed-off-by:
trailer with the committer's name.

* lg/merge-signoff:
merge: add a --signoff flag

pack: move for_each_packed_object()Jonathan Tan Fri, 18 Aug 2017 22:20:38 +0000 (15:20 -0700)

pack: move for_each_packed_object()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move has_pack_index()Jonathan Tan Fri, 18 Aug 2017 22:20:37 +0000 (15:20 -0700)

pack: move has_pack_index()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move has_sha1_pack()Jonathan Tan Fri, 18 Aug 2017 22:20:36 +0000 (15:20 -0700)

pack: move has_sha1_pack()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move find_pack_entry() and make it globalJonathan Tan Fri, 18 Aug 2017 22:20:35 +0000 (15:20 -0700)

pack: move find_pack_entry() and make it global

This function needs to be global as it is used by sha1_file.c and will
be used by packfile.c.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move find_sha1_pack()Jonathan Tan Fri, 18 Aug 2017 22:20:34 +0000 (15:20 -0700)

pack: move find_sha1_pack()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move find_pack_entry_one(), is_pack_valid()Jonathan Tan Fri, 18 Aug 2017 22:20:33 +0000 (15:20 -0700)

pack: move find_pack_entry_one(), is_pack_valid()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move check_pack_index_ptr(), nth_packed_object_of... Jonathan Tan Fri, 18 Aug 2017 22:20:32 +0000 (15:20 -0700)

pack: move check_pack_index_ptr(), nth_packed_object_offset()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move nth_packed_object_{sha1,oid}Jonathan Tan Fri, 18 Aug 2017 22:20:31 +0000 (15:20 -0700)

pack: move nth_packed_object_{sha1,oid}

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move clear_delta_base_cache(), packed_object_info... Jonathan Tan Fri, 18 Aug 2017 22:20:30 +0000 (15:20 -0700)

pack: move clear_delta_base_cache(), packed_object_info(), unpack_entry()

Both sha1_file.c and packfile.c now need read_object(), so a copy of
read_object() was created in packfile.c.

This patch makes both mark_bad_packed_object() and has_packed_and_bad()
global. Unlike most of the other patches in this series, these 2
functions need to remain global.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move unpack_object_header()Jonathan Tan Fri, 18 Aug 2017 22:20:29 +0000 (15:20 -0700)

pack: move unpack_object_header()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move get_size_from_delta()Jonathan Tan Fri, 18 Aug 2017 22:20:28 +0000 (15:20 -0700)

pack: move get_size_from_delta()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move unpack_object_header_buffer()Jonathan Tan Fri, 18 Aug 2017 22:20:27 +0000 (15:20 -0700)

pack: move unpack_object_header_buffer()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move {,re}prepare_packed_git and approximate_obje... Jonathan Tan Fri, 18 Aug 2017 22:20:26 +0000 (15:20 -0700)

pack: move {,re}prepare_packed_git and approximate_object_count

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move install_packed_git()Jonathan Tan Fri, 18 Aug 2017 22:20:25 +0000 (15:20 -0700)

pack: move install_packed_git()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move add_packed_git()Jonathan Tan Fri, 18 Aug 2017 22:20:24 +0000 (15:20 -0700)

pack: move add_packed_git()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move unuse_pack()Jonathan Tan Fri, 18 Aug 2017 22:20:23 +0000 (15:20 -0700)

pack: move unuse_pack()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move use_pack()Jonathan Tan Fri, 18 Aug 2017 22:20:22 +0000 (15:20 -0700)

pack: move use_pack()

The function open_packed_git() needs to be temporarily made global. Its
scope will be restored to static in a subsequent commit.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move pack-closing functionsJonathan Tan Fri, 18 Aug 2017 22:20:21 +0000 (15:20 -0700)

pack: move pack-closing functions

The function close_pack_fd() needs to be temporarily made global. Its
scope will be restored to static in a subsequent commit.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move release_pack_memory()Jonathan Tan Fri, 18 Aug 2017 22:20:20 +0000 (15:20 -0700)

pack: move release_pack_memory()

The function unuse_one_window() needs to be temporarily made global. Its
scope will be restored to static in a subsequent commit.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move open_pack_index(), parse_pack_index()Jonathan Tan Fri, 18 Aug 2017 22:20:19 +0000 (15:20 -0700)

pack: move open_pack_index(), parse_pack_index()

alloc_packed_git() in packfile.c is duplicated from sha1_file.c. In a
subsequent commit, alloc_packed_git() will be removed from sha1_file.c.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move pack_report()Jonathan Tan Fri, 18 Aug 2017 22:20:18 +0000 (15:20 -0700)

pack: move pack_report()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move static state variablesJonathan Tan Fri, 18 Aug 2017 22:20:17 +0000 (15:20 -0700)

pack: move static state variables

sha1_file.c declares some static variables that store packfile-related
state. Move them to packfile.c.

They are temporarily made global, but subsequent commits will restore
their scope back to static.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack: move pack name-related functionsJonathan Tan Fri, 18 Aug 2017 22:20:16 +0000 (15:20 -0700)

pack: move pack name-related functions

Currently, sha1_file.c and cache.h contain many functions, both related
to and unrelated to packfiles. This makes both files very large and
causes an unclear separation of concerns.

Create a new file, packfile.c, to hold all packfile-related functions
currently in sha1_file.c. It has a corresponding header packfile.h.

In this commit, the pack name-related functions are moved. Subsequent
commits will move the other functions.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Wed, 23 Aug 2017 21:36:38 +0000 (14:36 -0700)

Sync with maint

* maint:
Prepare for 2.14.2

Prepare for 2.14.2Junio C Hamano Wed, 23 Aug 2017 21:36:03 +0000 (14:36 -0700)

Prepare for 2.14.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jt/t1450-fsck-corrupt-packfile' into... Junio C Hamano Wed, 23 Aug 2017 21:33:52 +0000 (14:33 -0700)

Merge branch 'jt/t1450-fsck-corrupt-packfile' into maint

A test update.

* jt/t1450-fsck-corrupt-packfile:
tests: ensure fsck fails on corrupt packfiles

Merge branch 'jb/t8008-cleanup' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:52 +0000 (14:33 -0700)

Merge branch 'jb/t8008-cleanup' into maint

Code clean-up.

* jb/t8008-cleanup:
t8008: rely on rev-parse'd HEAD instead of sha1 value

Merge branch 'jt/subprocess-handshake' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:52 +0000 (14:33 -0700)

Merge branch 'jt/subprocess-handshake' into maint

Code cleanup.

* jt/subprocess-handshake:
sub-process: refactor handshake to common function
Documentation: migrate sub-process docs to header
convert: add "status=delayed" to filter process protocol
convert: refactor capabilities negotiation
convert: move multiple file filter error handling to separate function
convert: put the flags field before the flag itself for consistent style
t0021: write "OUT <size>" only on success
t0021: make debug log file name configurable
t0021: keep filter log files on comparison

Merge branch 'dc/fmt-merge-msg-microcleanup' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:52 +0000 (14:33 -0700)

Merge branch 'dc/fmt-merge-msg-microcleanup' into maint

Code cleanup.

* dc/fmt-merge-msg-microcleanup:
fmt-merge-msg: fix coding style

Merge branch 'ah/doc-wserrorhighlight' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:51 +0000 (14:33 -0700)

Merge branch 'ah/doc-wserrorhighlight' into maint

Doc update.

* ah/doc-wserrorhighlight:
doc: add missing values "none" and "default" for diff.wsErrorHighlight

Merge branch 'cc/ref-is-hidden-microcleanup' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:50 +0000 (14:33 -0700)

Merge branch 'cc/ref-is-hidden-microcleanup' into maint

Code cleanup.

* cc/ref-is-hidden-microcleanup:
refs: use skip_prefix() in ref_is_hidden()

Merge branch 'js/run-process-parallel-api-fix' into... Junio C Hamano Wed, 23 Aug 2017 21:33:49 +0000 (14:33 -0700)

Merge branch 'js/run-process-parallel-api-fix' into maint

API fix.

* js/run-process-parallel-api-fix:
run_processes_parallel: change confusing task_cb convention

Merge branch 'rs/pack-objects-pbase-cleanup' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:48 +0000 (14:33 -0700)

Merge branch 'rs/pack-objects-pbase-cleanup' into maint

Code clean-up.

* rs/pack-objects-pbase-cleanup:
pack-objects: remove unnecessary NULL check

Merge branch 'jt/fsck-code-cleanup' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:48 +0000 (14:33 -0700)

Merge branch 'jt/fsck-code-cleanup' into maint

Code clean-up.

* jt/fsck-code-cleanup:
fsck: cleanup unused variable
object: remove "used" field from struct object
fsck: remove redundant parse_tree() invocation

Merge branch 'rs/stat-data-unaligned-reads-fix' into... Junio C Hamano Wed, 23 Aug 2017 21:33:47 +0000 (14:33 -0700)

Merge branch 'rs/stat-data-unaligned-reads-fix' into maint

Code clean-up.

* rs/stat-data-unaligned-reads-fix:
dir: support platforms that require aligned reads

Merge branch 'rs/move-array' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:46 +0000 (14:33 -0700)

Merge branch 'rs/move-array' into maint

Code clean-up.

* rs/move-array:
ls-files: don't try to prune an empty index
apply: use COPY_ARRAY and MOVE_ARRAY in update_image()
use MOVE_ARRAY
add MOVE_ARRAY

Merge branch 'rs/bswap-ubsan-fix' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:46 +0000 (14:33 -0700)

Merge branch 'rs/bswap-ubsan-fix' into maint

Code clean-up.

* rs/bswap-ubsan-fix:
bswap: convert get_be16, get_be32 and put_be32 to inline functions
bswap: convert to unsigned before shifting in get_be32

Merge branch 'dl/credential-cache-socket-in-xdg-cache... Junio C Hamano Wed, 23 Aug 2017 21:33:45 +0000 (14:33 -0700)

Merge branch 'dl/credential-cache-socket-in-xdg-cache' into maint

A recently added test for the "credential-cache" helper revealed
that EOF detection done around the time the connection to the cache
daemon is torn down were flaky. This was fixed by reacting to
ECONNRESET and behaving as if we got an EOF.

* dl/credential-cache-socket-in-xdg-cache:
credential-cache: interpret an ECONNRESET as an EOF

Merge branch 'hb/gitweb-project-list' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:44 +0000 (14:33 -0700)

Merge branch 'hb/gitweb-project-list' into maint

When a directory is not readable, "gitweb" fails to build the
project list. Work this around by skipping such a directory.

It might end up hiding a problem under the rug and a better
solution might be to loudly complain to the administrator pointing
out the problematic directory, but this will at least make it
"work".

* hb/gitweb-project-list:
gitweb: skip unreadable subdirectories

Merge branch 'ks/commit-abort-on-empty-message-fix... Junio C Hamano Wed, 23 Aug 2017 21:33:44 +0000 (14:33 -0700)

Merge branch 'ks/commit-abort-on-empty-message-fix' into maint

"git commit" when seeing an totally empty message said "you did not
edit the message", which is clearly wrong. The message has been
corrected.

* ks/commit-abort-on-empty-message-fix:
commit: check for empty message before the check for untouched template

Merge branch 'jk/reflog-walk' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:43 +0000 (14:33 -0700)

Merge branch 'jk/reflog-walk' into maint

Numerous bugs in walking of reflogs via "log -g" and friends have
been fixed.

* jk/reflog-walk:
reflog-walk: apply --since/--until to reflog dates
reflog-walk: stop using fake parents
rev-list: check reflog_info before showing usage
get_revision_1(): replace do-while with an early return
log: do not free parents when walking reflog
log: clarify comment about reflog cycles
revision: disallow reflog walking with revs->limited
t1414: document some reflog-walk oddities

Merge branch 'jc/http-sslkey-and-ssl-cert-are-paths... Junio C Hamano Wed, 23 Aug 2017 21:33:43 +0000 (14:33 -0700)

Merge branch 'jc/http-sslkey-and-ssl-cert-are-paths' into maint

The http.{sslkey,sslCert} configuration variables are to be
interpreted as a pathname that honors "~[username]/" prefix, but
weren't, which has been fixed.

* jc/http-sslkey-and-ssl-cert-are-paths:
http.c: http.sslcert and http.sslkey are both pathnames

Merge branch 'jk/ref-filter-colors' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:42 +0000 (14:33 -0700)

Merge branch 'jk/ref-filter-colors' into maint

"%C(color name)" in the pretty print format always produced ANSI
color escape codes, which was an early design mistake. They now
honor the configuration (e.g. "color.ui = never") and also tty-ness
of the output medium.

* jk/ref-filter-colors:
ref-filter: consult want_color() before emitting colors
pretty: respect color settings for %C placeholders
rev-list: pass diffopt->use_colors through to pretty-print
for-each-ref: load config earlier
color: check color.ui in git_default_config()
ref-filter: pass ref_format struct to atom parsers
ref-filter: factor out the parsing of sorting atoms
ref-filter: make parse_ref_filter_atom a private function
ref-filter: provide a function for parsing sort options
ref-filter: move need_color_reset_at_eol into ref_format
ref-filter: abstract ref format into its own struct
ref-filter: simplify automatic color reset
t: use test_decode_color rather than literal ANSI codes
docs/for-each-ref: update pointer to color syntax
check return value of verify_ref_format()

Merge branch 'js/git-gui-msgfmt-on-windows' into maintJunio C Hamano Wed, 23 Aug 2017 21:33:42 +0000 (14:33 -0700)

Merge branch 'js/git-gui-msgfmt-on-windows' into maint

Because recent Git for Windows do come with a real msgfmt, the
build procedure for git-gui has been updated to use it instead of a
hand-rolled substitute.

* js/git-gui-msgfmt-on-windows:
git-gui (MinGW): make use of MSys2's msgfmt
git gui: allow for a long recentrepo list
git gui: de-dup selected repo from recentrepo history
git gui: cope with duplicates in _get_recentrepo
git-gui: remove duplicate entries from .gitconfig's gui.recentrepo

The third batch post 2.14Junio C Hamano Wed, 23 Aug 2017 21:16:00 +0000 (14:16 -0700)

The third batch post 2.14

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'mg/format-ref-doc-fix'Junio C Hamano Wed, 23 Aug 2017 21:13:14 +0000 (14:13 -0700)

Merge branch 'mg/format-ref-doc-fix'

Doc fix.

* mg/format-ref-doc-fix:
Documentation/git-for-each-ref: clarify peeling of tags for --format
Documentation: use proper wording for ref format strings

Merge branch 'sb/submodule-parallel-update'Junio C Hamano Wed, 23 Aug 2017 21:13:14 +0000 (14:13 -0700)

Merge branch 'sb/submodule-parallel-update'

Code clean-up.

* sb/submodule-parallel-update:
submodule.sh: remove unused variable

Merge branch 'jc/diff-sane-truncate-no-more'Junio C Hamano Wed, 23 Aug 2017 21:13:13 +0000 (14:13 -0700)

Merge branch 'jc/diff-sane-truncate-no-more'

Code clean-up.

* jc/diff-sane-truncate-no-more:
diff: retire sane_truncate_fn

Merge branch 'hv/t5526-andand-chain-fix'Junio C Hamano Wed, 23 Aug 2017 21:13:13 +0000 (14:13 -0700)

Merge branch 'hv/t5526-andand-chain-fix'

Test fix.

* hv/t5526-andand-chain-fix:
t5526: fix some broken && chains

Merge branch 'as/grep-quiet-no-match-exit-code-fix'Junio C Hamano Wed, 23 Aug 2017 21:13:12 +0000 (14:13 -0700)

Merge branch 'as/grep-quiet-no-match-exit-code-fix'

"git grep -L" and "git grep --quiet -L" reported different exit
codes; this has been corrected.

* as/grep-quiet-no-match-exit-code-fix:
git-grep: correct exit code with --quiet and -L

Merge branch 'kw/commit-keep-index-when-pre-commit... Junio C Hamano Wed, 23 Aug 2017 21:13:11 +0000 (14:13 -0700)

Merge branch 'kw/commit-keep-index-when-pre-commit-is-not-run'

"git commit" used to discard the index and re-read from the filesystem
just in case the pre-commit hook has updated it in the middle; this
has been optimized out when we know we do not run the pre-commit hook.

* kw/commit-keep-index-when-pre-commit-is-not-run:
commit: skip discarding the index if there is no pre-commit hook

Merge branch 'sb/sha1-file-cleanup'Junio C Hamano Wed, 23 Aug 2017 21:13:10 +0000 (14:13 -0700)

Merge branch 'sb/sha1-file-cleanup'

Code clean-up.

* sb/sha1-file-cleanup:
sha1_file: make read_info_alternates static

Merge branch 'rs/t1002-do-not-use-sum'Junio C Hamano Wed, 23 Aug 2017 21:13:09 +0000 (14:13 -0700)

Merge branch 'rs/t1002-do-not-use-sum'

Test simplification.

* rs/t1002-do-not-use-sum:
t1002: stop using sum(1)

Merge branch 'kd/stash-with-bash-4.4'Junio C Hamano Wed, 23 Aug 2017 21:13:08 +0000 (14:13 -0700)

Merge branch 'kd/stash-with-bash-4.4'

bash 4.4 or newer gave a warning on NUL byte in command
substitution done in "git stash"; this has been squelched.

* kd/stash-with-bash-4.4:
stash: prevent warning about null bytes in input

Merge branch 'ah/doc-empty-string-is-false'Junio C Hamano Wed, 23 Aug 2017 21:13:08 +0000 (14:13 -0700)

Merge branch 'ah/doc-empty-string-is-false'

Doc update.

* ah/doc-empty-string-is-false:
doc: clarify "config --bool" behaviour with empty string

Merge branch 'kw/rebase-progress'Junio C Hamano Wed, 23 Aug 2017 21:13:07 +0000 (14:13 -0700)

Merge branch 'kw/rebase-progress'

"git rebase", especially when it is run by mistake and ends up
trying to replay many changes, spent long time in silence. The
command has been taught to show progress report when it spends
long time preparing these many changes to replay (which would give
the user a chance to abort with ^C).

* kw/rebase-progress:
rebase: turn on progress option by default for format-patch
format-patch: have progress option while generating patches

Merge branch 'ks/prepare-commit-msg-sample-fix'Junio C Hamano Wed, 23 Aug 2017 21:13:07 +0000 (14:13 -0700)

Merge branch 'ks/prepare-commit-msg-sample-fix'

An "oops" fix to a topic that is already in 'master'.

* ks/prepare-commit-msg-sample-fix:
hook: use correct logical variable

Merge branch 'nm/stash-untracked'Junio C Hamano Wed, 23 Aug 2017 21:13:07 +0000 (14:13 -0700)

Merge branch 'nm/stash-untracked'

"git stash -u" used the contents of the committed version of the
".gitignore" file to decide which paths are ignored, even when the
file has local changes. The command has been taught to instead use
the locally modified contents.

* nm/stash-untracked:
stash: clean untracked files before reset

Merge branch 'jt/sha1-file-cleanup'Junio C Hamano Wed, 23 Aug 2017 21:13:07 +0000 (14:13 -0700)

Merge branch 'jt/sha1-file-cleanup'

Preparatory code clean-up.

* jt/sha1-file-cleanup:
sha1_file: remove read_packed_sha1()
sha1_file: set whence in storage-specific info fn

vcs-svn: move remaining repo_tree functions to fast_exp... Jonathan Nieder Wed, 23 Aug 2017 00:04:47 +0000 (17:04 -0700)

vcs-svn: move remaining repo_tree functions to fast_export.h

These used to be for manipulating the in-memory repo_tree structure,
but nowadays they are convenience wrappers to handle a few git-vs-svn
mismatches:

1. Git does not track empty directories but Subversion does. When
looking up a path in git that Subversion thinks exists and finding
nothing, we can safely assume that the path represents a
directory. This is needed when a later Subversion revision
modifies that directory.

2. Subversion allows deleting a file by copying. In Git fast-import
we have to handle that more explicitly as a deletion.

These are details of the tool's interaction with git fast-import.
Move them to fast_export.c, where other such details are handled.

This way the function names do not start with a repo_ prefix that
would clash with the repository object introduced in
v2.14.0-rc0~38^2~16 (repository: introduce the repository object,
2017-06-22) or an svn_ prefix that would clash with libsvn (in case
someone wants to link this code with libsvn some day).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

vcs-svn: remove repo_delete wrapper functionJonathan Nieder Wed, 23 Aug 2017 00:02:15 +0000 (17:02 -0700)

vcs-svn: remove repo_delete wrapper function

Since v1.7.10-rc0~118^2~4^2~4^2~3 (vcs-svn: pass paths through to
fast-import, 2010-12-13) this is an alias for fast_export_delete.
Remove the unnecessary layer of indirection.

No functional change intended.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

vcs-svn: remove custom mode constantsJonathan Nieder Wed, 23 Aug 2017 00:01:34 +0000 (17:01 -0700)

vcs-svn: remove custom mode constants

In the rest of Git, these modes are spelled as S_IFDIR,
S_IFREG | 0644, S_IFREG | 0755, and S_IFLNK. Use the same constants
in svn-fe for simplicity and consistency.

No functional change intended.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

vcs-svn: remove more unused prototypes and declarationsJonathan Nieder Wed, 23 Aug 2017 00:00:57 +0000 (17:00 -0700)

vcs-svn: remove more unused prototypes and declarations

I forgot to remove these in v1.7.10-rc0~118^2~4^2~5^2~4 (vcs-svn:
eliminate repo_tree structure, 2010-12-10).

This finishes what was started in commit 36f63b50 (vcs-svn: remove
unused prototypes, 2017-08-21).

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Doc: clarify that pack-objects makes packs, pluralJonathan Tan Wed, 23 Aug 2017 00:40:10 +0000 (17:40 -0700)

Doc: clarify that pack-objects makes packs, plural

The documentation for pack-objects describes that it creates "a packed
archive of objects", which is confusing because it may create multiple
packs if --max-pack-size is set. Update the documentation to clarify
this, and explaining in which cases such a feature would be useful.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: retry acquiring reference locks for 100msMichael Haggerty Mon, 21 Aug 2017 11:51:34 +0000 (13:51 +0200)

refs: retry acquiring reference locks for 100ms

The philosophy of reference locking has been, "if another process is
changing a reference, then whatever I'm trying to do to it will
probably fail anyway because my old-SHA-1 value is probably no longer
current". But this argument falls down if the other process has locked
the reference to do something that doesn't actually change the value
of the reference, such as `pack-refs` or `reflog expire`. There
actually *is* a decent chance that a planned reference update will
still be able to go through after the other process has released the
lock.

So when trying to lock an individual reference (e.g., when creating
"refs/heads/master.lock"), if it is already locked, then retry the
lock acquisition for approximately 100 ms before giving up. This
should eliminate some unnecessary lock conflicts without wasting a lot
of time.

Add a configuration setting, `core.filesRefLockTimeout`, to allow this
setting to be tweaked.

Note: the function `get_files_ref_lock_timeout_ms()` cannot be private
to the files backend because it is also used by `write_pseudoref()`
and `delete_pseudoref()`, which are defined in `refs.c` so that they
can be used by other reference backends.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: save merge state earlierMichael J Gruber Wed, 23 Aug 2017 12:10:45 +0000 (14:10 +0200)

merge: save merge state earlier

If the `git merge` process is killed while waiting for the editor to
finish, the merge state is lost but the prepared merge msg and tree is kept.
So, a subsequent `git commit` creates a squashed merge even when the
user asked for proper merge commit originally.

Demonstrate the problem with a test crafted after the in t7502. The test
requires EXECKEEPSPID (thus does not run under MINGW).

Save the merge state earlier (in the non-squash case) so that it does
not get lost. This makes the test pass.

Reported-by: hIpPy <hippy2981@gmail.com>
Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: split write_merge_state in twoMichael J Gruber Wed, 23 Aug 2017 12:10:44 +0000 (14:10 +0200)

merge: split write_merge_state in two

write_merge_state() writes out the merge heads, mode, and msg. But we
may want to write out heads, mode without the msg. So, split out heads
(+mode) into a separate function write_merge_heads() that is called by
write_merge_state().

No funtional change so far, except when these non-atomic writes are
interrupted: we write heads-mode-msg now when we used to write
heads-msg-mode.

Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>