git
7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge 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
  ...

7 years agoThe fourth batch post 2.14
Junio 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>
7 years agoMerge 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

7 years agoMerge 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()

7 years agoMerge 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

7 years agoMerge 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_*

7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge 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

7 years agoSync with maint
Junio C Hamano [Wed, 23 Aug 2017 21:36:38 +0000 (14:36 -0700)] 
Sync with maint

* maint:
  Prepare for 2.14.2

7 years agoPrepare for 2.14.2
Junio 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>
7 years agoMerge branch 'jt/t1450-fsck-corrupt-packfile' into maint
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

7 years agoMerge branch 'jb/t8008-cleanup' into maint
Junio 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

7 years agoMerge branch 'jt/subprocess-handshake' into maint
Junio 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

7 years agoMerge branch 'dc/fmt-merge-msg-microcleanup' into maint
Junio 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

7 years agoMerge branch 'ah/doc-wserrorhighlight' into maint
Junio 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

7 years agoMerge branch 'cc/ref-is-hidden-microcleanup' into maint
Junio 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()

7 years agoMerge branch 'js/run-process-parallel-api-fix' into maint
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

7 years agoMerge branch 'rs/pack-objects-pbase-cleanup' into maint
Junio 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

7 years agoMerge branch 'jt/fsck-code-cleanup' into maint
Junio 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

7 years agoMerge branch 'rs/stat-data-unaligned-reads-fix' into maint
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

7 years agoMerge branch 'rs/move-array' into maint
Junio 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

7 years agoMerge branch 'rs/bswap-ubsan-fix' into maint
Junio 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

7 years agoMerge branch 'dl/credential-cache-socket-in-xdg-cache' into maint
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

7 years agoMerge branch 'hb/gitweb-project-list' into maint
Junio 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

7 years agoMerge branch 'ks/commit-abort-on-empty-message-fix' into maint
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

7 years agoMerge branch 'jk/reflog-walk' into maint
Junio 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

7 years agoMerge branch 'jc/http-sslkey-and-ssl-cert-are-paths' into maint
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

7 years agoMerge branch 'jk/ref-filter-colors' into maint
Junio 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()

7 years agoMerge branch 'js/git-gui-msgfmt-on-windows' into maint
Junio 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

7 years agoThe third batch post 2.14
Junio 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>
7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge branch 'kw/commit-keep-index-when-pre-commit-is-not-run'
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

7 years agoMerge 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

7 years agoMerge 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)

7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge 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

7 years agoMerge 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

7 years agoThe second batch post 2.14
Junio C Hamano [Tue, 22 Aug 2017 17:33:58 +0000 (10:33 -0700)] 
The second batch post 2.14

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'mh/packed-ref-store'
Junio C Hamano [Tue, 22 Aug 2017 17:29:16 +0000 (10:29 -0700)] 
Merge branch 'mh/packed-ref-store'

The "ref-store" code reorganization continues.

* mh/packed-ref-store: (32 commits)
  files-backend: cheapen refname_available check when locking refs
  packed_ref_store: handle a packed-refs file that is a symlink
  read_packed_refs(): die if `packed-refs` contains bogus data
  t3210: add some tests of bogus packed-refs file contents
  repack_without_refs(): don't lock or unlock the packed refs
  commit_packed_refs(): remove call to `packed_refs_unlock()`
  clear_packed_ref_cache(): don't protest if the lock is held
  packed_refs_unlock(), packed_refs_is_locked(): new functions
  packed_refs_lock(): report errors via a `struct strbuf *err`
  packed_refs_lock(): function renamed from lock_packed_refs()
  commit_packed_refs(): use a staging file separate from the lockfile
  commit_packed_refs(): report errors rather than dying
  packed_ref_store: make class into a subclass of `ref_store`
  packed-backend: new module for handling packed references
  packed_read_raw_ref(): new function, replacing `resolve_packed_ref()`
  packed_ref_store: support iteration
  packed_peel_ref(): new function, extracted from `files_peel_ref()`
  repack_without_refs(): take a `packed_ref_store *` parameter
  get_packed_ref(): take a `packed_ref_store *` parameter
  rollback_packed_refs(): take a `packed_ref_store *` parameter
  ...

7 years agoMerge branch 'sb/retire-t1200'
Junio C Hamano [Tue, 22 Aug 2017 17:29:16 +0000 (10:29 -0700)] 
Merge branch 'sb/retire-t1200'

A test script that outlived its usefulness has been removed.

* sb/retire-t1200:
  t1200: remove t1200-tutorial.sh

7 years agoMerge branch 'rs/win32-syslog-leakfix'
Junio C Hamano [Tue, 22 Aug 2017 17:29:16 +0000 (10:29 -0700)] 
Merge branch 'rs/win32-syslog-leakfix'

Memory leak in an error codepath has been plugged.

* rs/win32-syslog-leakfix:
  win32: plug memory leak on realloc() failure in syslog()

7 years agoMerge branch 'rs/unpack-entry-leakfix'
Junio C Hamano [Tue, 22 Aug 2017 17:29:15 +0000 (10:29 -0700)] 
Merge branch 'rs/unpack-entry-leakfix'

Memory leak in an error codepath has been plugged.

* rs/unpack-entry-leakfix:
  sha1_file: release delta_stack on error in unpack_entry()

7 years agoMerge branch 'rs/strbuf-getwholeline-fix'
Junio C Hamano [Tue, 22 Aug 2017 17:29:15 +0000 (10:29 -0700)] 
Merge branch 'rs/strbuf-getwholeline-fix'

A helper function to read a single whole line into strbuf
mistakenly triggered OOM error at EOF under certain conditions,
which has been fixed.

* rs/strbuf-getwholeline-fix:
  strbuf: clear errno before calling getdelim(3)

7 years agoMerge branch 'rs/merge-microcleanup'
Junio C Hamano [Tue, 22 Aug 2017 17:29:14 +0000 (10:29 -0700)] 
Merge branch 'rs/merge-microcleanup'

Code clean-up.

* rs/merge-microcleanup:
  merge: use skip_prefix()

7 years agoMerge branch 'rs/fsck-obj-leakfix'
Junio C Hamano [Tue, 22 Aug 2017 17:29:13 +0000 (10:29 -0700)] 
Merge branch 'rs/fsck-obj-leakfix'

Memory leak in an error codepath has been plugged.

* rs/fsck-obj-leakfix:
  fsck: free buffers on error in fsck_obj()

7 years agoMerge branch 'rs/t4062-obsd'
Junio C Hamano [Tue, 22 Aug 2017 17:29:13 +0000 (10:29 -0700)] 
Merge branch 'rs/t4062-obsd'

Test portability fix.

* rs/t4062-obsd:
  t4062: use less than 256 repetitions in regex

7 years agoMerge branch 'rs/find-pack-entry-bisection'
Junio C Hamano [Tue, 22 Aug 2017 17:29:11 +0000 (10:29 -0700)] 
Merge branch 'rs/find-pack-entry-bisection'

Code clean-up.

* rs/find-pack-entry-bisection:
  sha1_file: avoid comparison if no packed hash matches the first byte

7 years agoMerge branch 'rs/apply-lose-prefix-length'
Junio C Hamano [Tue, 22 Aug 2017 17:29:10 +0000 (10:29 -0700)] 
Merge branch 'rs/apply-lose-prefix-length'

Code clean-up.

* rs/apply-lose-prefix-length:
  apply: remove prefix_length member from apply_state

7 years agoMerge branch 'rj/add-chmod-error-message'
Junio C Hamano [Tue, 22 Aug 2017 17:29:10 +0000 (10:29 -0700)] 
Merge branch 'rj/add-chmod-error-message'

Message fix.

* rj/add-chmod-error-message:
  builtin/add: add detail to a 'cannot chmod' error message

7 years agoMerge branch 'jk/hashcmp-memcmp'
Junio C Hamano [Tue, 22 Aug 2017 17:29:09 +0000 (10:29 -0700)] 
Merge branch 'jk/hashcmp-memcmp'

Code clean-up.

* jk/hashcmp-memcmp:
  hashcmp: use memcmp instead of open-coded loop

7 years agoMerge branch 'jk/drop-sha1-entry-pos'
Junio C Hamano [Tue, 22 Aug 2017 17:29:08 +0000 (10:29 -0700)] 
Merge branch 'jk/drop-sha1-entry-pos'

Code clean-up.

* jk/drop-sha1-entry-pos:
  sha1_file: drop experimental GIT_USE_LOOKUP search

7 years agoMerge branch 'ur/svn-local-zone'
Junio C Hamano [Tue, 22 Aug 2017 17:29:07 +0000 (10:29 -0700)] 
Merge branch 'ur/svn-local-zone'

"git svn" used with "--localtime" option did not compute the tz
offset for the timestamp in question and instead always used the
current time, which has been corrected.

* ur/svn-local-zone:
  git svn fetch: Create correct commit timestamp when using --localtime

7 years agoMerge branch 'pw/am-signoff'
Junio C Hamano [Tue, 22 Aug 2017 17:29:07 +0000 (10:29 -0700)] 
Merge branch 'pw/am-signoff'

"git am -s" has been taught that some input may end with a trailer
block that is not Signed-off-by: and it should refrain from adding
an extra blank line before adding a new sign-off in such a case.

* pw/am-signoff:
  am: fix signoff when other trailers are present

7 years agoMerge branch 'rs/t3700-clean-leftover'
Junio C Hamano [Tue, 22 Aug 2017 17:29:07 +0000 (10:29 -0700)] 
Merge branch 'rs/t3700-clean-leftover'

A test fix.

* rs/t3700-clean-leftover:
  t3700: fix broken test under !POSIXPERM

7 years agoMerge branch 'jc/perl-git-comment-typofix'
Junio C Hamano [Tue, 22 Aug 2017 17:29:06 +0000 (10:29 -0700)] 
Merge branch 'jc/perl-git-comment-typofix'

A comment fix.

* jc/perl-git-comment-typofix:
  perl/Git.pm: typofix in a comment

7 years agoMerge branch 'rs/in-obsd-basename-dirname-take-const'
Junio C Hamano [Tue, 22 Aug 2017 17:29:05 +0000 (10:29 -0700)] 
Merge branch 'rs/in-obsd-basename-dirname-take-const'

Portability fix.

* rs/in-obsd-basename-dirname-take-const:
  test-path-utils: handle const parameter of basename and dirname

7 years agoMerge branch 'rs/obsd-getcwd-workaround'
Junio C Hamano [Tue, 22 Aug 2017 17:29:04 +0000 (10:29 -0700)] 
Merge branch 'rs/obsd-getcwd-workaround'

Test portability fix for BSDs.

* rs/obsd-getcwd-workaround:
  t0001: skip test with restrictive permissions if getpwd(3) respects them

7 years agoMerge branch 'mf/no-dashed-subcommands'
Junio C Hamano [Tue, 22 Aug 2017 17:29:03 +0000 (10:29 -0700)] 
Merge branch 'mf/no-dashed-subcommands'

Code clean-up.

* mf/no-dashed-subcommands:
  scripts: use "git foo" not "git-foo"

7 years agoMerge branch 'ma/parse-maybe-bool'
Junio C Hamano [Tue, 22 Aug 2017 17:29:03 +0000 (10:29 -0700)] 
Merge branch 'ma/parse-maybe-bool'

Code clean-up.

* ma/parse-maybe-bool:
  parse_decoration_style: drop unused argument `var`
  treewide: deprecate git_config_maybe_bool, use git_parse_maybe_bool
  config: make git_{config,parse}_maybe_bool equivalent
  config: introduce git_parse_maybe_bool_text
  t5334: document that git push --signed=1 does not work
  Doc/git-{push,send-pack}: correct --sign= to --signed=

7 years agoMerge branch 'ab/ref-filter-no-contains'
Junio C Hamano [Tue, 22 Aug 2017 17:29:02 +0000 (10:29 -0700)] 
Merge branch 'ab/ref-filter-no-contains'

A test fix.

* ab/ref-filter-no-contains:
  tests: don't give unportable ">" to "test" built-in, use -gt

7 years agoMerge branch 'bw/clone-recursive-quiet'
Junio C Hamano [Tue, 22 Aug 2017 17:29:01 +0000 (10:29 -0700)] 
Merge branch 'bw/clone-recursive-quiet'

"git clone --recurse-submodules --quiet" did not pass the quiet
option down to submodules.

* bw/clone-recursive-quiet:
  clone: teach recursive clones to respect -q

7 years agoMerge branch 'bw/grep-recurse-submodules'
Junio C Hamano [Tue, 22 Aug 2017 17:29:01 +0000 (10:29 -0700)] 
Merge branch 'bw/grep-recurse-submodules'

"git grep --recurse-submodules" has been reworked to give a more
consistent output across submodule boundary (and do its thing
without having to fork a separate process).

* bw/grep-recurse-submodules:
  grep: recurse in-process using 'struct repository'
  submodule: merge repo_read_gitmodules and gitmodules_config
  submodule: check for unmerged .gitmodules outside of config parsing
  submodule: check for unstaged .gitmodules outside of config parsing
  submodule: remove fetch.recursesubmodules from submodule-config parsing
  submodule: remove submodule.fetchjobs from submodule-config parsing
  config: add config_from_gitmodules
  cache.h: add GITMODULES_FILE macro
  repository: have the_repository use the_index
  repo_read_index: don't discard the index

7 years agoMerge branch 'pw/sequence-rerere-autoupdate'
Junio C Hamano [Tue, 22 Aug 2017 17:29:00 +0000 (10:29 -0700)] 
Merge branch 'pw/sequence-rerere-autoupdate'

Commands like "git rebase" accepted the --rerere-autoupdate option
from the command line, but did not always use it.  This has been
fixed.

* pw/sequence-rerere-autoupdate:
  cherry-pick/revert: reject --rerere-autoupdate when continuing
  cherry-pick/revert: remember --rerere-autoupdate
  t3504: use test_commit
  rebase -i: honor --rerere-autoupdate
  rebase: honor --rerere-autoupdate
  am: remember --rerere-autoupdate setting

7 years agoMerge branch 'bw/push-options-recursively-to-submodules'
Junio C Hamano [Tue, 22 Aug 2017 17:29:00 +0000 (10:29 -0700)] 
Merge branch 'bw/push-options-recursively-to-submodules'

"git push --recurse-submodules $there HEAD:$target" was not
propagated down to the submodules, but now it is.

* bw/push-options-recursively-to-submodules:
  submodule--helper: teach push-check to handle HEAD

7 years agodoc: fix typo in sendemail.identity
Jeff King [Sun, 20 Aug 2017 09:46:57 +0000 (05:46 -0400)] 
doc: fix typo in sendemail.identity

Saying "the this" is an obvious typo. But while we're here,
let's polish the English on the second half of the sentence,
too.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodoc/interpret-trailers: fix "the this" typo
Martin Ågren [Sun, 20 Aug 2017 09:40:09 +0000 (05:40 -0400)] 
doc/interpret-trailers: fix "the this" typo

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoprogress: simplify "delayed" progress API
Junio C Hamano [Sat, 19 Aug 2017 17:39:41 +0000 (10:39 -0700)] 
progress: simplify "delayed" progress API

We used to expose the full power of the delayed progress API to the
callers, so that they can specify, not just the message to show and
expected total amount of work that is used to compute the percentage
of work performed so far, the percent-threshold parameter P and the
delay-seconds parameter N.  The progress meter starts to show at N
seconds into the operation only if we have not yet completed P per-cent
of the total work.

Most callers used either (0%, 2s) or (50%, 1s) as (P, N), but there
are oddballs that chose more random-looking values like 95%.

For a smoother workload, (50%, 1s) would allow us to start showing
the progress meter earlier than (0%, 2s), while keeping the chance
of not showing progress meter for long running operation the same as
the latter.  For a task that would take 2s or more to complete, it
is likely that less than half of it would complete within the first
second, if the workload is smooth.  But for a spiky workload whose
earlier part is easier, such a setting is likely to fail to show the
progress meter entirely and (0%, 2s) is more appropriate.

But that is merely a theory.  Realistically, it is of dubious value
to ask each codepath to carefully consider smoothness of their
workload and specify their own setting by passing two extra
parameters.  Let's simplify the API by dropping both parameters and
have everybody use (0%, 2s).

Oh, by the way, the percent-threshold parameter and the structure
member were consistently misspelled, which also is now fixed ;-)

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocommit: remove unused inline function single_parent()
René Scharfe [Sat, 19 Aug 2017 08:12:45 +0000 (10:12 +0200)] 
commit: remove unused inline function single_parent()

53b2c823f6 (revision walker: mini clean-up) added the function in 2007,
but it was never used, so we should be able to get rid of it now.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoDocumentation/git-for-each-ref: clarify peeling of tags for --format
Michael J Gruber [Fri, 18 Aug 2017 14:51:23 +0000 (16:51 +0200)] 
Documentation/git-for-each-ref: clarify peeling of tags for --format

`*` in format strings means peeling of tag objects so that object field
names refer to the object that the tag object points at, instead of the
tag object itself.

Currently, this is documented using grammar that is clearly inspired by
classical latin, though missing more than an article in order to be
classical english.

Try and straighten that explanation out a bit.

Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoDocumentation: use proper wording for ref format strings
Michael J Gruber [Fri, 18 Aug 2017 14:51:22 +0000 (16:51 +0200)] 
Documentation: use proper wording for ref format strings

Various commands list refs and allow to use a format string for the
output that interpolates from the ref as well as the object it points
at (for-each-ref; branch and tag in list mode).

Currently, the documentation talks about interpolating from the object.
This is confusing because a ref points to an object but not vice versa,
so the object cannot possible know %(refname), for example. Thus, this is
wrong independent of refs being objects (one day, maybe) or not.

Change the wording to make this clearer (and distinguish it from formats
for the log family).

Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-grep: correct exit code with --quiet and -L
Anthony Sottile [Fri, 18 Aug 2017 01:38:51 +0000 (18:38 -0700)] 
git-grep: correct exit code with --quiet and -L

The handling of `status_only` no longer interferes with the handling of
`unmatch_name_only`.  `--quiet` no longer affects the exit code when using
`-L`/`--files-without-match`.

Signed-off-by: Anthony Sottile <asottile@umich.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff: retire sane_truncate_fn
Junio C Hamano [Thu, 17 Aug 2017 17:27:28 +0000 (10:27 -0700)] 
diff: retire sane_truncate_fn

Long time ago, 23707811 ("diff: do not chomp hunk-header in the
middle of a character", 2008-01-02) introduced sane_truncate_line()
helper function to trim the "function header" line that is shown at
the end of the hunk header line, in order to avoid chomping it in
the middle of a single UTF-8 character.  It also added a facility to
define a custom callback function to make it possible to extend it
to non UTF-8 encodings.

During the following 8 1/2 years, nobody found need for this custom
callback facility.

A custom callback function is a wrong design to use here anyway---if
your contents need support for non UTF-8 encoding, you shouldn't
have to write a custom function and recompile Git to plumb it in.  A
better approach would be to extend sane_truncate_line() function and
have a new member in emit_callback to conditionally trigger it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofiles-backend: cheapen refname_available check when locking refs
Michael Haggerty [Thu, 17 Aug 2017 15:12:50 +0000 (17:12 +0200)] 
files-backend: cheapen refname_available check when locking refs

When locking references in preparation for updating them, we need to
check that none of the newly added references D/F conflict with
existing references (e.g., we don't allow `refs/foo` to be added if
`refs/foo/bar` already exists, or vice versa).

Prior to 524a9fdb51 (refs_verify_refname_available(): use function in
more places, 2017-04-16), conflicts with existing loose references
were checked by looking directly in the filesystem, and then conflicts
with existing packed references were checked by running
`verify_refname_available_dir()` against the packed-refs cache.

But that commit changed the final check to call
`refs_verify_refname_available()` against the *whole* files ref-store,
including both loose and packed references, with the following
comment:

> This means that those callsites now check for conflicts with all
> references rather than just packed refs, but the performance cost
> shouldn't be significant (and will be regained later).

That comment turned out to be too sanguine. User s@kazlauskas.me
reported that fetches involving a very large number of references in
neighboring directories were slowed down by that change.

The problem is that when fetching, each reference is updated
individually, within its own reference transaction. This is done
because some reference updates might succeed even though others fail.
But every time a reference update transaction is finished,
`clear_loose_ref_cache()` is called. So when it is time to update the
next reference, part of the loose ref cache has to be repopulated for
the `refs_verify_refname_available()` call. If the references are all
in neighboring directories, then the cost of repopulating the
reference cache increases with the number of references, resulting in
O(N²) effort.

The comment above also claims that the performance cost "will be
regained later". The idea was that once the packed-refs were finished
being split out into a separate ref-store, we could limit the
`refs_verify_refname_available()` call to the packed references again.
That is what we do now.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot5526: fix some broken && chains
Heiko Voigt [Thu, 17 Aug 2017 10:36:13 +0000 (12:36 +0200)] 
t5526: fix some broken && chains

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule.sh: remove unused variable
Stefan Beller [Wed, 16 Aug 2017 22:50:42 +0000 (15:50 -0700)] 
submodule.sh: remove unused variable

This could have been part of 48308681b0 (git submodule update: have a
dedicated helper for cloning, 2016-02-29).

Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff: define block by number of alphanumeric chars
Jonathan Tan [Wed, 16 Aug 2017 01:27:39 +0000 (18:27 -0700)] 
diff: define block by number of alphanumeric chars

The existing behavior of diff --color-moved=zebra does not define the
minimum size of a block at all, instead relying on a heuristic applied
later to filter out sets of adjacent moved lines that are shorter than 3
lines long. This can be confusing, because a block could thus be colored
as moved at the source but not at the destination (or vice versa),
depending on its neighbors.

Instead, teach diff that the minimum size of a block is 20 alphanumeric
characters, the same heuristic used by "git blame". This allows diff to
still exclude uninteresting lines appearing on their own (such as those
solely consisting of one or a few closing braces), as was the intention
of the adjacent-moved-line heuristic.

This requires a change in some tests in that some of their lines are no
longer considered to be part of a block, because they are too short.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff: respect MIN_BLOCK_LENGTH for last block
Jonathan Tan [Wed, 16 Aug 2017 01:27:38 +0000 (18:27 -0700)] 
diff: respect MIN_BLOCK_LENGTH for last block

Currently, MIN_BLOCK_LENGTH is only checked when diff encounters a line
that does not belong to the current block. In particular, this means
that MIN_BLOCK_LENGTH is not checked after all lines are encountered.

Perform that check.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocommit: skip discarding the index if there is no pre-commit hook
Kevin Willford [Mon, 14 Aug 2017 21:54:25 +0000 (15:54 -0600)] 
commit: skip discarding the index if there is no pre-commit hook

If there is not a pre-commit hook, there is no reason to discard
the index and reread it.

This change checks to presence of a pre-commit hook and then only
discards the index if there was one.

Signed-off-by: Kevin Willford <kewillf@microsoft.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosub-process: print the cmd when a capability is unsupported
Christian Couder [Wed, 16 Aug 2017 12:40:36 +0000 (14:40 +0200)] 
sub-process: print the cmd when a capability is unsupported

In handshake_capabilities() we use warning() when a capability
is not supported, so the exit code of the function is 0 and no
further error is shown. This is a problem because the warning
message doesn't tell us which subprocess cmd failed.

On the contrary if we cannot write a packet from this function,
we use error() and then subprocess_start() outputs:

    initialization for subprocess '<cmd>' failed

so we can know which subprocess cmd failed.

Let's improve the warning() message, so that we can know which
subprocess cmd failed.

Helped-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosha1_file: make read_info_alternates static
Stefan Beller [Tue, 15 Aug 2017 20:13:19 +0000 (13:13 -0700)] 
sha1_file: make read_info_alternates static

read_info_alternates is not used from outside, so let's make it static.

We have to declare the function before link_alt_odb_entry instead of
moving the code around, link_alt_odb_entry calls read_info_alternates,
which in turn calls link_alt_odb_entry.

Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot1002: stop using sum(1)
René Scharfe [Mon, 14 Aug 2017 20:16:34 +0000 (22:16 +0200)] 
t1002: stop using sum(1)

sum(1) is a command for calculating checksums of the contents of files.
It was part of early editions of Unix ("Research Unix", 1972/1973, [1]).
cksum(1) appeared in 4.4BSD (1993) as a replacement [2], and became part
of POSIX.1-2008 [3].  OpenBSD 5.6 (2014) removed sum(1).

We only use sum(1) in t1002 to check for changes in three files.  On
MinGW we use md5sum(1) instead.  We could switch to the standard command
cksum(1) for all platforms; MinGW comes with GNU coreutils now, which
provides sum(1), cksum(1) and md5sum(1).  Use our standard method for
checking for file changes instead: test_cmp.

It's more convenient because it shows differences nicely, it's faster on
MinGW because we have a special implementation there based only on
shell-internal commands, it's simpler as it allows us to avoid stripping
out unnecessary entries from the checksum file using grep(1), and it's
more consistent with the rest of the test suite.

We already compare changed files with their expected new contents using
diff(1), so we don't need to check with "test_must_fail test_cmp" if
they differ from their original state.  A later patch could convert the
direct diff(1) calls to test_cmp as well.

With all sum(1) calls gone, remove the MinGW-specific implementation
from test-lib.sh as well.

[1] http://minnie.tuhs.org/cgi-bin/utree.pl?file=V3/man/man1/sum.1
[2] http://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/share/man/cat1/cksum.0
[3] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cksum.html

Signed-off-by: René Scharfe <l.s.r@web.de>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopretty: support normalization options for %(trailers)
Jeff King [Tue, 15 Aug 2017 10:25:27 +0000 (06:25 -0400)] 
pretty: support normalization options for %(trailers)

The interpret-trailers command recently learned some options
to make its output easier to parse (for a caller whose only
interested in picking out the trailer values). But it's not
very efficient for asking for the trailers of many commits
in a single invocation.

We already have "%(trailers)" to do that, but it doesn't
know about unfolding or omitting non-trailers. Let's plumb
those options through, so you can have the best of both.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot4205: refactor %(trailers) tests
Jeff King [Tue, 15 Aug 2017 10:24:39 +0000 (06:24 -0400)] 
t4205: refactor %(trailers) tests

We currently have one test for %(trailers). In preparation
for more, let's refactor a few bits:

  - move the commit creation to its own setup step so it can
    be reused by multiple tests

  - add a trailer with whitespace continuation (to confirm
    that it is left untouched)

  - fix the sample text which claims the placeholder is %bT.
    This was switched long ago to %(trailers)

  - replace one "cat" with an "echo" when generating the
    expected output. This saves a process (and sets a better
    pattern for future tests to follow).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopretty: move trailer formatting to trailer.c
Jeff King [Tue, 15 Aug 2017 10:23:56 +0000 (06:23 -0400)] 
pretty: move trailer formatting to trailer.c

The next commit will add many features to the %(trailer)
placeholder in pretty.c. We'll need to access some internal
functions of trailer.c for that, so our options are either:

  1. expose those functions publicly

or

  2. make an entry point into trailer.c to do the formatting

Doing (2) ends up exposing less surface area, though do note
that caveats in the docstring of the new function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agointerpret-trailers: add --parse convenience option
Jeff King [Tue, 15 Aug 2017 10:23:34 +0000 (06:23 -0400)] 
interpret-trailers: add --parse convenience option

The last few commits have added command line options that
can turn interpret-trailers into a parsing tool. Since
they'd most often be used together, let's provide a
convenient single option for callers to invoke this mode.

This is implemented as a callback rather than a boolean so
that its effect is applied immediately, as if those options
had been specified. Later options can then override them.
E.g.:

  git interpret-trailers --parse --no-unfold

would work.

Let's also update the documentation to make clear that this
parsing mode behaves quite differently than the normal
"add trailers to the input" mode.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agointerpret-trailers: add an option to unfold values
Jeff King [Tue, 15 Aug 2017 10:23:29 +0000 (06:23 -0400)] 
interpret-trailers: add an option to unfold values

The point of "--only-trailers" is to give a caller an output
that's easy for them to parse. Getting rid of the
non-trailer material helps, but we still may see more
complicated syntax like whitespace continuation. Let's add
an option to unfold any continuation, giving the output as a
single "key: value" line per trailer.

As a bonus, this could be used even without --only-trailers
to clean up unusual formatting in the incoming data.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agointerpret-trailers: add an option to show only existing trailers
Jeff King [Tue, 15 Aug 2017 10:23:25 +0000 (06:23 -0400)] 
interpret-trailers: add an option to show only existing trailers

It can be useful to invoke interpret-trailers for the
primary purpose of parsing existing trailers. But in that
case, we don't want to apply existing ifMissing or ifExists
rules from the config. Let's add a special mode where we
avoid applying those rules. Coupled with --only-trailers,
this gives us a reasonable parsing tool.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agointerpret-trailers: add an option to show only the trailers
Jeff King [Tue, 15 Aug 2017 10:23:21 +0000 (06:23 -0400)] 
interpret-trailers: add an option to show only the trailers

In theory it's easy for any reader who wants to parse
trailers to do so. But there are a lot of subtle corner
cases around what counts as a trailer, when the trailer
block begins and ends, etc. Since interpret-trailers already
has our parsing logic, let's let callers ask it to just
output the trailers.

They still have to parse the "key: value" lines, but at
least they can ignore all of the other corner cases.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodoc: clarify "config --bool" behaviour with empty string
Andreas Heiduk [Mon, 14 Aug 2017 22:12:18 +0000 (00:12 +0200)] 
doc: clarify "config --bool" behaviour with empty string

`git config --bool xxx.yyy` returns `true` for `[xxx]yyy` but
`false` for `[xxx]yyy=` or `[xxx]yyy=""`.  This is tested in
t1300-repo-config.sh since 09bc098c2.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>