git
6 years agoMerge branch 'rs/apply-fuzzy-match-fix'
Junio C Hamano [Tue, 21 Nov 2017 05:07:52 +0000 (14:07 +0900)] 
Merge branch 'rs/apply-fuzzy-match-fix'

A fix for an ancient bug in "git apply --ignore-space-change" codepath.

* rs/apply-fuzzy-match-fix:
  apply: avoid out-of-bounds access in fuzzy_matchlines()

6 years agoMerge branch 'ad/submitting-patches-title-decoration'
Junio C Hamano [Tue, 21 Nov 2017 05:07:51 +0000 (14:07 +0900)] 
Merge branch 'ad/submitting-patches-title-decoration'

Doc update around use of "format-patch --subject-prefix" etc.

* ad/submitting-patches-title-decoration:
  doc/SubmittingPatches: correct subject guidance

6 years agoMerge branch 'av/fsmonitor'
Junio C Hamano [Tue, 21 Nov 2017 05:07:51 +0000 (14:07 +0900)] 
Merge branch 'av/fsmonitor'

Various fixes to bp/fsmonitor topic.

* av/fsmonitor:
  fsmonitor: simplify determining the git worktree under Windows
  fsmonitor: store fsmonitor bitmap before splitting index
  fsmonitor: read from getcwd(), not the PWD environment variable
  fsmonitor: delay updating state until after split index is merged
  fsmonitor: document GIT_TRACE_FSMONITOR
  fsmonitor: don't bother pretty-printing JSON from watchman
  fsmonitor: set the PWD to the top of the working tree

6 years agoMerge branch 'bp/fsmonitor'
Junio C Hamano [Tue, 21 Nov 2017 05:07:50 +0000 (14:07 +0900)] 
Merge branch 'bp/fsmonitor'

We learned to talk to watchman to speed up "git status" and other
operations that need to see which paths have been modified.

* bp/fsmonitor:
  fsmonitor: preserve utf8 filenames in fsmonitor-watchman log
  fsmonitor: read entirety of watchman output
  fsmonitor: MINGW support for watchman integration
  fsmonitor: add a performance test
  fsmonitor: add a sample integration script for Watchman
  fsmonitor: add test cases for fsmonitor extension
  split-index: disable the fsmonitor extension when running the split index test
  fsmonitor: add a test tool to dump the index extension
  update-index: add fsmonitor support to update-index
  ls-files: Add support in ls-files to display the fsmonitor valid bit
  fsmonitor: add documentation for the fsmonitor extension.
  fsmonitor: teach git to optionally utilize a file system monitor to speed up detecting new or changed files.
  update-index: add a new --force-write-index option
  preload-index: add override to enable testing preload-index
  bswap: add 64 bit endianness helper get_be64

6 years agogit-jump: give contact instructions in the README
Jeff King [Mon, 20 Nov 2017 19:18:46 +0000 (14:18 -0500)] 
git-jump: give contact instructions in the README

Let's make it clear how patches should flow into
contrib/git-jump. The normal Git maintainer does not
necessarily care about things in contrib/, and authors of
individual components should be the ones giving the final
review/ack for a patch. Ditto for bug reports, which are
likely to get more attention from the area expert.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocontrib/git-jump: allow to configure the grep command
Beat Bolli [Sun, 19 Nov 2017 23:05:36 +0000 (00:05 +0100)] 
contrib/git-jump: allow to configure the grep command

Add the configuration option "jump.grepCmd" that allows to configure the
command that is used to search in grep mode. This allows the users of
git-jump to use ag(1) or ack(1) as search engines.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoSync with maint
Junio C Hamano [Wed, 15 Nov 2017 03:17:43 +0000 (12:17 +0900)] 
Sync with maint

6 years agoRelNotes: the fourth batch for 2.16
Junio C Hamano [Wed, 15 Nov 2017 03:17:08 +0000 (12:17 +0900)] 
RelNotes: the fourth batch for 2.16

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'bp/read-index-from-skip-verification'
Junio C Hamano [Wed, 15 Nov 2017 03:14:37 +0000 (12:14 +0900)] 
Merge branch 'bp/read-index-from-skip-verification'

Drop (perhaps overly cautious) sanity check before using the index
read from the filesystem at runtime.

* bp/read-index-from-skip-verification:
  read_index_from(): speed index loading by skipping verification of the entry order

6 years agoMerge branch 'bc/submitting-patches-in-asciidoc'
Junio C Hamano [Wed, 15 Nov 2017 03:14:36 +0000 (12:14 +0900)] 
Merge branch 'bc/submitting-patches-in-asciidoc'

The SubmittingPatches document has been converted to produce an
HTML version via AsciiDoc/Asciidoctor.

* bc/submitting-patches-in-asciidoc:
  Documentation: convert SubmittingPatches to AsciiDoc
  Documentation: enable compat-mode for Asciidoctor

6 years agoMerge branch 'sb/bisect-run-empty'
Junio C Hamano [Wed, 15 Nov 2017 03:14:36 +0000 (12:14 +0900)] 
Merge branch 'sb/bisect-run-empty'

"git bisect run" that did not specify any command to run used to go
ahead and treated all commits to be tested as 'good'.  This has
been corrected by making the command error out.

* sb/bisect-run-empty:
  bisect run: die if no command is given

6 years agoMerge branch 'rd/bisect-view-is-visualize'
Junio C Hamano [Wed, 15 Nov 2017 03:14:36 +0000 (12:14 +0900)] 
Merge branch 'rd/bisect-view-is-visualize'

Doc and message updates to teach users "bisect view" is a synonym
for "bisect visualize".

* rd/bisect-view-is-visualize:
  bisect: mention "view" as an alternative to "visualize"

6 years agoMerge branch 'jk/info-alternates-fix'
Junio C Hamano [Wed, 15 Nov 2017 03:14:36 +0000 (12:14 +0900)] 
Merge branch 'jk/info-alternates-fix'

We used to add an empty alternate object database to the system
that does not help anything; it has been corrected.

* jk/info-alternates-fix:
  link_alt_odb_entries: make empty input a noop

6 years agoMerge branch 'cb/t4201-robustify'
Junio C Hamano [Wed, 15 Nov 2017 03:14:35 +0000 (12:14 +0900)] 
Merge branch 'cb/t4201-robustify'

A test update.

* cb/t4201-robustify:
  t4201: make use of abbreviation in the test more robust

6 years agoMerge branch 'ab/pcre-v2'
Junio C Hamano [Wed, 15 Nov 2017 03:14:34 +0000 (12:14 +0900)] 
Merge branch 'ab/pcre-v2'

Building with NO_LIBPCRE1_JIT did not disable it, which has been fixed.

* ab/pcre-v2:
  grep: fix NO_LIBPCRE1_JIT to fully disable JIT

6 years agoMerge branch 'tz/fsf-address-update'
Junio C Hamano [Wed, 15 Nov 2017 03:14:33 +0000 (12:14 +0900)] 
Merge branch 'tz/fsf-address-update'

* tz/fsf-address-update:
  Replace Free Software Foundation address in license notices
  Replace Free Software Foundation address in license notices

6 years agoMerge branch 'ad/rebase-i-serie-typofix'
Junio C Hamano [Wed, 15 Nov 2017 03:14:33 +0000 (12:14 +0900)] 
Merge branch 'ad/rebase-i-serie-typofix'

* ad/rebase-i-serie-typofix:
  rebase -i: fix comment typo

6 years agoMerge branch 'ab/mediawiki-namespace'
Junio C Hamano [Wed, 15 Nov 2017 03:14:32 +0000 (12:14 +0900)] 
Merge branch 'ab/mediawiki-namespace'

The remote-helper for talking to MediaWiki has been updated to
work with mediawiki namespaces.

* ab/mediawiki-namespace:
  remote-mediawiki: show progress while fetching namespaces
  remote-mediawiki: process namespaces in order
  remote-mediawiki: support fetching from (Main) namespace
  remote-mediawiki: skip virtual namespaces
  remote-mediawiki: show known namespace choices on failure
  remote-mediawiki: allow fetching namespaces with spaces
  remote-mediawiki: add namespace support

6 years agoMerge branch 'ma/reduce-heads-leakfix'
Junio C Hamano [Wed, 15 Nov 2017 03:14:32 +0000 (12:14 +0900)] 
Merge branch 'ma/reduce-heads-leakfix'

Leak fixes.

* ma/reduce-heads-leakfix:
  reduce_heads: fix memory leaks
  builtin/merge-base: free commit lists

6 years agoMerge branch 'js/for-each-ref-remote-name-and-ref'
Junio C Hamano [Wed, 15 Nov 2017 03:14:32 +0000 (12:14 +0900)] 
Merge branch 'js/for-each-ref-remote-name-and-ref'

The "--format=..." option "git for-each-ref" takes learned to show
the name of the 'remote' repository and the ref at the remote side
that is affected for 'upstream' and 'push' via "%(push:remotename)"
and friends.

* js/for-each-ref-remote-name-and-ref:
  for-each-ref: test :remotename and :remoteref
  for-each-ref: let upstream/push report the remote ref name
  for-each-ref: let upstream/push optionally report the remote name

6 years agoMerge branch 'jt/submodule-tests-cleanup'
Junio C Hamano [Wed, 15 Nov 2017 03:14:31 +0000 (12:14 +0900)] 
Merge branch 'jt/submodule-tests-cleanup'

* jt/submodule-tests-cleanup:
  Tests: clean up and document submodule helpers

6 years agoMerge branch 'cc/git-packet-pm'
Junio C Hamano [Wed, 15 Nov 2017 03:14:31 +0000 (12:14 +0900)] 
Merge branch 'cc/git-packet-pm'

Parts of a test to drive the long-running content filter interface
has been split into its own module, hopefully to eventually become
reusable.

* cc/git-packet-pm:
  Git/Packet.pm: extract parts of t0021/rot13-filter.pl for reuse
  t0021/rot13-filter: add capability functions
  t0021/rot13-filter: refactor checking final lf
  t0021/rot13-filter: add packet_initialize()
  t0021/rot13-filter: improve error message
  t0021/rot13-filter: improve 'if .. elsif .. else' style
  t0021/rot13-filter: refactor packet reading functions
  t0021/rot13-filter: fix list comparison

6 years agoMerge branch 'bw/rebase-i-ignored-submodule-fix'
Junio C Hamano [Wed, 15 Nov 2017 03:14:30 +0000 (12:14 +0900)] 
Merge branch 'bw/rebase-i-ignored-submodule-fix'

"git rebase -i" recently started misbehaving when a submodule that
is configured with 'submodule.<name>.ignore' is dirty; this has
been corrected.

* bw/rebase-i-ignored-submodule-fix:
  wt-status: actually ignore submodules when requested

6 years agoMerge branch 'mh/tidy-ref-update-flags'
Junio C Hamano [Wed, 15 Nov 2017 03:14:29 +0000 (12:14 +0900)] 
Merge branch 'mh/tidy-ref-update-flags'

Code clean-up in refs API implementation.

* mh/tidy-ref-update-flags:
  refs: update some more docs to use "oid" rather than "sha1"
  write_packed_entry(): take `object_id` arguments
  refs: rename constant `REF_ISPRUNING` to `REF_IS_PRUNING`
  refs: rename constant `REF_NODEREF` to `REF_NO_DEREF`
  refs: tidy up and adjust visibility of the `ref_update` flags
  ref_transaction_add_update(): remove a check
  ref_transaction_update(): die on disallowed flags
  prune_ref(): call `ref_transaction_add_update()` directly
  files_transaction_prepare(): don't leak flags to packed transaction

6 years agoMerge branch 'sr/wrapper-quote-filenames'
Junio C Hamano [Wed, 15 Nov 2017 03:14:29 +0000 (12:14 +0900)] 
Merge branch 'sr/wrapper-quote-filenames'

Some error messages did not quote filenames shown in it, which have
been fixed.

* sr/wrapper-quote-filenames:
  wrapper.c: consistently quote filenames in error messages

6 years agoMerge branch 'ma/bisect-leakfix'
Junio C Hamano [Wed, 15 Nov 2017 03:14:28 +0000 (12:14 +0900)] 
Merge branch 'ma/bisect-leakfix'

Leak fixes.

* ma/bisect-leakfix:
  bisect: fix memory leak when returning best element
  bisect: fix off-by-one error in `best_bisection_sorted()`
  bisect: fix memory leak in `find_bisection()`
  bisect: change calling-convention of `find_bisection()`

6 years agoMerge branch 'rs/sequencer-rewrite-file-cleanup'
Junio C Hamano [Wed, 15 Nov 2017 03:14:28 +0000 (12:14 +0900)] 
Merge branch 'rs/sequencer-rewrite-file-cleanup'

Code cleanup.

* rs/sequencer-rewrite-file-cleanup:
  sequencer.c: check return value of close() in rewrite_file()
  sequencer: use O_TRUNC to truncate files
  sequencer: factor out rewrite_file()

6 years agoMerge branch 'ao/merge-verbosity-getenv-just-once'
Junio C Hamano [Wed, 15 Nov 2017 03:14:28 +0000 (12:14 +0900)] 
Merge branch 'ao/merge-verbosity-getenv-just-once'

Code cleanup.

* ao/merge-verbosity-getenv-just-once:
  merge-recursive: check GIT_MERGE_VERBOSITY only once

6 years agoMerge branch 'mh/avoid-rewriting-packed-refs'
Junio C Hamano [Wed, 15 Nov 2017 03:14:27 +0000 (12:14 +0900)] 
Merge branch 'mh/avoid-rewriting-packed-refs'

Recent update to the refs infrastructure implementation started
rewriting packed-refs file more often than before; this has been
optimized again for most trivial cases.

* mh/avoid-rewriting-packed-refs:
  files-backend: don't rewrite the `packed-refs` file unnecessarily
  t1409: check that `packed-refs` is not rewritten unnecessarily

6 years agoMerge branch 'rs/imap-send-next-arg-fix'
Junio C Hamano [Wed, 15 Nov 2017 03:14:26 +0000 (12:14 +0900)] 
Merge branch 'rs/imap-send-next-arg-fix'

Error checking in "git imap-send" for empty response has been
improved.

* rs/imap-send-next-arg-fix:
  imap-send: handle missing response codes gracefully
  imap-send: handle NULL return of next_arg()

6 years agoMerge branch 'ab/mediawiki-name-truncation'
Junio C Hamano [Wed, 15 Nov 2017 03:14:25 +0000 (12:14 +0900)] 
Merge branch 'ab/mediawiki-name-truncation'

The remote-helper for talking to MediaWiki has been updated to
truncate an overlong pagename so that ".mw" suffix can still be
added.

* ab/mediawiki-name-truncation:
  remote-mediawiki: limit filenames to legal

6 years agoStart preparation for 2.15.1
Junio C Hamano [Wed, 15 Nov 2017 03:04:22 +0000 (12:04 +0900)] 
Start preparation for 2.15.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ks/mailmap' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:05:04 +0000 (12:05 +0900)] 
Merge branch 'ks/mailmap' into maint

* ks/mailmap:
  mailmap: use Kaartic Sivaraam's new address

6 years agoMerge branch 'jm/relnotes-2.15-typofix' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:05:04 +0000 (12:05 +0900)] 
Merge branch 'jm/relnotes-2.15-typofix' into maint

Typofix.

* jm/relnotes-2.15-typofix:
  fix typos in 2.15.0 release notes

6 years agoMerge branch 'cn/diff-indent-no-longer-is-experimental' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:05:04 +0000 (12:05 +0900)] 
Merge branch 'cn/diff-indent-no-longer-is-experimental' into maint

Doc update.

* cn/diff-indent-no-longer-is-experimental:
  diff: --indent-heuristic is no longer experimental

6 years agoMerge branch 'js/mingw-redirect-std-handles' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:05:03 +0000 (12:05 +0900)] 
Merge branch 'js/mingw-redirect-std-handles' into maint

MinGW updates.

* js/mingw-redirect-std-handles:
  mingw: document the standard handle redirection
  mingw: optionally redirect stderr/stdout via the same handle
  mingw: add experimental feature to redirect standard handles

6 years agoMerge branch 'js/wincred-empty-cred' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:05:03 +0000 (12:05 +0900)] 
Merge branch 'js/wincred-empty-cred' into maint

MinGW updates.

* js/wincred-empty-cred:
  wincred: handle empty username/password correctly
  t0302: check helper can handle empty credentials

6 years agoMerge branch 'js/mingw-full-version-in-resources' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:05:03 +0000 (12:05 +0900)] 
Merge branch 'js/mingw-full-version-in-resources' into maint

MinGW updates.

* js/mingw-full-version-in-resources:
  mingw: include the full version information in the resources

6 years agoMerge branch 'dk/libsecret-unlock-to-load-fix' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:05:02 +0000 (12:05 +0900)] 
Merge branch 'dk/libsecret-unlock-to-load-fix' into maint

The credential helper for libsecret (in contrib/) has been improved
to allow possibly prompting the end user to unlock secrets that are
currently locked (otherwise the secrets may not be loaded).

* dk/libsecret-unlock-to-load-fix:
  credential-libsecret: unlock locked secrets

6 years agoMerge branch 'js/early-config' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:05:01 +0000 (12:05 +0900)] 
Merge branch 'js/early-config' into maint

Correct start-up sequence so that a repository could be placed
immediately under the root directory again (which was broken at
around Git 2.13).

* js/early-config:
  setup: avoid double slashes when looking for HEAD

6 years agoMerge branch 'ad/5580-unc-tests-on-cygwin' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:05:00 +0000 (12:05 +0900)] 
Merge branch 'ad/5580-unc-tests-on-cygwin' into maint

UNC paths are also relevant in Cygwin builds and they are now
tested just like Mingw builds.

* ad/5580-unc-tests-on-cygwin:
  t5580: add Cygwin support

6 years agoMerge branch 'ao/diff-populate-filespec-lstat-errorpath-fix' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:59 +0000 (12:04 +0900)] 
Merge branch 'ao/diff-populate-filespec-lstat-errorpath-fix' into maint

After an error from lstat(), diff_populate_filespec() function
sometimes still went ahead and used invalid data in struct stat,
which has been fixed.

* ao/diff-populate-filespec-lstat-errorpath-fix:
  diff: fix lstat() error handling in diff_populate_filespec()

6 years agoMerge branch 'sb/blame-config-doc' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:59 +0000 (12:04 +0900)] 
Merge branch 'sb/blame-config-doc' into maint

Description of blame.{showroot,blankboundary,showemail,date}
configuration variables have been added to "git config --help".

* sb/blame-config-doc:
  config: document blame configuration

6 years agoMerge branch 'tb/complete-checkout' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:58 +0000 (12:04 +0900)] 
Merge branch 'tb/complete-checkout' into maint

Command line completion (in contrib/) update.

* tb/complete-checkout:
  completion: add remaining flags to checkout

6 years agoMerge branch 'jc/check-ref-format-oor' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:57 +0000 (12:04 +0900)] 
Merge branch 'jc/check-ref-format-oor' into maint

"git check-ref-format --branch @{-1}" bit a "BUG()" when run
outside a repository for obvious reasons; clarify the documentation
and make sure we do not even try to expand the at-mark magic in
such a case, but still call the validation logic for branch names.

* jc/check-ref-format-oor:
  check-ref-format doc: --branch validates and expands <branch>
  check-ref-format --branch: strip refs/heads/ using skip_prefix
  check-ref-format --branch: do not expand @{...} outside repository

6 years agoMerge branch 'jc/t5601-copy-workaround' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:56 +0000 (12:04 +0900)] 
Merge branch 'jc/t5601-copy-workaround' into maint

A (possibly flakey) test fix.

* jc/t5601-copy-workaround:
  t5601: rm the target file of cp that could still be executing

6 years agoMerge branch 'jk/rebase-i-exec-gitdir-fix' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:56 +0000 (12:04 +0900)] 
Merge branch 'jk/rebase-i-exec-gitdir-fix' into maint

A recent regression in "git rebase -i" that broke execution of git
commands from subdirectories via "exec" insn has been fixed.

* jk/rebase-i-exec-gitdir-fix:
  sequencer: pass absolute GIT_DIR to exec commands

6 years agoMerge branch 'bw/grep-recurse-submodules' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:55 +0000 (12:04 +0900)] 
Merge branch 'bw/grep-recurse-submodules' into maint

A broken access to object databases in recent update to "git grep
--recurse-submodules" has been fixed.

* bw/grep-recurse-submodules:
  grep: take the read-lock when adding a submodule

6 years agoMerge branch 'js/submodule-in-excluded' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:54 +0000 (12:04 +0900)] 
Merge branch 'js/submodule-in-excluded' into maint

"git status --ignored -u" did not stop at a working tree of a
separate project that is embedded in an ignored directory and
listed files in that other project, instead of just showing the
directory itself as ignored.

* js/submodule-in-excluded:
  status: do not get confused by submodules in excluded directories

6 years agoMerge branch 'ao/check-resolve-ref-unsafe-result' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:53 +0000 (12:04 +0900)] 
Merge branch 'ao/check-resolve-ref-unsafe-result' into maint

"git commit", after making a commit, did not check for errors when
asking on what branch it made the commit, which has been correted.

* ao/check-resolve-ref-unsafe-result:
  commit: check result of resolve_ref_unsafe

6 years agoMerge branch 'jk/misc-resolve-ref-unsafe-fixes' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:52 +0000 (12:04 +0900)] 
Merge branch 'jk/misc-resolve-ref-unsafe-fixes' into maint

Some codepaths did not check for errors when asking what branch the
HEAD points at, which have been fixed.

* jk/misc-resolve-ref-unsafe-fixes:
  worktree: handle broken symrefs in find_shared_symref()
  log: handle broken HEAD in decoration check
  remote: handle broken symrefs
  test-ref-store: avoid passing NULL to printf

6 years agoMerge branch 'sb/diff-color-moved-use-xdl-recmatch' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:52 +0000 (12:04 +0900)] 
Merge branch 'sb/diff-color-moved-use-xdl-recmatch' into maint

Instead of using custom line comparison and hashing functions to
implement "moved lines" coloring in the diff output, use the pair
of these functions from lower-layer xdiff/ code.

* sb/diff-color-moved-use-xdl-recmatch:
  diff.c: get rid of duplicate implementation
  xdiff-interface: export comparing and hashing strings

6 years agoMerge branch 'jk/diff-color-moved-fix' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:51 +0000 (12:04 +0900)] 
Merge branch 'jk/diff-color-moved-fix' into maint

The experimental "color moved lines differently in diff output"
feature was buggy around "ignore whitespace changes" edges, whihch
has been corrected.

* jk/diff-color-moved-fix:
  diff: handle NULs in get_string_hash()
  diff: fix whitespace-skipping with --color-moved
  t4015: test the output of "diff --color-moved -b"
  t4015: check "negative" case for "-w --color-moved"
  t4015: refactor --color-moved whitespace test

6 years agoMerge branch 'kd/auto-col-with-pager-fix' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:50 +0000 (12:04 +0900)] 
Merge branch 'kd/auto-col-with-pager-fix' into maint

"auto" as a value for the columnar output configuration ought to
judge "is the output consumed by humans?" with the same criteria as
"auto" for coloured output configuration, i.e. either the standard
output stream is going to tty, or a pager is in use.  We forgot the
latter, which has been fixed.

* kd/auto-col-with-pager-fix:
  column: do not include pager.c
  column: show auto columns when pager is active

6 years agoMerge branch 'sg/travis-fixes' into maint
Junio C Hamano [Wed, 15 Nov 2017 03:04:49 +0000 (12:04 +0900)] 
Merge branch 'sg/travis-fixes' into maint

TravisCI build updates.

* sg/travis-fixes:
  travis-ci: don't build Git for the static analysis job
  travis-ci: fix running P4 and Git LFS tests in Linux build jobs

6 years agoMerge branch 'jm/status-ignored-files-list'
Junio C Hamano [Mon, 13 Nov 2017 05:44:59 +0000 (14:44 +0900)] 
Merge branch 'jm/status-ignored-files-list'

The set of paths output from "git status --ignored" was tied
closely with its "--untracked=<mode>" option, but now it can be
controlled more flexibly.  Most notably, a directory that is
ignored because it is listed to be ignored in the ignore/exclude
mechanism can be handled differently from a directory that ends up
to be ignored only because all files in it are ignored.

* jm/status-ignored-files-list:
  status: test ignored modes
  status: document options to show matching ignored files
  status: report matching ignored and normal untracked
  status: add option to show ignored files differently

6 years agolink_alt_odb_entries: make empty input a noop
Jeff King [Sun, 12 Nov 2017 10:27:39 +0000 (10:27 +0000)] 
link_alt_odb_entries: make empty input a noop

If an empty string is passed to link_alt_odb_entries(), our
loop finds no entries and we link nothing. But we still do
some preparatory work to normalize the object directory
path, even though we'll never look at the result. This
triggers in basically every git process, since we feed the
usually-empty ALTERNATE_DB_ENVIRONMENT to the function.

Let's detect early that there's nothing to do and return.
While we're at it, let's treat NULL the same as an empty
string as a favor to our callers. That saves
prepare_alt_odb() from having to cover this case.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoDocumentation: convert SubmittingPatches to AsciiDoc
brian m. carlson [Sun, 12 Nov 2017 22:07:18 +0000 (22:07 +0000)] 
Documentation: convert SubmittingPatches to AsciiDoc

The SubmittingPatches document is often cited by outside parties as an
example of good practices to follow, including logical, independent
commits; patch sign-offs; and sending patches to a mailing list.
Currently, people who want to cite a particular section tend to either
refer to it by name and let the interested party search through the
document to find it, or link to a given line number on GitHub and hope
the file doesn't change.

Instead, convert the document to AsciiDoc.  Build it as part of the
technical documentation, since it is likely of interest to the same
group of people.  Provide stable links to the sections which outside
parties are likely to want to link to.  Make some minor structural
changes to organize it so that it can be formatted sanely.

Since the makefile needs a .txt extension in order to build with the
rest of the documentation, simply copy the file.  Ignore the temporary
file so it doesn't get checked in accidentally, and remove it as part of
the clean process.  Do this instead of renaming the file so that people
who have already linked to the documentation (who we're trying to help)
don't find their links broken.  Avoid symlinking since Windows will not
like that.

This allows us to render the document as part of the website for the
benefit of others who wish to link to it as well as providing a more
nicely formatted display for our community and potential contributors.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobisect run: die if no command is given
Stephan Beyer [Sun, 12 Nov 2017 20:55:33 +0000 (21:55 +0100)] 
bisect run: die if no command is given

It was possible to invoke "git bisect run" without any command.
This considers all commits as good commits since "$@"'s return
value for empty $@ is 0.

This is most probably not what a user wants (otherwise she would
invoke "git bisect run true"), so not providing a command now
results in an error.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogrep: fix NO_LIBPCRE1_JIT to fully disable JIT
Charles Bailey [Sun, 12 Nov 2017 16:59:38 +0000 (16:59 +0000)] 
grep: fix NO_LIBPCRE1_JIT to fully disable JIT

If you have a pcre1 library which is compiled with JIT enabled then
PCRE_STUDY_JIT_COMPILE will be defined whether or not the
NO_LIBPCRE1_JIT configuration is set.

This means that we enable JIT functionality when calling pcre_study
even if NO_LIBPCRE1_JIT has been explicitly set and we just use plain
pcre_exec later.

Fix this by using own macro (GIT_PCRE_STUDY_JIT_COMPILE) which we set to
PCRE_STUDY_JIT_COMPILE only if NO_LIBPCRE1_JIT is not set and define to
0 otherwise, as before.

Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot4201: make use of abbreviation in the test more robust
Charles Bailey [Sun, 12 Nov 2017 15:25:23 +0000 (15:25 +0000)] 
t4201: make use of abbreviation in the test more robust

The test for '--abbrev' in t4201-shortlog.sh assumes that the commits
generated in the test can always be uniquely abbreviated to 5 hex digits
but this is not always the case. If you were unlucky and happened to run
the test at (say) Thu Jun 22 03:04:49 2017 +0000, you would find that
the first commit generated would collide with a tree object created
later in the same test.

This can be simulated in the version of t4201-shortlog.sh prior to this
commit by setting GIT_COMMITTER_DATE and GIT_AUTHOR_DATE to 1498100689
after sourcing test-lib.sh.

Change the test to test --abbrev=35 instead of --abbrev=5 to almost
completely avoid the possibility of a partial collision and add a call
to test_tick in the setup to make the test repeatable (the latter alone
is sufficient to make it robust enough).

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobisect: mention "view" as an alternative to "visualize"
Robert P. J. Day [Sun, 12 Nov 2017 09:30:38 +0000 (04:30 -0500)] 
bisect: mention "view" as an alternative to "visualize"

Tweak a small number of files to mention "view" as an alternative to
"visualize".

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofsmonitor: simplify determining the git worktree under Windows
Ben Peart [Fri, 10 Nov 2017 21:03:11 +0000 (16:03 -0500)] 
fsmonitor: simplify determining the git worktree under Windows

Simplify and speed up the process of finding the git worktree when
running on Windows by keeping it in perl and avoiding spawning helper
processes.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoapply: avoid out-of-bounds access in fuzzy_matchlines()
René Scharfe [Sat, 11 Nov 2017 14:10:19 +0000 (15:10 +0100)] 
apply: avoid out-of-bounds access in fuzzy_matchlines()

fuzzy_matchlines() uses a pointers to the first and last characters of
two lines to keep track while matching them.  This makes it impossible
to deal with empty strings.  It accesses characters before the start of
empty lines.  It can also access characters after the end when checking
for trailing whitespace in the main loop.

Avoid that by using pointers to the first character and the one *after*
the last one.  This is well-defined as long as the latter is not
dereferenced.  Basically rewrite the function based on that premise; it
becomes much simpler as a result.  There is no need to check for
leading whitespace outside of the main loop anymore.

Reported-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc/SubmittingPatches: correct subject guidance
Adam Dinwoodie [Fri, 10 Nov 2017 15:02:50 +0000 (15:02 +0000)] 
doc/SubmittingPatches: correct subject guidance

The examples and common practice for adding markers such as "RFC" or
"v2" to the subject of patch emails is to have them within the same
brackets as the "PATCH" text, not after the closing bracket.  Further,
the practice of `git format-patch` and the like, as well as what appears
to be the more common pratice on the mailing list, is to use "[RFC
PATCH]", not "[PATCH/RFC]".

Update the SubmittingPatches article to match and to reference the
`format-patch` helper arguments, and also make some minor text
clarifications in the area.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofsmonitor: store fsmonitor bitmap before splitting index
Alex Vandiver [Thu, 9 Nov 2017 19:58:10 +0000 (11:58 -0800)] 
fsmonitor: store fsmonitor bitmap before splitting index

ba1b9cac ("fsmonitor: delay updating state until after split index
is merged", 2017-10-27) resolved the problem of the fsmonitor data
being applied to the non-base index when reading; however, a similar
problem exists when writing the index.  Specifically, writing of the
fsmonitor extension happens only after the work to split the index
has been applied -- as such, the information in the index is only
for the non-"base" index, and thus the extension information
contains only partial data.

When saving, compute the ewah bitmap before the index is split, and
store it in the fsmonitor_dirty field, mirroring the behavior that
occurred during reading.  fsmonitor_dirty is kept from being leaked by
being freed when the extension data is written -- which always happens
precisely once, no matter the split index configuration.

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofsmonitor: read from getcwd(), not the PWD environment variable
Alex Vandiver [Thu, 9 Nov 2017 19:58:09 +0000 (11:58 -0800)] 
fsmonitor: read from getcwd(), not the PWD environment variable

Though the process has chdir'd to the root of the working tree, the
PWD environment variable is only guaranteed to be updated accordingly
if a shell is involved -- which is not guaranteed to be the case.
That is, if `/usr/bin/perl` is a binary, $ENV{PWD} is unchanged from
whatever spawned `git` -- if `/usr/bin/perl` is a trivial shell
wrapper to the real `perl`, `$ENV{PWD}` will have been updated to the
root of the working copy.

Update to read from the Cwd module using the `getcwd` syscall, not the
PWD environment variable.  The Cygwin case is left unchanged, as it
necessarily _does_ go through a shell.

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoRelNotes: the third batch for 2.16
Junio C Hamano [Thu, 9 Nov 2017 05:36:39 +0000 (14:36 +0900)] 
RelNotes: the third batch for 2.16

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'js/mingw-redirect-std-handles'
Junio C Hamano [Thu, 9 Nov 2017 05:31:31 +0000 (14:31 +0900)] 
Merge branch 'js/mingw-redirect-std-handles'

MinGW updates.

* js/mingw-redirect-std-handles:
  mingw: document the standard handle redirection
  mingw: optionally redirect stderr/stdout via the same handle
  mingw: add experimental feature to redirect standard handles

6 years agoMerge branch 'js/wincred-empty-cred'
Junio C Hamano [Thu, 9 Nov 2017 05:31:31 +0000 (14:31 +0900)] 
Merge branch 'js/wincred-empty-cred'

MinGW updates.

* js/wincred-empty-cred:
  wincred: handle empty username/password correctly
  t0302: check helper can handle empty credentials

6 years agoMerge branch 'js/mingw-full-version-in-resources'
Junio C Hamano [Thu, 9 Nov 2017 05:31:31 +0000 (14:31 +0900)] 
Merge branch 'js/mingw-full-version-in-resources'

MinGW updates.

* js/mingw-full-version-in-resources:
  mingw: include the full version information in the resources

6 years agoMerge branch 'dk/libsecret-unlock-to-load-fix'
Junio C Hamano [Thu, 9 Nov 2017 05:31:30 +0000 (14:31 +0900)] 
Merge branch 'dk/libsecret-unlock-to-load-fix'

The credential helper for libsecret (in contrib/) has been improved
to allow possibly prompting the end user to unlock secrets that are
currently locked (otherwise the secrets may not be loaded).

* dk/libsecret-unlock-to-load-fix:
  credential-libsecret: unlock locked secrets

6 years agoMerge branch 'ks/mailmap'
Junio C Hamano [Thu, 9 Nov 2017 05:31:29 +0000 (14:31 +0900)] 
Merge branch 'ks/mailmap'

* ks/mailmap:
  mailmap: use Kaartic Sivaraam's new address

6 years agoMerge branch 'js/early-config'
Junio C Hamano [Thu, 9 Nov 2017 05:31:29 +0000 (14:31 +0900)] 
Merge branch 'js/early-config'

Correct start-up sequence so that a repository could be placed
immediately under the root directory again (which was broken at
around Git 2.13).

* js/early-config:
  setup: avoid double slashes when looking for HEAD

6 years agoMerge branch 'sg/travis-fixes'
Junio C Hamano [Thu, 9 Nov 2017 05:31:28 +0000 (14:31 +0900)] 
Merge branch 'sg/travis-fixes'

TravisCI build updates.

* sg/travis-fixes:
  travis-ci: don't build Git for the static analysis job
  travis-ci: fix running P4 and Git LFS tests in Linux build jobs

6 years agoMerge branch 'bw/diff-opt-impl-to-bitfields'
Junio C Hamano [Thu, 9 Nov 2017 05:31:27 +0000 (14:31 +0900)] 
Merge branch 'bw/diff-opt-impl-to-bitfields'

A single-word "unsigned flags" in the diff options is being split
into a structure with many bitfields.

* bw/diff-opt-impl-to-bitfields:
  diff: make struct diff_flags members lowercase
  diff: remove DIFF_OPT_CLR macro
  diff: remove DIFF_OPT_SET macro
  diff: remove DIFF_OPT_TST macro
  diff: remove touched flags
  diff: add flag to indicate textconv was set via cmdline
  diff: convert flags to be stored in bitfields
  add, reset: use DIFF_OPT_SET macro to set a diff flag

6 years agoMerge branch 'rs/hex-to-bytes-cleanup'
Junio C Hamano [Thu, 9 Nov 2017 05:31:27 +0000 (14:31 +0900)] 
Merge branch 'rs/hex-to-bytes-cleanup'

Code cleanup.

* rs/hex-to-bytes-cleanup:
  sha1_file: use hex_to_bytes()
  http-push: use hex_to_bytes()
  notes: move hex_to_bytes() to hex.c and export it

6 years agoMerge branch 'ad/5580-unc-tests-on-cygwin'
Junio C Hamano [Thu, 9 Nov 2017 05:31:27 +0000 (14:31 +0900)] 
Merge branch 'ad/5580-unc-tests-on-cygwin'

UNC paths are also relevant in Cygwin builds and they are now
tested just like Mingw builds.

* ad/5580-unc-tests-on-cygwin:
  t5580: add Cygwin support

6 years agoMerge branch 'ao/diff-populate-filespec-lstat-errorpath-fix'
Junio C Hamano [Thu, 9 Nov 2017 05:31:26 +0000 (14:31 +0900)] 
Merge branch 'ao/diff-populate-filespec-lstat-errorpath-fix'

After an error from lstat(), diff_populate_filespec() function
sometimes still went ahead and used invalid data in struct stat,
which has been fixed.

* ao/diff-populate-filespec-lstat-errorpath-fix:
  diff: fix lstat() error handling in diff_populate_filespec()

6 years agoMerge branch 'sb/blame-config-doc'
Junio C Hamano [Thu, 9 Nov 2017 05:31:25 +0000 (14:31 +0900)] 
Merge branch 'sb/blame-config-doc'

Description of blame.{showroot,blankboundary,showemail,date}
configuration variables have been added to "git config --help".

* sb/blame-config-doc:
  config: document blame configuration

6 years agoMerge branch 'jm/relnotes-2.15-typofix'
Junio C Hamano [Thu, 9 Nov 2017 05:31:25 +0000 (14:31 +0900)] 
Merge branch 'jm/relnotes-2.15-typofix'

Typofix.

* jm/relnotes-2.15-typofix:
  fix typos in 2.15.0 release notes

6 years agoMerge branch 'tz/fsf-address-update' of ../git-gui into tz/fsf-address-update
Junio C Hamano [Thu, 9 Nov 2017 04:24:43 +0000 (13:24 +0900)] 
Merge branch 'tz/fsf-address-update' of ../git-gui into tz/fsf-address-update

* 'tz/fsf-address-update' of ../git-gui:
  Replace Free Software Foundation address in license notices

6 years agoReplace Free Software Foundation address in license notices
Todd Zullinger [Tue, 7 Nov 2017 05:39:33 +0000 (00:39 -0500)] 
Replace Free Software Foundation address in license notices

The mailing address for the FSF has changed over the years.  Rather than
updating the address across all files, refer readers to gnu.org, as the
GNU GPL documentation now suggests for license notices.  The mailing
address is retained in the full license files (COPYING and LGPL-2.1).

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoReplace Free Software Foundation address in license notices
Todd Zullinger [Tue, 7 Nov 2017 05:39:33 +0000 (00:39 -0500)] 
Replace Free Software Foundation address in license notices

The mailing address for the FSF has changed over the years.  Rather than
updating the address across all files, refer readers to gnu.org, as the
GNU GPL documentation now suggests for license notices.  The mailing
address is retained in the full license files (COPYING and LGPL-2.1).

The old address is still present in t/diff-lib/COPYING.  This is
intentional, as the file is used in tests and the contents are not
expected to change.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase -i: fix comment typo
Adam Dinwoodie [Wed, 8 Nov 2017 13:20:20 +0000 (13:20 +0000)] 
rebase -i: fix comment typo

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreduce_heads: fix memory leaks
Martin Ågren [Tue, 7 Nov 2017 20:39:45 +0000 (21:39 +0100)] 
reduce_heads: fix memory leaks

We currently have seven callers of `reduce_heads(foo)`. Six of them do
not use the original list `foo` again, and actually, all six of those
end up leaking it.

Introduce and use `reduce_heads_replace(&foo)` as a leak-free version of
`foo = reduce_heads(foo)` to fix several of these. Fix the remaining
leaks using `free_commit_list()`.

While we're here, document `reduce_heads()` and mark it as `extern`.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobuiltin/merge-base: free commit lists
Martin Ågren [Tue, 7 Nov 2017 20:39:44 +0000 (21:39 +0100)] 
builtin/merge-base: free commit lists

In several functions, we iterate through a commit list by assigning
`result = result->next`. As a consequence, we lose the original pointer
and eventually leak the list.

Rewrite the loops so that we keep the original pointers, then call
`free_commit_list()`. Various alternatives were considered:

1) Use `UNLEAK(result)` before the loop. Simple change, but not very
pretty. These would definitely be new lows among our usages of UNLEAK.
2) Use `pop_commit()` when looping. Slightly less simple change, but it
feels slightly preferable to first display the list, then free it.
3) As in this patch, but with `UNLEAK()` instead of freeing. We'd still
go through all the trouble of refactoring the loop, and because it's not
super-obvious that we're about to exit, let's just free the lists -- it
probably doesn't affect the runtime much.

In `handle_independent()` we can drop `result` while we're here and
reuse the `revs`-variable instead. That matches several other users of
`reduce_heads()`. The memory-leak that this hides will be addressed in
the next commit.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote-mediawiki: show progress while fetching namespaces
Antoine Beaupré [Tue, 7 Nov 2017 16:07:01 +0000 (11:07 -0500)] 
remote-mediawiki: show progress while fetching namespaces

Without this, the fetch process seems hanged while we fetch page
listings across the namespaces. Obviously, it should be possible to
silence this with -q, but that's an issue already present everywhere
in the code and should be fixed separately:

https://github.com/Git-Mediawiki/Git-Mediawiki/issues/30

Signed-off-by: Antoine Beaupré <anarcat@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote-mediawiki: process namespaces in order
Antoine Beaupré [Tue, 7 Nov 2017 16:07:00 +0000 (11:07 -0500)] 
remote-mediawiki: process namespaces in order

Ideally, we'd process them in numeric order since that is more
logical, but we can't do that yet since this is where we find the
numeric identifiers in the first place. Lexicographic order is a good
compromise.

Signed-off-by: Antoine Beaupré <anarcat@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote-mediawiki: support fetching from (Main) namespace
Antoine Beaupré [Tue, 7 Nov 2017 16:06:59 +0000 (11:06 -0500)] 
remote-mediawiki: support fetching from (Main) namespace

When we specify a list of namespaces to fetch from, by default the MW
API will not fetch from the default namespace, refered to as "(Main)"
in the documentation:

https://www.mediawiki.org/wiki/Manual:Namespace#Built-in_namespaces

I haven't found a way to address that "(Main)" namespace when getting
the namespace ids: indeed, when listing namespaces, there is no
"canonical" field for the main namespace, although there is a "*"
field that is set to "" (empty). So in theory, we could specify the
empty namespace to get the main namespace, but that would make
specifying namespaces harder for the user: we would need to teach
users about the "empty" default namespace. It would also make the code
more complicated: we'd need to parse quotes in the configuration.

So we simply override the query here and allow the user to specify
"(Main)" since that is the publicly documented name.

Signed-off-by: Antoine Beaupré <anarcat@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote-mediawiki: skip virtual namespaces
Antoine Beaupré [Tue, 7 Nov 2017 16:06:58 +0000 (11:06 -0500)] 
remote-mediawiki: skip virtual namespaces

Virtual namespaces do not correspond to pages in the database and are
automatically generated by MediaWiki. It makes little sense,
therefore, to fetch pages from those namespaces and the MW API doesn't
support listing those pages.

According to the documentation, those virtual namespaces are currently
"Special" (-1) and "Media" (-2) but we treat all negative namespaces
as "virtual" as a future-proofing mechanism.

Signed-off-by: Antoine Beaupré <anarcat@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoremote-mediawiki: show known namespace choices on failure
Antoine Beaupré [Tue, 7 Nov 2017 16:06:57 +0000 (11:06 -0500)] 
remote-mediawiki: show known namespace choices on failure

If we fail to find a requested namespace, we should tell the user
which ones we know about, since those were already fetched. This
allows users to fetch all namespaces by specifying a dummy namespace,
failing, then copying the list of namespaces in the config.

Eventually, we should have a flag that allows fetching all namespaces
automatically.

Reviewed-by: Antoine Beaupré <anarcat@debian.org>
Signed-off-by: Antoine Beaupré <anarcat@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoread_index_from(): speed index loading by skipping verification of the entry order
Ben Peart [Wed, 18 Oct 2017 14:27:25 +0000 (10:27 -0400)] 
read_index_from(): speed index loading by skipping verification of the entry order

There is code in post_read_index_from() to catch out of order
entries when reading an index file.  This order verification is ~13%
of the cost of every call to read_index_from().

Update check_ce_order() so that it skips this verification unless
the "verify_ce_order" global variable is set.

Teach fsck to force this verification.

The effect can be seen using t/perf/p0002-read-cache.sh:

Test                                          HEAD              HEAD~1
--------------------------------------------------------------------------------------
0002.1: read_cache/discard_cache 1000 times   0.41(0.04+0.04)   0.50(0.00+0.10) +22.0%

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofor-each-ref: test :remotename and :remoteref
Johannes Schindelin [Tue, 7 Nov 2017 16:31:14 +0000 (17:31 +0100)] 
for-each-ref: test :remotename and :remoteref

This not only prevents regressions, but also serves as documentation
what this new feature is expected to do.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofor-each-ref: let upstream/push report the remote ref name
J Wyman [Tue, 7 Nov 2017 16:31:08 +0000 (17:31 +0100)] 
for-each-ref: let upstream/push report the remote ref name

There are times when scripts want to know not only the name of the
push branch on the remote, but also the name of the branch as known
by the remote repository.

An example of this is when a tool wants to push to the very same branch
from which it would pull automatically, i.e. the `<remote>` and the `<to>`
in `git push <remote> <from>:<to>` would be provided by
`%(upstream:remotename)` and `%(upstream:remoteref)`, respectively.

This patch offers the new suffix :remoteref for the `upstream` and `push`
atoms, allowing to show exactly that. Example:

$ cat .git/config
...
[remote "origin"]
url = https://where.do.we.come/from
fetch = refs/heads/*:refs/remote/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[branch "develop/with/topics"]
remote = origin
merge = refs/heads/develop/with/topics
...

$ git for-each-ref \
--format='%(push) %(push:remoteref)' \
refs/heads
refs/remotes/origin/master refs/heads/master
refs/remotes/origin/develop/with/topics refs/heads/develop/with/topics

Signed-off-by: J Wyman <jwyman@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoTests: clean up and document submodule helpers
Jonathan Tan [Tue, 7 Nov 2017 18:45:08 +0000 (10:45 -0800)] 
Tests: clean up and document submodule helpers

Factor out the commonalities from test_submodule_switch() and
test_submodule_forced_switch() in lib-submodule-update.sh, and document
their usage.

This also makes explicit (through the KNOWN_FAILURE_FORCED_SWITCH_TESTS
variable) the fact that, currently, all functionality tested using
test_submodule_forced_switch() do not correctly handle the situation in
which a submodule is replaced with an ordinary directory.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agowt-status: actually ignore submodules when requested
Brandon Williams [Mon, 6 Nov 2017 22:08:19 +0000 (14:08 -0800)] 
wt-status: actually ignore submodules when requested

Since ff6f1f564 (submodule-config: lazy-load a repository's .gitmodules
file, 2017-08-03) rebase interactive fails if there are any submodules
with unstaged changes which have been configured with a value for
'submodule.<name>.ignore' in the repository's config.

This is due to how configured values of 'submodule.<name>.ignore' are
handled in addition to a change in how the submodule config is loaded.
When the diff machinery hits a submodule (gitlink as well as a
corresponding entry in the submodule subsystem) it will read the value
of 'submodule.<name>.ignore' stored in the repository's config and if
the config is present it will clear the 'IGNORE_SUBMODULES' (which is
the flag explicitly requested by rebase interactive),
'IGNORE_UNTRACKED_IN_SUBMODULES', and 'IGNORE_DIRTY_SUBMODULES' diff
flags and then set one of them based on the configured value.

Historically this wasn't a problem because the submodule subsystem
wasn't initialized because the .gitmodules file wasn't explicitly loaded
by the rebase interactive command.  So when the diff machinery hit a
submodule it would skip over reading any configured values of
'submodule.<name>.ignore'.

In order to preserve the behavior of submodules being ignored by rebase
interactive, also set the 'OVERRIDE_SUBMODULE_CONFIG' diff flag when
submodules are requested to be ignored when checking for unstaged
changes.

Reported-by: Orgad Shaneh <orgads@gmail.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoGit/Packet.pm: extract parts of t0021/rot13-filter.pl for reuse
Christian Couder [Sun, 5 Nov 2017 21:38:36 +0000 (22:38 +0100)] 
Git/Packet.pm: extract parts of t0021/rot13-filter.pl for reuse

And while at it let's simplify t0021/rot13-filter.pl by
using Git/Packet.pm.

This will make it possible to reuse packet related
functions in other test scripts.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot0021/rot13-filter: add capability functions
Christian Couder [Sun, 5 Nov 2017 21:38:35 +0000 (22:38 +0100)] 
t0021/rot13-filter: add capability functions

These function help read and write capabilities.

To make them more generic and make it easy to reuse them,
the following changes are made:

- we don't require capabilities to come in a fixed order,
- we allow duplicates,
- we check that the remote supports the capabilities we
  advertise,
- we don't check if the remote declares any capability we
  don't know about.

The reason behind the last change is that the protocol
should work using only the capabilities that both ends
support, and it should not stop working if one end starts
to advertise a new capability.

Despite those changes, we can still require a set of
capabilities, and die if one of them is not supported.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot0021/rot13-filter: refactor checking final lf
Christian Couder [Sun, 5 Nov 2017 21:38:34 +0000 (22:38 +0100)] 
t0021/rot13-filter: refactor checking final lf

As checking for a lf character at the end of a buffer
will be useful in another function, let's refactor this
functionality into a small remove_final_lf_or_die()
helper function.

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