git
6 years agoSync with master
Junio C Hamano [Wed, 14 Feb 2018 00:43:09 +0000 (16:43 -0800)] 
Sync with master

* master:
  Second batch for 2.17

6 years agoSecond batch for 2.17
Junio C Hamano [Wed, 14 Feb 2018 00:22:16 +0000 (16:22 -0800)] 
Second batch for 2.17

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'tz/doc-show-defaults-to-head'
Junio C Hamano [Tue, 13 Feb 2018 21:39:17 +0000 (13:39 -0800)] 
Merge branch 'tz/doc-show-defaults-to-head'

Doc update.

* tz/doc-show-defaults-to-head:
  doc: mention 'git show' defaults to HEAD

6 years agoMerge branch 'ew/svn-branch-segfault-fix'
Junio C Hamano [Tue, 13 Feb 2018 21:39:16 +0000 (13:39 -0800)] 
Merge branch 'ew/svn-branch-segfault-fix'

Workaround for segfault with more recent versions of SVN.

* ew/svn-branch-segfault-fix:
  git-svn: control destruction order to avoid segfault

6 years agoMerge branch 'sg/travis-linux32-sanity'
Junio C Hamano [Tue, 13 Feb 2018 21:39:16 +0000 (13:39 -0800)] 
Merge branch 'sg/travis-linux32-sanity'

Travis updates.

* sg/travis-linux32-sanity:
  travis-ci: don't fail if user already exists on 32 bit Linux build job
  travis-ci: don't run the test suite as root in the 32 bit Linux build
  travis-ci: don't repeat the path of the cache directory
  travis-ci: use 'set -e' in the 32 bit Linux build job
  travis-ci: use 'set -x' for the commands under 'su' in the 32 bit Linux build

6 years agoMerge branch 'nd/list-merge-strategy'
Junio C Hamano [Tue, 13 Feb 2018 21:39:15 +0000 (13:39 -0800)] 
Merge branch 'nd/list-merge-strategy'

Completion of "git merge -s<strategy>" (in contrib/) did not work
well in non-C locale.

* nd/list-merge-strategy:
  completion: fix completing merge strategies on non-C locales

6 years agoMerge branch 'jt/long-running-process-doc'
Junio C Hamano [Tue, 13 Feb 2018 21:39:15 +0000 (13:39 -0800)] 
Merge branch 'jt/long-running-process-doc'

Doc updates.

* jt/long-running-process-doc:
  Docs: split out long-running subprocess handshake

6 years agoMerge branch 'jk/daemon-fixes'
Junio C Hamano [Tue, 13 Feb 2018 21:39:15 +0000 (13:39 -0800)] 
Merge branch 'jk/daemon-fixes'

Assorted fixes to "git daemon".

* jk/daemon-fixes:
  daemon: fix length computation in newline stripping
  t/lib-git-daemon: add network-protocol helpers
  daemon: handle NULs in extended attribute string
  daemon: fix off-by-one in logging extended attributes
  t/lib-git-daemon: record daemon log
  t5570: use ls-remote instead of clone for interp tests

6 years agoMerge branch 'pw/sequencer-in-process-commit'
Junio C Hamano [Tue, 13 Feb 2018 21:39:15 +0000 (13:39 -0800)] 
Merge branch 'pw/sequencer-in-process-commit'

The sequencer infrastructure is shared across "git cherry-pick",
"git rebase -i", etc., and has always spawned "git commit" when it
needs to create a commit.  It has been taught to do so internally,
when able, by reusing the codepath "git commit" itself uses, which
gives performance boost for a few tens of percents in some sample
scenarios.

* pw/sequencer-in-process-commit:
  sequencer: run 'prepare-commit-msg' hook
  t7505: add tests for cherry-pick and rebase -i/-p
  t7505: style fixes
  sequencer: assign only free()able strings to gpg_sign
  sequencer: improve config handling
  t3512/t3513: remove KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT=1
  sequencer: try to commit without forking 'git commit'
  sequencer: load commit related config
  sequencer: simplify adding Signed-off-by: trailer
  commit: move print_commit_summary() to libgit
  commit: move post-rewrite code to libgit
  Add a function to update HEAD after creating a commit
  commit: move empty message checks to libgit
  t3404: check intermediate squash messages

6 years agoMerge branch 'nd/shared-index-fix'
Junio C Hamano [Tue, 13 Feb 2018 21:39:14 +0000 (13:39 -0800)] 
Merge branch 'nd/shared-index-fix'

Code clean-up.

* nd/shared-index-fix:
  read-cache: don't write index twice if we can't write shared index
  read-cache.c: move tempfile creation/cleanup out of write_shared_index
  read-cache.c: change type of "temp" in write_shared_index()

6 years agoMerge branch 'po/http-push-error-message'
Junio C Hamano [Tue, 13 Feb 2018 21:39:14 +0000 (13:39 -0800)] 
Merge branch 'po/http-push-error-message'

Debugging aid.

* po/http-push-error-message:
  http-push: improve error log

6 years agoMerge branch 'po/clang-format-functype-weight'
Junio C Hamano [Tue, 13 Feb 2018 21:39:14 +0000 (13:39 -0800)] 
Merge branch 'po/clang-format-functype-weight'

Prevent "clang-format" from breaking line after function return type.

* po/clang-format-functype-weight:
  clang-format: adjust penalty for return type line break

6 years agoMerge branch 'jc/mailinfo-cleanup-fix'
Junio C Hamano [Tue, 13 Feb 2018 21:39:14 +0000 (13:39 -0800)] 
Merge branch 'jc/mailinfo-cleanup-fix'

Corner case bugfix.

* jc/mailinfo-cleanup-fix:
  mailinfo: avoid segfault when can't open files

6 years agoMerge branch 'sg/cocci-move-array'
Junio C Hamano [Tue, 13 Feb 2018 21:39:13 +0000 (13:39 -0800)] 
Merge branch 'sg/cocci-move-array'

Code clean-up.

* sg/cocci-move-array:
  Use MOVE_ARRAY

6 years agoMerge branch 'tg/split-index-fixes'
Junio C Hamano [Tue, 13 Feb 2018 21:39:12 +0000 (13:39 -0800)] 
Merge branch 'tg/split-index-fixes'

The split-index mode had a few corner case bugs fixed.

* tg/split-index-fixes:
  travis: run tests with GIT_TEST_SPLIT_INDEX
  split-index: don't write cache tree with null oid entries
  read-cache: fix reading the shared index for other repos

6 years agoMerge branch 'rs/strbuf-cocci-workaround'
Junio C Hamano [Tue, 13 Feb 2018 21:39:12 +0000 (13:39 -0800)] 
Merge branch 'rs/strbuf-cocci-workaround'

Update Coccinelle rules to catch and optimize strbuf_addf(&buf, "%s", str)

* rs/strbuf-cocci-workaround:
  cocci: use format keyword instead of a literal string

6 years agoMerge branch 'mr/packed-ref-store-fix'
Junio C Hamano [Tue, 13 Feb 2018 21:39:11 +0000 (13:39 -0800)] 
Merge branch 'mr/packed-ref-store-fix'

Crash fix for a corner case where an error codepath tried to unlock
what it did not acquire lock on.

* mr/packed-ref-store-fix:
  files_initial_transaction_commit(): only unlock if locked

6 years agoMerge branch 'jt/http-redact-cookies'
Junio C Hamano [Tue, 13 Feb 2018 21:39:11 +0000 (13:39 -0800)] 
Merge branch 'jt/http-redact-cookies'

The http tracing code, often used to debug connection issues,
learned to redact potentially sensitive information from its output
so that it can be more safely sharable.

* jt/http-redact-cookies:
  http: support omitting data from traces
  http: support cookie redaction when tracing

6 years agoMerge branch 'ds/use-get-be64'
Junio C Hamano [Tue, 13 Feb 2018 21:39:11 +0000 (13:39 -0800)] 
Merge branch 'ds/use-get-be64'

Code clean-up.

* ds/use-get-be64:
  packfile: use get_be64() for large offsets

6 years agoMerge branch 'cc/sha1-file-name'
Junio C Hamano [Tue, 13 Feb 2018 21:39:10 +0000 (13:39 -0800)] 
Merge branch 'cc/sha1-file-name'

Code clean-up.

* cc/sha1-file-name:
  sha1_file: improve sha1_file_name() perfs
  sha1_file: remove static strbuf from sha1_file_name()

6 years agoMerge branch 'nd/trace-with-env'
Junio C Hamano [Tue, 13 Feb 2018 21:39:10 +0000 (13:39 -0800)] 
Merge branch 'nd/trace-with-env'

The tracing machinery learned to report tweaking of environment
variables as well.

* nd/trace-with-env:
  run-command.c: print new cwd in trace_run_command()
  run-command.c: print env vars in trace_run_command()
  run-command.c: print program 'git' when tracing git_cmd mode
  run-command.c: introduce trace_run_command()
  trace.c: move strbuf_release() out of print_trace_line()
  trace: avoid unnecessary quoting
  sq_quote_argv: drop maxlen parameter

6 years agoMerge branch 'pc/submodule-helper'
Junio C Hamano [Tue, 13 Feb 2018 21:39:10 +0000 (13:39 -0800)] 
Merge branch 'pc/submodule-helper'

Rewrite two more "git submodule" subcommands in C.

* pc/submodule-helper:
  submodule: port submodule subcommand 'deinit' from shell to C
  submodule: port submodule subcommand 'sync' from shell to C

6 years agoMerge branch 'rb/hashmap-h-compilation-fix'
Junio C Hamano [Tue, 13 Feb 2018 21:39:10 +0000 (13:39 -0800)] 
Merge branch 'rb/hashmap-h-compilation-fix'

Code clean-up.

* rb/hashmap-h-compilation-fix:
  hashmap.h: remove unused variable

6 years agoMerge branch 'nd/diff-flush-before-warning'
Junio C Hamano [Tue, 13 Feb 2018 21:39:09 +0000 (13:39 -0800)] 
Merge branch 'nd/diff-flush-before-warning'

Avoid showing a warning message in the middle of a line of "git
diff" output.

* nd/diff-flush-before-warning:
  diff.c: flush stdout before printing rename warnings

6 years agoMerge branch 'tb/crlf-conv-flags'
Junio C Hamano [Tue, 13 Feb 2018 21:39:08 +0000 (13:39 -0800)] 
Merge branch 'tb/crlf-conv-flags'

Code clean-up.

* tb/crlf-conv-flags:
  convert_to_git(): safe_crlf/checksafe becomes int conv_flags

6 years agoMerge branch 'rs/describe-unique-abbrev'
Junio C Hamano [Tue, 13 Feb 2018 21:39:07 +0000 (13:39 -0800)] 
Merge branch 'rs/describe-unique-abbrev'

Code clean-up.

* rs/describe-unique-abbrev:
  describe: use strbuf_add_unique_abbrev() for adding short hashes

6 years agoMerge branch 'ks/submodule-doc-updates'
Junio C Hamano [Tue, 13 Feb 2018 21:39:07 +0000 (13:39 -0800)] 
Merge branch 'ks/submodule-doc-updates'

Doc updates.

* ks/submodule-doc-updates:
  Doc/git-submodule: improve readability and grammar of a sentence
  Doc/gitsubmodules: make some changes to improve readability and syntax

6 years agoMerge branch 'cl/t9001-cleanup'
Junio C Hamano [Tue, 13 Feb 2018 21:39:07 +0000 (13:39 -0800)] 
Merge branch 'cl/t9001-cleanup'

Test clean-up.

* cl/t9001-cleanup:
  t9001: use existing helper in send-email test

6 years agoMerge branch 'gs/retire-mru'
Junio C Hamano [Tue, 13 Feb 2018 21:39:06 +0000 (13:39 -0800)] 
Merge branch 'gs/retire-mru'

Retire mru API as it does not give enough abstraction over
underlying list API to be worth it.

* gs/retire-mru:
  mru: Replace mru.[ch] with list.h implementation

6 years agoMerge branch 'ot/mru-on-list'
Junio C Hamano [Tue, 13 Feb 2018 21:39:05 +0000 (13:39 -0800)] 
Merge branch 'ot/mru-on-list'

The first step to getting rid of mru API and using the
doubly-linked list API directly instead.

* ot/mru-on-list:
  mru: use double-linked list from list.h

6 years agoMerge branch 'jh/partial-clone'
Junio C Hamano [Tue, 13 Feb 2018 21:39:04 +0000 (13:39 -0800)] 
Merge branch 'jh/partial-clone'

The machinery to clone & fetch, which in turn involves packing and
unpacking objects, have been told how to omit certain objects using
the filtering mechanism introduced by the jh/object-filtering
topic, and also mark the resulting pack as a promisor pack to
tolerate missing objects, taking advantage of the mechanism
introduced by the jh/fsck-promisors topic.

* jh/partial-clone:
  t5616: test bulk prefetch after partial fetch
  fetch: inherit filter-spec from partial clone
  t5616: end-to-end tests for partial clone
  fetch-pack: restore save_commit_buffer after use
  unpack-trees: batch fetching of missing blobs
  clone: partial clone
  partial-clone: define partial clone settings in config
  fetch: support filters
  fetch: refactor calculation of remote list
  fetch-pack: test support excluding large blobs
  fetch-pack: add --no-filter
  fetch-pack, index-pack, transport: partial clone
  upload-pack: add object filtering for partial clone

6 years agoMerge branch 'jh/fsck-promisors'
Junio C Hamano [Tue, 13 Feb 2018 21:39:03 +0000 (13:39 -0800)] 
Merge branch 'jh/fsck-promisors'

In preparation for implementing narrow/partial clone, the machinery
for checking object connectivity used by gc and fsck has been
taught that a missing object is OK when it is referenced by a
packfile specially marked as coming from trusted repository that
promises to make them available on-demand and lazily.

* jh/fsck-promisors:
  gc: do not repack promisor packfiles
  rev-list: support termination at promisor objects
  sha1_file: support lazily fetching missing objects
  introduce fetch-object: fetch one promisor object
  index-pack: refactor writing of .keep files
  fsck: support promisor objects as CLI argument
  fsck: support referenced promisor objects
  fsck: support refs pointing to promisor objects
  fsck: introduce partialclone extension
  extension.partialclone: introduce partial clone extension

6 years agoMerge branch 'ab/simplify-perl-makefile'
Junio C Hamano [Tue, 13 Feb 2018 21:39:03 +0000 (13:39 -0800)] 
Merge branch 'ab/simplify-perl-makefile'

The build procedure for perl/ part has been greatly simplified by
weaning ourselves off of MakeMaker.

* ab/simplify-perl-makefile:
  perl: treat PERLLIB_EXTRA as an extra path again
  perl: avoid *.pmc and fix Error.pm further
  Makefile: replace perl/Makefile.PL with simple make rules

6 years agoMerge branch 'bc/hash-algo' into next
Junio C Hamano [Fri, 9 Feb 2018 21:07:46 +0000 (13:07 -0800)] 
Merge branch 'bc/hash-algo' into next

More abstraction of hash function from the codepath.

* bc/hash-algo:
  hash: update obsolete reference to SHA1_HEADER

6 years agohash: update obsolete reference to SHA1_HEADER
brian m. carlson [Thu, 8 Feb 2018 02:48:58 +0000 (02:48 +0000)] 
hash: update obsolete reference to SHA1_HEADER

We moved away from SHA1_HEADER to a preprocessor if chain, but didn't
update the comment discussing the platform defines.  Update this comment
so it reflects the current state of our codebase.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'sg/test-i18ngrep' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:31 +0000 (15:08 -0800)] 
Merge branch 'sg/test-i18ngrep' into next

Test fixes.

* sg/test-i18ngrep:
  t: make 'test_i18ngrep' more informative on failure
  t: validate 'test_i18ngrep's parameters
  t: move 'test_i18ncmp' and 'test_i18ngrep' to 'test-lib-functions.sh'
  t5536: let 'test_i18ngrep' read the file without redirection
  t5510: consolidate 'grep' and 'test_i18ngrep' patterns
  t4001: don't run 'git status' upstream of a pipe
  t6022: don't run 'git merge' upstream of a pipe
  t5812: add 'test_i18ngrep's missing filename parameter
  t5541: add 'test_i18ngrep's missing filename parameter

6 years agoMerge branch 'nd/fix-untracked-cache-invalidation' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:31 +0000 (15:08 -0800)] 
Merge branch 'nd/fix-untracked-cache-invalidation' into next

Some bugs around "untracked cache" feature have been fixed.

* nd/fix-untracked-cache-invalidation:
  dir.c: ignore paths containing .git when invalidating untracked cache
  dir.c: stop ignoring opendir() error in open_cached_dir()
  dir.c: fix missing dir invalidation in untracked code
  dir.c: avoid stat() in valid_cached_dir()
  status: add a failing test showing a core.untrackedCache bug

6 years agoMerge branch 'gs/rebase-allow-empty-message' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:31 +0000 (15:08 -0800)] 
Merge branch 'gs/rebase-allow-empty-message' into next

"git rebase" learned to take "--allow-empty-message" option.

* gs/rebase-allow-empty-message:
  rebase: add --allow-empty-message option

6 years agoMerge branch 'lw/daemon-log-destination' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:30 +0000 (15:08 -0800)] 
Merge branch 'lw/daemon-log-destination' into next

The log from "git daemon" can be redirected with a new option; one
relevant use case is to send the log to standard error (instead of
syslog) when running it from inetd.

* lw/daemon-log-destination:
  daemon: add --log-destination=(stderr|syslog|none)

6 years agoMerge branch 'nd/ignore-glob-doc-update' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:30 +0000 (15:08 -0800)] 
Merge branch 'nd/ignore-glob-doc-update' into next

Doc update.

* nd/ignore-glob-doc-update:
  gitignore.txt: elaborate shell glob syntax

6 years agoMerge branch 'nd/format-patch-stat-width' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:29 +0000 (15:08 -0800)] 
Merge branch 'nd/format-patch-stat-width' into next

"git format-patch" learned to give 72-cols to diffstat, which is
consistent with other line length limits the subcommand uses for
its output meant for e-mails.

* nd/format-patch-stat-width:
  format-patch: reduce patch diffstat width to 72
  format-patch: keep cover-letter diffstat wrapped in 72 columns

6 years agoMerge branch 'tg/reset-hard-show-head-with-pretty' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:29 +0000 (15:08 -0800)] 
Merge branch 'tg/reset-hard-show-head-with-pretty' into next

The way "git reset --hard" reports the commit the updated HEAD
points at is made consistent with the way how the commit title is
generated by the other parts of the system.  This matters when the
title is spread across physically multiple lines.

* tg/reset-hard-show-head-with-pretty:
  reset --hard: make use of the pretty machinery

6 years agoMerge branch 'rs/cocci-strbuf-addf-to-addstr' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:28 +0000 (15:08 -0800)] 
Merge branch 'rs/cocci-strbuf-addf-to-addstr' into next

* rs/cocci-strbuf-addf-to-addstr:
  cocci: simplify check for trivial format strings

6 years agoMerge branch 'nd/trace-index-ops' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:28 +0000 (15:08 -0800)] 
Merge branch 'nd/trace-index-ops' into next

* nd/trace-index-ops:
  trace: measure where the time is spent in the index-heavy operations

6 years agoMerge branch 'jt/binsearch-with-fanout' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:28 +0000 (15:08 -0800)] 
Merge branch 'jt/binsearch-with-fanout' into next

Refactor the code to binary search starting from a fan-out table
(which is how the packfile is indexed with object names) into a
reusable helper.

* jt/binsearch-with-fanout:
  packfile: refactor hash search with fanout table
  packfile: remove GIT_DEBUG_LOOKUP log statements

6 years agoMerge branch 'cc/perf-aggregate' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:28 +0000 (15:08 -0800)] 
Merge branch 'cc/perf-aggregate' into next

"make perf" enhancement.

* cc/perf-aggregate:
  perf/aggregate: sort JSON fields in output
  perf/aggregate: add --reponame option
  perf/aggregate: add --subsection option

6 years agoMerge branch 'bc/hash-algo' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:27 +0000 (15:08 -0800)] 
Merge branch 'bc/hash-algo' into next

More abstraction of hash function from the codepath.

* bc/hash-algo:
  bulk-checkin: abstract SHA-1 usage
  csum-file: abstract uses of SHA-1
  csum-file: rename sha1file to hashfile
  read-cache: abstract away uses of SHA-1
  pack-write: switch various SHA-1 values to abstract forms
  pack-check: convert various uses of SHA-1 to abstract forms
  fast-import: switch various uses of SHA-1 to the_hash_algo
  sha1_file: switch uses of SHA-1 to the_hash_algo
  builtin/unpack-objects: switch uses of SHA-1 to the_hash_algo
  builtin/index-pack: improve hash function abstraction
  hash: create union for hash context allocation
  hash: move SHA-1 macros to hash.h

6 years agoMerge branch 'ab/wildmatch-tests' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:27 +0000 (15:08 -0800)] 
Merge branch 'ab/wildmatch-tests' into next

More tests for wildmatch functions.

* ab/wildmatch-tests:
  wildmatch test: mark test as EXPENSIVE_ON_WINDOWS
  test-lib: add an EXPENSIVE_ON_WINDOWS prerequisite
  wildmatch test: create & test files on disk in addition to in-memory
  wildmatch test: perform all tests under all wildmatch() modes
  wildmatch test: use test_must_fail, not ! for test-wildmatch
  wildmatch test: remove dead fnmatch() test code
  wildmatch test: use a paranoia pattern from nul_match()
  wildmatch test: don't try to vertically align our output
  wildmatch test: use more standard shell style
  wildmatch test: indent with tabs, not spaces

6 years agoMerge branch 'po/object-id' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:27 +0000 (15:08 -0800)] 
Merge branch 'po/object-id' into next

Conversion from uchar[20] to struct object_id continues.

* po/object-id:
  sha1_file: rename hash_sha1_file_literally
  sha1_file: convert write_loose_object to object_id
  sha1_file: convert force_object_loose to object_id
  sha1_file: convert write_sha1_file to object_id
  notes: convert write_notes_tree to object_id
  notes: convert combine_notes_* to object_id
  commit: convert commit_tree* to object_id
  match-trees: convert splice_tree to object_id
  cache: clear whole hash buffer with oidclr
  sha1_file: convert hash_sha1_file to object_id
  dir: convert struct sha1_stat to use object_id
  sha1_file: convert pretend_sha1_file to object_id

6 years agoMerge branch 'sb/pull-rebase-submodule' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:26 +0000 (15:08 -0800)] 
Merge branch 'sb/pull-rebase-submodule' into next

"git pull --rebase" did not pass verbosity setting down when
recursing into a submodule.

* sb/pull-rebase-submodule:
  builtin/pull: respect verbosity settings in submodules

6 years agoMerge branch 'kg/packed-ref-cache-fix' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:25 +0000 (15:08 -0800)] 
Merge branch 'kg/packed-ref-cache-fix' into next

Avoid mmapping small files while using packed refs (especially ones
with zero size, which would cause later munmap() to fail).

* kg/packed-ref-cache-fix:
  packed_ref_cache: don't use mmap() for small files
  load_contents(): don't try to mmap an empty file
  packed_ref_iterator_begin(): make optimization more general
  find_reference_location(): make function safe for empty snapshots
  create_snapshot(): use `xmemdupz()` rather than a strbuf
  struct snapshot: store `start` rather than `header_len`

6 years agoMerge branch 'jt/fsck-code-cleanup' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:25 +0000 (15:08 -0800)] 
Merge branch 'jt/fsck-code-cleanup' into next

Plug recently introduced leaks in fsck.

* jt/fsck-code-cleanup:
  fsck: fix leak when traversing trees

6 years agoMerge branch 'en/merge-recursive-fixes' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:24 +0000 (15:08 -0800)] 
Merge branch 'en/merge-recursive-fixes' into next

* en/merge-recursive-fixes:
  merge-recursive: add explanation for src_entry and dst_entry
  merge-recursive: fix logic ordering issue
  Tighten and correct a few testcases for merging and cherry-picking

6 years agoMerge branch 'jc/worktree-add-short-help' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:24 +0000 (15:08 -0800)] 
Merge branch 'jc/worktree-add-short-help' into next

Error message fix.

* jc/worktree-add-short-help:
  worktree: say that "add" takes an arbitrary commit in short-help

6 years agoMerge branch 'ab/sha1dc-build' into next
Junio C Hamano [Thu, 8 Feb 2018 23:08:24 +0000 (15:08 -0800)] 
Merge branch 'ab/sha1dc-build' into next

Push the submodule version of collision-detecting SHA-1 hash
implementation a bit harder on builders.

* ab/sha1dc-build:
  sha1dc_git.h: re-arrange an ifdef chain for a subsequent change
  Makefile: under "make dist", include the sha1collisiondetection submodule
  Makefile: don't error out under DC_SHA1_EXTERNAL if DC_SHA1_SUBMODULE=auto

6 years agot: make 'test_i18ngrep' more informative on failure
SZEDER Gábor [Thu, 8 Feb 2018 15:56:56 +0000 (16:56 +0100)] 
t: make 'test_i18ngrep' more informative on failure

When 'test_i18ngrep' can't find the expected pattern, it exits
completely silently; when its negated form does find the pattern that
shouldn't be there, it prints the matching line(s) but otherwise exits
without any error message.  This leaves the developer puzzled about
what could have gone wrong.

Make 'test_i18ngrep' more informative on failure by printing an error
message including the invoked 'grep' command and the contents of the
file it had to scan through.

Note that this "dump the scanned file" part is not quite perfect, as
it dumps only the file specified as the function's last positional
parameter, thus assuming that there is only a single file parameter.
I think that's a reasonable assumption to make, one that holds true in
the current code base.  And even if someone were to scan multiple
files at once in the future, the worst thing that could happen is that
the verbose error message won't include the contents of all those
files, only the last one.  Alas, we can't really do any better than
this, because checking whether the other positional parameters match a
filename can result in false positives: 't3400-rebase.sh' and
't3404-rebase-interactive.sh' contain one test each, where the
'test_i18ngrep's pattern verbatimly matches a file in the trash
directory.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot: validate 'test_i18ngrep's parameters
SZEDER Gábor [Thu, 8 Feb 2018 15:56:55 +0000 (16:56 +0100)] 
t: validate 'test_i18ngrep's parameters

Some of the previous patches in this series fixed bogus
'test_i18ngrep' invocations:

  - Two invocations where the tested git command's standard output is
    directly piped into 'test_i18ngrep'.  While convenient, this is an
    antipattern, because the pipe hides the git command's exit code,
    and the test could continue even if the command exited with error.

  - Two invocations that had neither a filename parameter nor anything
    piped into their standard input, yet both managed to remain
    unnoticed for years.  A third similarly bogus invocation is
    currently lurking in 'pu' for a couple of weeks now.

Prevent similar mistakes in the future by validating 'test_i18ngrep's
parameters requiring that

  - The last parameter names an existing file to be read, effectively
    forbidding piping into 'test_i18ngrep'.

    Note that this change will also forbid cases where 'test_i18ngrep'
    would legitimately read its standard input, e.g. when its standard
    input is redirected from a file, or when a git command's standard
    output is first written to an intermediate file, which is then
    preprocessed by a non-git command before the results are piped
    into 'test_i18ngrep'.  See two of the previous patches for the
    only such cases we had in our test suite.  However, reliably
    preventing the piping antipattern is arguably more important than
    supporting these cases, which can be easily worked around by
    opening the file directly or using an intermediate file anyway.

  - There are at least two parameters, not including the optional '!'
    to negate the pattern.  This ought to catch corner cases when
    'test_i18ngrep' looks for the name of an existing file on its
    standard input; the above check would miss this case becase the
    filename as pattern would be the last parameter.

    Note that this is not quite perfect, as it doesn't account for any
    'grep --options' given as parameters.  However, doing so would be
    far too complicated, considering that patterns can start with
    dashes as well, and in the majority of the cases we don't use any
    such options anyway.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot: move 'test_i18ncmp' and 'test_i18ngrep' to 'test-lib-functions.sh'
SZEDER Gábor [Thu, 8 Feb 2018 15:56:54 +0000 (16:56 +0100)] 
t: move 'test_i18ncmp' and 'test_i18ngrep' to 'test-lib-functions.sh'

Both 'test_i18ncmp' and 'test_i18ngrep' helper functions are supposed
to be called from our test scripts, so they should be in
'test-lib-functions.sh'.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5536: let 'test_i18ngrep' read the file without redirection
SZEDER Gábor [Thu, 8 Feb 2018 15:56:53 +0000 (16:56 +0100)] 
t5536: let 'test_i18ngrep' read the file without redirection

Redirecting 'test_i18ngrep's standard input from a file will interfere
with the linting that will be added in a later patch.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5510: consolidate 'grep' and 'test_i18ngrep' patterns
SZEDER Gábor [Thu, 8 Feb 2018 15:56:52 +0000 (16:56 +0100)] 
t5510: consolidate 'grep' and 'test_i18ngrep' patterns

One of the tests in 't5510-fetch.sh' checks the output of 'git fetch'
using 'test_i18ngrep', and while doing so it prefilters the output
with 'grep' before piping the result into 'test_i18ngrep'.

This prefiltering is unnecessary, with the appropriate pattern
'test_i18ngrep' can do it all by itself.  Furthermore, piping data
into 'test_i18ngrep' will interfere with the linting that will be
added in a later patch.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot4001: don't run 'git status' upstream of a pipe
SZEDER Gábor [Thu, 8 Feb 2018 15:56:51 +0000 (16:56 +0100)] 
t4001: don't run 'git status' upstream of a pipe

The primary purpose of three tests in 't4001-diff-rename.sh' is to
check rename detection in 'git status', but all three do so by running
'git status' upstream of a pipe, hiding its exit code.  Consequently,
the test could continue even if 'git status' exited with error.

Use an intermediate file between 'git status' and 'test_i18ngrep' to
catch a potential failure of the former.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot6022: don't run 'git merge' upstream of a pipe
SZEDER Gábor [Thu, 8 Feb 2018 15:56:50 +0000 (16:56 +0100)] 
t6022: don't run 'git merge' upstream of a pipe

The primary purpose of 't6022-merge-rename.sh' is to test 'git merge',
but one of the tests runs it upstream of a pipe, hiding its exit code.
Consequently, the test could continue even if 'git merge' exited with
error.

Use an intermediate file between 'git merge' and 'test_i18ngrep' to
catch a potential failure of the former.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5812: add 'test_i18ngrep's missing filename parameter
SZEDER Gábor [Thu, 8 Feb 2018 15:56:49 +0000 (16:56 +0100)] 
t5812: add 'test_i18ngrep's missing filename parameter

The second 'test_i18ngrep' invocation in the test 'curl redirects
respect whitelist' is missing its filename parameter.  This has
remained unnoticed since its introduction in f4113cac0 (http: limit
redirection to protocol-whitelist, 2015-09-22), because it would only
cause the test to fail if Git was built with a sufficiently old
libcurl version.  The test's two ||-chained 'test_i18ngrep'
invocations are supposed to check that either one of the two patterns
is present in 'git clone's error message.  As it happens, the first
invocation covers the error message from any reasonably up-to-date
libcurl, thus the second invocation, the one without the filename
parameter, isn't executed at all.  Apparently no one has run the test
suite's httpd tests with such an old libcurl in the last 2+ years, or
at least they haven't bothered to notify us about the failed test.

Fix this by consolidating the two patterns into a single extended
regexp, eliminating the need for an ||-chained second 'test_i18ngrep'
invocation.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5541: add 'test_i18ngrep's missing filename parameter
SZEDER Gábor [Thu, 8 Feb 2018 15:56:48 +0000 (16:56 +0100)] 
t5541: add 'test_i18ngrep's missing filename parameter

The test 'push --no-progress silences progress but not status' runs
'test_i18ngrep' without specifying a filename parameter.  This has
remained unnoticed since its introduction in e304aeba2 (t5541: test
more combinations of --progress, 2012-05-01), because that
'test_i18ngrep' is supposed to check that the given pattern is not
present in its input, and of course it won't find that pattern if its
input is empty (as it comes from /dev/null).  This also means that
this test could miss a potential breakage of 'git push --no-progress'.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'tz/doc-show-defaults-to-head' into next
Junio C Hamano [Wed, 7 Feb 2018 22:56:02 +0000 (14:56 -0800)] 
Merge branch 'tz/doc-show-defaults-to-head' into next

Doc update.

* tz/doc-show-defaults-to-head:
  doc: mention 'git show' defaults to HEAD

6 years agoMerge branch 'ew/svn-branch-segfault-fix' into next
Junio C Hamano [Wed, 7 Feb 2018 22:56:01 +0000 (14:56 -0800)] 
Merge branch 'ew/svn-branch-segfault-fix' into next

Workaround for segfault with more recent versions of SVN.

* ew/svn-branch-segfault-fix:
  git-svn: control destruction order to avoid segfault

6 years agoMerge branch 'sg/travis-linux32-sanity' into next
Junio C Hamano [Wed, 7 Feb 2018 22:56:01 +0000 (14:56 -0800)] 
Merge branch 'sg/travis-linux32-sanity' into next

Travis updates.

* sg/travis-linux32-sanity:
  travis-ci: don't fail if user already exists on 32 bit Linux build job
  travis-ci: don't run the test suite as root in the 32 bit Linux build
  travis-ci: don't repeat the path of the cache directory
  travis-ci: use 'set -e' in the 32 bit Linux build job
  travis-ci: use 'set -x' for the commands under 'su' in the 32 bit Linux build

6 years agoMerge branch 'nd/list-merge-strategy' into next
Junio C Hamano [Wed, 7 Feb 2018 22:56:00 +0000 (14:56 -0800)] 
Merge branch 'nd/list-merge-strategy' into next

Completion of "git merge -s<strategy>" (in contrib/) did not work
well in non-C locale.

* nd/list-merge-strategy:
  completion: fix completing merge strategies on non-C locales

6 years agoMerge branch 'jt/long-running-process-doc' into next
Junio C Hamano [Wed, 7 Feb 2018 22:56:00 +0000 (14:56 -0800)] 
Merge branch 'jt/long-running-process-doc' into next

Doc updates.

* jt/long-running-process-doc:
  Docs: split out long-running subprocess handshake

6 years agoMerge branch 'jk/daemon-fixes' into next
Junio C Hamano [Wed, 7 Feb 2018 22:56:00 +0000 (14:56 -0800)] 
Merge branch 'jk/daemon-fixes' into next

Assorted fixes to "git daemon".

* jk/daemon-fixes:
  daemon: fix length computation in newline stripping
  t/lib-git-daemon: add network-protocol helpers
  daemon: handle NULs in extended attribute string
  daemon: fix off-by-one in logging extended attributes
  t/lib-git-daemon: record daemon log
  t5570: use ls-remote instead of clone for interp tests

6 years agoMerge branch 'pw/sequencer-in-process-commit' into next
Junio C Hamano [Wed, 7 Feb 2018 22:56:00 +0000 (14:56 -0800)] 
Merge branch 'pw/sequencer-in-process-commit' into next

The sequencer infrastructure is shared across "git cherry-pick",
"git rebase -i", etc., and has always spawned "git commit" when it
needs to create a commit.  It has been taught to do so internally,
when able, by reusing the codepath "git commit" itself uses, which
gives performance boost for a few tens of percents in some sample
scenarios.

* pw/sequencer-in-process-commit:
  sequencer: run 'prepare-commit-msg' hook
  t7505: add tests for cherry-pick and rebase -i/-p
  t7505: style fixes
  sequencer: assign only free()able strings to gpg_sign
  sequencer: improve config handling
  t3512/t3513: remove KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMIT=1
  sequencer: try to commit without forking 'git commit'
  sequencer: load commit related config
  sequencer: simplify adding Signed-off-by: trailer
  commit: move print_commit_summary() to libgit
  commit: move post-rewrite code to libgit
  Add a function to update HEAD after creating a commit
  commit: move empty message checks to libgit
  t3404: check intermediate squash messages

6 years agoMerge branch 'nd/shared-index-fix' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:59 +0000 (14:55 -0800)] 
Merge branch 'nd/shared-index-fix' into next

Code clean-up.

* nd/shared-index-fix:
  read-cache: don't write index twice if we can't write shared index
  read-cache.c: move tempfile creation/cleanup out of write_shared_index
  read-cache.c: change type of "temp" in write_shared_index()

6 years agoMerge branch 'po/http-push-error-message' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:59 +0000 (14:55 -0800)] 
Merge branch 'po/http-push-error-message' into next

Debugging aid.

* po/http-push-error-message:
  http-push: improve error log

6 years agoMerge branch 'po/clang-format-functype-weight' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:59 +0000 (14:55 -0800)] 
Merge branch 'po/clang-format-functype-weight' into next

Prevent "clang-format" from breaking line after function return type.

* po/clang-format-functype-weight:
  clang-format: adjust penalty for return type line break

6 years agoMerge branch 'jc/mailinfo-cleanup-fix' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:58 +0000 (14:55 -0800)] 
Merge branch 'jc/mailinfo-cleanup-fix' into next

Corner case bugfix.

* jc/mailinfo-cleanup-fix:
  mailinfo: avoid segfault when can't open files

6 years agoMerge branch 'sg/cocci-move-array' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:57 +0000 (14:55 -0800)] 
Merge branch 'sg/cocci-move-array' into next

Code clean-up.

* sg/cocci-move-array:
  Use MOVE_ARRAY

6 years agoMerge branch 'tg/split-index-fixes' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:57 +0000 (14:55 -0800)] 
Merge branch 'tg/split-index-fixes' into next

The split-index mode had a few corner case bugs fixed.

* tg/split-index-fixes:
  travis: run tests with GIT_TEST_SPLIT_INDEX
  split-index: don't write cache tree with null oid entries
  read-cache: fix reading the shared index for other repos

6 years agoMerge branch 'rs/strbuf-cocci-workaround' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:56 +0000 (14:55 -0800)] 
Merge branch 'rs/strbuf-cocci-workaround' into next

Update Coccinelle rules to catch and optimize strbuf_addf(&buf, "%s", str)

* rs/strbuf-cocci-workaround:
  cocci: use format keyword instead of a literal string

6 years agoMerge branch 'mr/packed-ref-store-fix' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:55 +0000 (14:55 -0800)] 
Merge branch 'mr/packed-ref-store-fix' into next

Crash fix for a corner case where an error codepath tried to unlock
what it did not acquire lock on.

* mr/packed-ref-store-fix:
  files_initial_transaction_commit(): only unlock if locked

6 years agoMerge branch 'jt/http-redact-cookies' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:55 +0000 (14:55 -0800)] 
Merge branch 'jt/http-redact-cookies' into next

The http tracing code, often used to debug connection issues,
learned to redact potentially sensitive information from its output
so that it can be more safely sharable.

* jt/http-redact-cookies:
  http: support omitting data from traces
  http: support cookie redaction when tracing

6 years agoMerge branch 'ds/use-get-be64' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:55 +0000 (14:55 -0800)] 
Merge branch 'ds/use-get-be64' into next

Code clean-up.

* ds/use-get-be64:
  packfile: use get_be64() for large offsets

6 years agoMerge branch 'cc/sha1-file-name' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:55 +0000 (14:55 -0800)] 
Merge branch 'cc/sha1-file-name' into next

Code clean-up.

* cc/sha1-file-name:
  sha1_file: improve sha1_file_name() perfs
  sha1_file: remove static strbuf from sha1_file_name()

6 years agoMerge branch 'nd/trace-with-env' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:54 +0000 (14:55 -0800)] 
Merge branch 'nd/trace-with-env' into next

The tracing machinery learned to report tweaking of environment
variables as well.

* nd/trace-with-env:
  run-command.c: print new cwd in trace_run_command()
  run-command.c: print env vars in trace_run_command()
  run-command.c: print program 'git' when tracing git_cmd mode
  run-command.c: introduce trace_run_command()
  trace.c: move strbuf_release() out of print_trace_line()
  trace: avoid unnecessary quoting
  sq_quote_argv: drop maxlen parameter

6 years agoMerge branch 'pc/submodule-helper' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:54 +0000 (14:55 -0800)] 
Merge branch 'pc/submodule-helper' into next

Rewrite two more "git submodule" subcommands in C.

* pc/submodule-helper:
  submodule: port submodule subcommand 'deinit' from shell to C
  submodule: port submodule subcommand 'sync' from shell to C

6 years agoMerge branch 'rb/hashmap-h-compilation-fix' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:54 +0000 (14:55 -0800)] 
Merge branch 'rb/hashmap-h-compilation-fix' into next

Code clean-up.

* rb/hashmap-h-compilation-fix:
  hashmap.h: remove unused variable

6 years agoMerge branch 'nd/diff-flush-before-warning' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:53 +0000 (14:55 -0800)] 
Merge branch 'nd/diff-flush-before-warning' into next

Avoid showing a warning message in the middle of a line of "git
diff" output.

* nd/diff-flush-before-warning:
  diff.c: flush stdout before printing rename warnings

6 years agoMerge branch 'tb/crlf-conv-flags' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:51 +0000 (14:55 -0800)] 
Merge branch 'tb/crlf-conv-flags' into next

Code clean-up.

* tb/crlf-conv-flags:
  convert_to_git(): safe_crlf/checksafe becomes int conv_flags

6 years agoMerge branch 'rs/describe-unique-abbrev' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:51 +0000 (14:55 -0800)] 
Merge branch 'rs/describe-unique-abbrev' into next

Code clean-up.

* rs/describe-unique-abbrev:
  describe: use strbuf_add_unique_abbrev() for adding short hashes

6 years agoMerge branch 'ks/submodule-doc-updates' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:51 +0000 (14:55 -0800)] 
Merge branch 'ks/submodule-doc-updates' into next

Doc updates.

* ks/submodule-doc-updates:
  Doc/git-submodule: improve readability and grammar of a sentence
  Doc/gitsubmodules: make some changes to improve readability and syntax

6 years agoMerge branch 'cl/t9001-cleanup' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:51 +0000 (14:55 -0800)] 
Merge branch 'cl/t9001-cleanup' into next

Test clean-up.

* cl/t9001-cleanup:
  t9001: use existing helper in send-email test

6 years agoMerge branch 'gs/retire-mru' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:50 +0000 (14:55 -0800)] 
Merge branch 'gs/retire-mru' into next

Retire mru API as it does not give enough abstraction over
underlying list API to be worth it.

* gs/retire-mru:
  mru: Replace mru.[ch] with list.h implementation

6 years agoMerge branch 'ot/mru-on-list' into next
Junio C Hamano [Wed, 7 Feb 2018 22:55:49 +0000 (14:55 -0800)] 
Merge branch 'ot/mru-on-list' into next

The first step to getting rid of mru API and using the
doubly-linked list API directly instead.

* ot/mru-on-list:
  mru: use double-linked list from list.h

6 years agodir.c: ignore paths containing .git when invalidating untracked cache
Nguyễn Thái Ngọc Duy [Wed, 7 Feb 2018 09:21:40 +0000 (16:21 +0700)] 
dir.c: ignore paths containing .git when invalidating untracked cache

read_directory() code ignores all paths named ".git" even if it's not
a valid git repository. See treat_path() for details. Since ".git" is
basically invisible to read_directory(), when we are asked to
invalidate a path that contains ".git", we can safely ignore it
because the slow path would not consider it anyway.

This helps when fsmonitor is used and we have a real ".git" repo at
worktree top. Occasionally .git/index will be updated and if the
fsmonitor hook does not filter it, untracked cache is asked to
invalidate the path ".git/index".

Without this patch, we invalidate the root directory unncessarily,
which:

- makes read_directory() fall back to slow path for root directory
  (slower)

- makes the index dirty (because UNTR extension is updated). Depending
  on the index size, writing it down could also be slow.

A note about the new "safe_path" knob. Since this new check could be
relatively expensive, avoid it when we know it's not needed. If the
path comes from the index, it can't contain ".git". If it does
contain, we may be screwed up at many more levels, not just this one.

Noticed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase: add --allow-empty-message option
Genki Sky [Sun, 4 Feb 2018 20:08:13 +0000 (15:08 -0500)] 
rebase: add --allow-empty-message option

This option allows commits with empty commit messages to be rebased,
matching the same option in git-commit and git-cherry-pick. While empty
log messages are frowned upon, sometimes one finds them in older
repositories (e.g. translated from another VCS [0]), or have other
reasons for desiring them. The option is available in git-commit and
git-cherry-pick, so it is natural to make other git tools play nicely
with them. Adding this as an option allows the default to be "give the
user a chance to fix", while not interrupting the user's workflow
otherwise [1].

  [0]: https://stackoverflow.com/q/8542304
  [1]: https://public-inbox.org/git/7vd33afqjh.fsf@alter.siamese.dyndns.org/

To implement this, add a new --allow-empty-message flag. Then propagate
it to all calls of 'git commit', 'git cherry-pick', and 'git rebase--helper'
within the rebase scripts.

Signed-off-by: Genki Sky <sky@genki.is>
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodaemon: add --log-destination=(stderr|syslog|none)
Lucas Werkmeister [Sun, 4 Feb 2018 18:30:37 +0000 (19:30 +0100)] 
daemon: add --log-destination=(stderr|syslog|none)

This new option can be used to override the implicit --syslog of
--inetd, or to disable all logging. (While --detach also implies
--syslog, --log-destination=stderr with --detach is useless since
--detach disassociates the process from the original stderr.) --syslog
is retained as an alias for --log-destination=syslog.

--log-destination always overrides implicit --syslog regardless of
option order. This is different than the “last one wins” logic that
applies to some implicit options elsewhere in Git, but should hopefully
be less confusing. (I also don’t know if *all* implicit options in Git
follow “last one wins”.)

The combination of --inetd with --log-destination=stderr is useful, for
instance, when running `git daemon` as an instanced systemd service
(with associated socket unit). In this case, log messages sent via
syslog are received by the journal daemon, but run the risk of being
processed at a time when the `git daemon` process has already exited
(especially if the process was very short-lived, e.g. due to client
error), so that the journal daemon can no longer read its cgroup and
attach the message to the correct systemd unit (see systemd/systemd#2913
[1]). Logging to stderr instead can solve this problem, because systemd
can connect stderr directly to the journal daemon, which then already
knows which unit is associated with this stream.

[1]: https://github.com/systemd/systemd/issues/2913

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Lucas Werkmeister <mail@lucaswerkmeister.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopackfile: refactor hash search with fanout table
Jonathan Tan [Fri, 2 Feb 2018 22:36:31 +0000 (14:36 -0800)] 
packfile: refactor hash search with fanout table

Subsequent patches will introduce file formats that make use of a fanout
array and a sorted table containing hashes, just like packfiles.
Refactor the hash search in packfile.c into its own function, so that
those patches can make use of it as well.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopackfile: remove GIT_DEBUG_LOOKUP log statements
Jonathan Tan [Fri, 2 Feb 2018 22:36:30 +0000 (14:36 -0800)] 
packfile: remove GIT_DEBUG_LOOKUP log statements

In commit 628522ec1439 ("sha1-lookup: more memory efficient search in
sorted list of SHA-1", 2008-04-09), a different algorithm for searching
a sorted list was introduced, together with a set of log statements
guarded by GIT_DEBUG_LOOKUP that are invoked both when using that
algorithm and when using the existing binary search. Those log
statements was meant for experiments and debugging, but with the removal
of the aforementioned different algorithm in commit f1068efefe6d
("sha1_file: drop experimental GIT_USE_LOOKUP search", 2017-08-09),
those log statements are probably no longer necessary.

Remove those statements.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agococci: simplify check for trivial format strings
René Scharfe [Thu, 1 Feb 2018 18:56:34 +0000 (19:56 +0100)] 
cocci: simplify check for trivial format strings

353d84c537 (coccicheck: make transformation for strbuf_addf(sb, "...")
more precise) added a check to avoid transforming calls with format
strings which contain percent signs, as that would change the result.
It uses embedded Python code for that.  Simplify this rule by using the
regular expression matching operator instead.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreset --hard: make use of the pretty machinery
Thomas Gummerer [Thu, 1 Feb 2018 20:57:21 +0000 (20:57 +0000)] 
reset --hard: make use of the pretty machinery

reset --hard currently uses its own logic for printing the first line of
the commit message in its output.  Instead of just using the first line,
use the pretty machinery to create the output.

In addition to the easier to follow code, this makes the output more
consistent with other commands that print the title of the commit, such
as 'git commit --oneline' or 'git checkout', which both use
'pp_commit_easy()' with the CMIT_FMT_ONELINE modifier.

It is a slight change of the output if the second line of the commit
message is not a blank line, i.e. if the commit message is

    foo
    bar

previously we would print "HEAD is now at 000000 foo", while after
this change we print "HEAD is now at 000000 foo bar", same as 'git log
--oneline' shows "000000 foo bar".

So this does make the output more consistent with other commands, and
'reset' is a porcelain command, so nobody should be parsing the output
in scripts.

The current behaviour dates back to 0e5a7faa3a ("Make "git reset" a
builtin.", 2007-09-11), so I assume (without digging into the old
codebase too much) that the logic was implemented because there was
no convenience function such as 'pp_commit_easy' that would do this
already.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoperf/aggregate: sort JSON fields in output
Christian Couder [Thu, 1 Feb 2018 10:14:34 +0000 (11:14 +0100)] 
perf/aggregate: sort JSON fields in output

It is much easier to diff the output against a previous
one when the fields are sorted.

Helped-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>