git/git.git
2 years agoMerge branch 'sb/pull-rebase-submodule'
Junio C Hamano [Mon, 20 Aug 2018 18:33:54 +0000 (11:33 -0700)]
Merge branch 'sb/pull-rebase-submodule'

"git pull --rebase -v" in a repository with a submodule barfed as
an intermediate process did not understand what "-v(erbose)" flag
meant, which has been fixed.

* sb/pull-rebase-submodule:
  git-submodule.sh: accept verbose flag in cmd_update to be non-quiet

2 years agoMerge branch 'js/range-diff'
Junio C Hamano [Mon, 20 Aug 2018 18:33:53 +0000 (11:33 -0700)]
Merge branch 'js/range-diff'

"git tbdiff" that lets us compare individual patches in two
iterations of a topic has been rewritten and made into a built-in
command.

* js/range-diff: (21 commits)
  range-diff: use dim/bold cues to improve dual color mode
  range-diff: make --dual-color the default mode
  range-diff: left-pad patch numbers
  completion: support `git range-diff`
  range-diff: populate the man page
  range-diff --dual-color: skip white-space warnings
  range-diff: offer to dual-color the diffs
  diff: add an internal option to dual-color diffs of diffs
  color: add the meta color GIT_COLOR_REVERSE
  range-diff: use color for the commit pairs
  range-diff: add tests
  range-diff: do not show "function names" in hunk headers
  range-diff: adjust the output of the commit pairs
  range-diff: suppress the diff headers
  range-diff: indent the diffs just like tbdiff
  range-diff: right-trim commit messages
  range-diff: also show the diff between patches
  range-diff: improve the order of the shown commits
  range-diff: first rudimentary implementation
  Introduce `range-diff` to compare iterations of a topic branch
  ...

2 years agoMerge branch 'nd/no-the-index'
Junio C Hamano [Mon, 20 Aug 2018 18:33:53 +0000 (11:33 -0700)]
Merge branch 'nd/no-the-index'

The more library-ish parts of the codebase learned to work on the
in-core index-state instance that is passed in by their callers,
instead of always working on the singleton "the_index" instance.

* nd/no-the-index: (24 commits)
  blame.c: remove implicit dependency on the_index
  apply.c: remove implicit dependency on the_index
  apply.c: make init_apply_state() take a struct repository
  apply.c: pass struct apply_state to more functions
  resolve-undo.c: use the right index instead of the_index
  archive-*.c: use the right repository
  archive.c: avoid access to the_index
  grep: use the right index instead of the_index
  attr: remove index from git_attr_set_direction()
  entry.c: use the right index instead of the_index
  submodule.c: use the right index instead of the_index
  pathspec.c: use the right index instead of the_index
  unpack-trees: avoid the_index in verify_absent()
  unpack-trees: convert clear_ce_flags* to avoid the_index
  unpack-trees: don't shadow global var the_index
  unpack-trees: add a note about path invalidation
  unpack-trees: remove 'extern' on function declaration
  ls-files: correct index argument to get_convert_attr_ascii()
  preload-index.c: use the right index instead of the_index
  dir.c: remove an implicit dependency on the_index in pathspec code
  ...

2 years agoMerge branch 'es/chain-lint-more'
Junio C Hamano [Mon, 20 Aug 2018 18:33:53 +0000 (11:33 -0700)]
Merge branch 'es/chain-lint-more'

Improve built-in facility to catch broken &&-chain in the tests.

* es/chain-lint-more:
  chainlint: add test of pathological case which triggered false positive
  chainlint: recognize multi-line quoted strings more robustly
  chainlint: let here-doc and multi-line string commence on same line
  chainlint: recognize multi-line $(...) when command cuddled with "$("
  chainlint: match 'quoted' here-doc tags
  chainlint: match arbitrary here-docs tags rather than hard-coded names

2 years agoMerge branch 'sg/t5310-empty-input-fix'
Junio C Hamano [Mon, 20 Aug 2018 18:33:52 +0000 (11:33 -0700)]
Merge branch 'sg/t5310-empty-input-fix'

Test fix.

* sg/t5310-empty-input-fix:
  t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

2 years agoMerge branch 'js/mingw-o-append'
Junio C Hamano [Mon, 20 Aug 2018 18:33:52 +0000 (11:33 -0700)]
Merge branch 'js/mingw-o-append'

Among the three codepaths we use O_APPEND to open a file for
appending, one used for writing GIT_TRACE output requires O_APPEND
implementation that behaves sensibly when multiple processes are
writing to the same file.  POSIX emulation used in the Windows port
has been updated to improve in this area.

* js/mingw-o-append:
  mingw: enable atomic O_APPEND

2 years agoMerge branch 'jk/for-each-object-iteration'
Junio C Hamano [Mon, 20 Aug 2018 18:33:52 +0000 (11:33 -0700)]
Merge branch 'jk/for-each-object-iteration'

The API to iterate over all objects learned to optionally list
objects in the order they appear in packfiles, which helps locality
of access if the caller accesses these objects while as objects are
enumerated.

* jk/for-each-object-iteration:
  for_each_*_object: move declarations to object-store.h
  cat-file: use a single strbuf for all output
  cat-file: split batch "buf" into two variables
  cat-file: use oidset check-and-insert
  cat-file: support "unordered" output for --batch-all-objects
  cat-file: rename batch_{loose,packed}_object callbacks
  t1006: test cat-file --batch-all-objects with duplicates
  for_each_packed_object: support iterating in pack-order
  for_each_*_object: give more comprehensive docstrings
  for_each_*_object: take flag arguments as enum
  for_each_*_object: store flag definitions in a single location

2 years agoMerge branch 'ab/fetch-tags-noclobber'
Junio C Hamano [Mon, 20 Aug 2018 18:33:52 +0000 (11:33 -0700)]
Merge branch 'ab/fetch-tags-noclobber'

Test and doc clean-ups.

* ab/fetch-tags-noclobber:
  pull doc: fix a long-standing grammar error
  fetch tests: correct a comment "remove it" -> "remove them"
  push tests: assert re-pushing annotated tags
  push tests: add more testing for forced tag pushing
  push tests: fix logic error in "push" test assertion
  push tests: remove redundant 'git push' invocation
  fetch tests: change "Tag" test tag to "testTag"

2 years agoMerge branch 'ng/mergetool-lose-final-prompt'
Junio C Hamano [Mon, 20 Aug 2018 18:33:51 +0000 (11:33 -0700)]
Merge branch 'ng/mergetool-lose-final-prompt'

"git mergetool" stopped and gave an extra prompt to continue after
the last path has been handled, which did not make much sense.

* ng/mergetool-lose-final-prompt:
  mergetool: don't suggest to continue after last file

2 years agoMerge branch 'jt/commit-graph-per-object-store'
Junio C Hamano [Mon, 20 Aug 2018 18:33:51 +0000 (11:33 -0700)]
Merge branch 'jt/commit-graph-per-object-store'

Test update.

* jt/commit-graph-per-object-store:
  t5318: avoid unnecessary command substitutions

2 years agoMerge branch 'ds/commit-graph-fsck'
Junio C Hamano [Mon, 20 Aug 2018 18:33:51 +0000 (11:33 -0700)]
Merge branch 'ds/commit-graph-fsck'

Test fix.

* ds/commit-graph-fsck:
  t5318: use 'test_cmp_bin' to compare commit-graph files

2 years agoMerge branch 'jt/fetch-negotiator-skipping'
Junio C Hamano [Mon, 20 Aug 2018 18:33:51 +0000 (11:33 -0700)]
Merge branch 'jt/fetch-negotiator-skipping'

Test fix.

* jt/fetch-negotiator-skipping:
  t5552: suppress upload-pack trace output

2 years agoMerge branch 'jc/gpg-status'
Junio C Hamano [Mon, 20 Aug 2018 18:33:50 +0000 (11:33 -0700)]
Merge branch 'jc/gpg-status'

"git verify-tag" and "git verify-commit" have been taught to use
the exit status of underlying "gpg --verify" to signal bad or
untrusted signature they found.

* jc/gpg-status:
  gpg-interface: propagate exit status from gpg back to the callers

2 years agoMerge branch 'jc/update-index-doc'
Junio C Hamano [Mon, 20 Aug 2018 18:33:50 +0000 (11:33 -0700)]
Merge branch 'jc/update-index-doc'

Doc update.

* jc/update-index-doc:
  update-index: there no longer is `apply --index-info`

2 years agoMerge branch 'en/update-index-doc'
Junio C Hamano [Mon, 20 Aug 2018 18:33:50 +0000 (11:33 -0700)]
Merge branch 'en/update-index-doc'

Doc update.

* en/update-index-doc:
  git-update-index.txt: reword possibly confusing example

2 years agoMerge branch 'js/typofixes'
Junio C Hamano [Mon, 20 Aug 2018 18:33:50 +0000 (11:33 -0700)]
Merge branch 'js/typofixes'

Comment update.

* js/typofixes:
  remote-curl: remove spurious period
  git-compat-util.h: fix typo

2 years agoMerge branch 'sk/instaweb-rh-update'
Junio C Hamano [Mon, 20 Aug 2018 18:33:49 +0000 (11:33 -0700)]
Merge branch 'sk/instaweb-rh-update'

"git instaweb" has been adjusted to run better with newer Apache on
RedHat based distros.

* sk/instaweb-rh-update:
  git-instaweb: fix apache2 config with apache >= 2.4
  git-instaweb: support Fedora/Red Hat apache module path

2 years agoMerge branch 'en/t7406-fixes'
Junio C Hamano [Mon, 20 Aug 2018 18:33:48 +0000 (11:33 -0700)]
Merge branch 'en/t7406-fixes'

Test fixes.

* en/t7406-fixes:
  t7406: avoid using test_must_fail for commands other than git
  t7406: prefer test_* helper functions to test -[feds]
  t7406: avoid having git commands upstream of a pipe
  t7406: simplify by using diff --name-only instead of diff --raw
  t7406: fix call that was failing for the wrong reason

2 years agoMerge branch 'js/rebase-merges-exec-fix'
Junio C Hamano [Mon, 20 Aug 2018 18:33:48 +0000 (11:33 -0700)]
Merge branch 'js/rebase-merges-exec-fix'

The "--exec" option to "git rebase --rebase-merges" placed the exec
commands at wrong places, which has been corrected.

* js/rebase-merges-exec-fix:
  rebase --exec: make it work with --rebase-merges
  t3430: demonstrate what -r, --autosquash & --exec should do

2 years agoMerge branch 'ab/test-must-be-empty-for-master'
Junio C Hamano [Mon, 20 Aug 2018 18:33:48 +0000 (11:33 -0700)]
Merge branch 'ab/test-must-be-empty-for-master'

Test updates.

* ab/test-must-be-empty-for-master:
  tests: make use of the test_must_be_empty function

2 years agoMerge branch 'ab/newhash-is-sha256'
Junio C Hamano [Mon, 20 Aug 2018 18:33:48 +0000 (11:33 -0700)]
Merge branch 'ab/newhash-is-sha256'

Documentation update.

* ab/newhash-is-sha256:
  doc hash-function-transition: pick SHA-256 as NewHash
  doc hash-function-transition: note the lack of a changelog

2 years agoSeventh batch for 2.19 cycle
Junio C Hamano [Fri, 17 Aug 2018 20:15:06 +0000 (13:15 -0700)]
Seventh batch for 2.19 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'nd/complete-config-vars'
Junio C Hamano [Fri, 17 Aug 2018 20:09:59 +0000 (13:09 -0700)]
Merge branch 'nd/complete-config-vars'

Build fix.

* nd/complete-config-vars:
  Makefile: add missing dependency for command-list.h

2 years agoMerge branch 'ar/t4150-am-scissors-test-fix'
Junio C Hamano [Fri, 17 Aug 2018 20:09:59 +0000 (13:09 -0700)]
Merge branch 'ar/t4150-am-scissors-test-fix'

Test fix.

* ar/t4150-am-scissors-test-fix:
  t4150: fix broken test for am --scissors

2 years agoMerge branch 'js/pull-rebase-type-shorthand'
Junio C Hamano [Fri, 17 Aug 2018 20:09:59 +0000 (13:09 -0700)]
Merge branch 'js/pull-rebase-type-shorthand'

"git pull --rebase=interactive" learned "i" as a short-hand for
"interactive".

* js/pull-rebase-type-shorthand:
  pull --rebase=<type>: allow single-letter abbreviations for the type

2 years agoMerge branch 'jk/diff-rendered-docs'
Junio C Hamano [Fri, 17 Aug 2018 20:09:58 +0000 (13:09 -0700)]
Merge branch 'jk/diff-rendered-docs'

The end result of documentation update has been made to be
inspected more easily to help developers.

* jk/diff-rendered-docs:
  add a script to diff rendered documentation

2 years agoMerge branch 'hn/config-in-code-comment'
Junio C Hamano [Fri, 17 Aug 2018 20:09:58 +0000 (13:09 -0700)]
Merge branch 'hn/config-in-code-comment'

Header update.

* hn/config-in-code-comment:
  config: document git config getter return value

2 years agoMerge branch 'nd/config-blame-sort'
Junio C Hamano [Fri, 17 Aug 2018 20:09:58 +0000 (13:09 -0700)]
Merge branch 'nd/config-blame-sort'

Doc fix.

* nd/config-blame-sort:
  config.txt: reorder blame stuff to keep config keys sorted

2 years agoMerge branch 'en/t3031-title-fix'
Junio C Hamano [Fri, 17 Aug 2018 20:09:58 +0000 (13:09 -0700)]
Merge branch 'en/t3031-title-fix'

Test fix.

* en/t3031-title-fix:
  t3031: update test description to mention desired behavior

2 years agoMerge branch 'sb/indent-heuristic-optim'
Junio C Hamano [Fri, 17 Aug 2018 20:09:57 +0000 (13:09 -0700)]
Merge branch 'sb/indent-heuristic-optim'

"git diff --indent-heuristic" had a bad corner case performance.

* sb/indent-heuristic-optim:
  xdiff: reduce indent heuristic overhead

2 years agoMerge branch 'en/abort-df-conflict-fixes'
Junio C Hamano [Fri, 17 Aug 2018 20:09:57 +0000 (13:09 -0700)]
Merge branch 'en/abort-df-conflict-fixes'

"git merge --abort" etc. did not clean things up properly when
there were conflicted entries in the index in certain order that
are involved in D/F conflicts.  This has been corrected.

* en/abort-df-conflict-fixes:
  read-cache: fix directory/file conflict handling in read_index_unmerged()
  t1015: demonstrate directory/file conflict recovery failures

2 years agoMerge branch 'mk/http-backend-content-length'
Junio C Hamano [Fri, 17 Aug 2018 20:09:57 +0000 (13:09 -0700)]
Merge branch 'mk/http-backend-content-length'

The http-backend (used for smart-http transport) used to slurp the
whole input until EOF, without paying attention to CONTENT_LENGTH
that is supplied in the environment and instead expecting the Web
server to close the input stream.  This has been fixed.

* mk/http-backend-content-length:
  t5562: avoid non-portable "export FOO=bar" construct
  http-backend: respect CONTENT_LENGTH for receive-pack
  http-backend: respect CONTENT_LENGTH as specified by rfc3875
  http-backend: cleanup writing to child process

2 years agoMerge branch 'ot/ref-filter-object-info'
Junio C Hamano [Fri, 17 Aug 2018 20:09:57 +0000 (13:09 -0700)]
Merge branch 'ot/ref-filter-object-info'

A few atoms like %(objecttype) and %(objectsize) in the format
specifier of "for-each-ref --format=<format>" can be filled without
getting the full contents of the object, but just with the object
header.  These cases have been optimized by calling
oid_object_info() API (instead of reading and inspecting the data).

* ot/ref-filter-object-info:
  ref-filter: use oid_object_info() to get object
  ref-filter: merge get_obj and get_object
  ref-filter: initialize eaten variable
  ref-filter: fill empty fields with empty values
  ref-filter: add info_source to valid_atom

2 years agoMerge branch 'nd/no-extern'
Junio C Hamano [Fri, 17 Aug 2018 20:09:56 +0000 (13:09 -0700)]
Merge branch 'nd/no-extern'

Noiseword "extern" has been removed from function decls in the
header files.

* nd/no-extern:
  submodule.h: drop extern from function declaration
  revision.h: drop extern from function declaration
  repository.h: drop extern from function declaration
  rerere.h: drop extern from function declaration
  line-range.h: drop extern from function declaration
  diff.h: remove extern from function declaration
  diffcore.h: drop extern from function declaration
  convert.h: drop 'extern' from function declaration
  cache-tree.h: drop extern from function declaration
  blame.h: drop extern on func declaration
  attr.h: drop extern from function declaration
  apply.h: drop extern on func declaration

2 years agoMerge branch 'es/want-color-fd-defensive'
Junio C Hamano [Fri, 17 Aug 2018 20:09:56 +0000 (13:09 -0700)]
Merge branch 'es/want-color-fd-defensive'

Futureproofing a helper function that can easily be misused.

* es/want-color-fd-defensive:
  color: protect against out-of-bounds reads and writes

2 years agoMerge branch 'ab/sha1dc'
Junio C Hamano [Fri, 17 Aug 2018 20:09:56 +0000 (13:09 -0700)]
Merge branch 'ab/sha1dc'

AIX portability update for the SHA1DC hash, imported from upstream.

* ab/sha1dc:
  sha1dc: update from upstream

2 years agoMerge branch 'rs/parse-opt-lithelp'
Junio C Hamano [Fri, 17 Aug 2018 20:09:56 +0000 (13:09 -0700)]
Merge branch 'rs/parse-opt-lithelp'

The parse-options machinery learned to refrain from enclosing
placeholder string inside a "<bra" and "ket>" pair automatically
without PARSE_OPT_LITERAL_ARGHELP.  Existing help text for option
arguments that are not formatted correctly have been identified and
fixed.

* rs/parse-opt-lithelp:
  parse-options: automatically infer PARSE_OPT_LITERAL_ARGHELP
  shortlog: correct option help for -w
  send-pack: specify --force-with-lease argument help explicitly
  pack-objects: specify --index-version argument help explicitly
  difftool: remove angular brackets from argument help
  add, update-index: fix --chmod argument help
  push: use PARSE_OPT_LITERAL_ARGHELP instead of unbalanced brackets

2 years agoMerge branch 'ab/fetch-nego'
Junio C Hamano [Fri, 17 Aug 2018 20:09:55 +0000 (13:09 -0700)]
Merge branch 'ab/fetch-nego'

Update to a few other topics around 'git fetch'.

* ab/fetch-nego:
  fetch doc: cross-link two new negotiation options
  negotiator: unknown fetch.negotiationAlgorithm should error out

2 years agoMerge branch 'jt/refspec-dwim-precedence-fix'
Junio C Hamano [Fri, 17 Aug 2018 20:09:55 +0000 (13:09 -0700)]
Merge branch 'jt/refspec-dwim-precedence-fix'

"git fetch $there refs/heads/s" ought to fetch the tip of the
branch 's', but when "refs/heads/refs/heads/s", i.e. a branch whose
name is "refs/heads/s" exists at the same time, fetched that one
instead by mistake.  This has been corrected to honor the usual
disambiguation rules for abbreviated refnames.

* jt/refspec-dwim-precedence-fix:
  remote: make refspec follow the same disambiguation rule as local refs

2 years agoMerge branch 'jk/merge-subtree-heuristics'
Junio C Hamano [Fri, 17 Aug 2018 20:09:55 +0000 (13:09 -0700)]
Merge branch 'jk/merge-subtree-heuristics'

The automatic tree-matching in "git merge -s subtree" was broken 5
years ago and nobody has noticed since then, which is now fixed.

* jk/merge-subtree-heuristics:
  score_trees(): fix iteration over trees with missing entries

2 years agoMerge branch 'ab/test-must-be-empty'
Junio C Hamano [Fri, 17 Aug 2018 20:09:54 +0000 (13:09 -0700)]
Merge branch 'ab/test-must-be-empty'

Test updates.

* ab/test-must-be-empty:
  tests: make use of the test_must_be_empty function

2 years agoMerge branch 'es/rebase-i-author-script-fix'
Junio C Hamano [Fri, 17 Aug 2018 20:09:54 +0000 (13:09 -0700)]
Merge branch 'es/rebase-i-author-script-fix'

The "author-script" file "git rebase -i" creates got broken when
we started to move the command away from shell script, which is
getting fixed now.

* es/rebase-i-author-script-fix:
  sequencer: don't die() on bogus user-edited timestamp
  sequencer: fix "rebase -i --root" corrupting author header timestamp
  sequencer: fix "rebase -i --root" corrupting author header timezone
  sequencer: fix "rebase -i --root" corrupting author header

2 years agoMerge branch 'ab/fsck-transfer-updates'
Junio C Hamano [Fri, 17 Aug 2018 20:09:54 +0000 (13:09 -0700)]
Merge branch 'ab/fsck-transfer-updates'

The test performed at the receiving end of "git push" to prevent
bad objects from entering repository can be customized via
receive.fsck.* configuration variables; we now have gained a
counterpart to do the same on the "git fetch" side, with
fetch.fsck.* configuration variables.

* ab/fsck-transfer-updates:
  fsck: test and document unknown fsck.<msg-id> values
  fsck: add stress tests for fsck.skipList
  fsck: test & document {fetch,receive}.fsck.* config fallback
  fetch: implement fetch.fsck.*
  transfer.fsckObjects tests: untangle confusing setup
  config doc: elaborate on fetch.fsckObjects security
  config doc: elaborate on what transfer.fsckObjects does
  config doc: unify the description of fsck.* and receive.fsck.*
  config doc: don't describe *.fetchObjects twice
  receive.fsck.<msg-id> tests: remove dead code

2 years agoSixth batch for 2.19 cycle
Junio C Hamano [Wed, 15 Aug 2018 22:13:39 +0000 (15:13 -0700)]
Sixth batch for 2.19 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jt/connectivity-check-after-unshallow'
Junio C Hamano [Wed, 15 Aug 2018 22:08:28 +0000 (15:08 -0700)]
Merge branch 'jt/connectivity-check-after-unshallow'

"git fetch" sometimes failed to update the remote-tracking refs,
which has been corrected.

* jt/connectivity-check-after-unshallow:
  fetch-pack: unify ref in and out param

2 years agoMerge branch 'sg/travis-retrieve-trash-upon-failure'
Junio C Hamano [Wed, 15 Aug 2018 22:08:28 +0000 (15:08 -0700)]
Merge branch 'sg/travis-retrieve-trash-upon-failure'

The Travis CI scripts were taught to ship back the test data from
failed tests.

* sg/travis-retrieve-trash-upon-failure:
  travis-ci: include the trash directories of failed tests in the trace log

2 years agoMerge branch 'rs/remote-mv-leakfix'
Junio C Hamano [Wed, 15 Aug 2018 22:08:28 +0000 (15:08 -0700)]
Merge branch 'rs/remote-mv-leakfix'

Leakfix.

* rs/remote-mv-leakfix:
  remote: clear string_list after use in mv()

2 years agoMerge branch 'es/mw-to-git-chain-fix'
Junio C Hamano [Wed, 15 Aug 2018 22:08:27 +0000 (15:08 -0700)]
Merge branch 'es/mw-to-git-chain-fix'

Test fix.

* es/mw-to-git-chain-fix:
  mw-to-git/t9360: fix broken &&-chain

2 years agoMerge branch 'ms/http-proto-doc'
Junio C Hamano [Wed, 15 Aug 2018 22:08:27 +0000 (15:08 -0700)]
Merge branch 'ms/http-proto-doc'

Doc fix.

* ms/http-proto-doc:
  doc: fix want-capability separator

2 years agoMerge branch 'nd/pack-objects-threading-doc'
Junio C Hamano [Wed, 15 Aug 2018 22:08:27 +0000 (15:08 -0700)]
Merge branch 'nd/pack-objects-threading-doc'

Doc fix.

* nd/pack-objects-threading-doc:
  pack-objects: document about thread synchronization

2 years agoMerge branch 'jn/subtree-test-fixes'
Junio C Hamano [Wed, 15 Aug 2018 22:08:27 +0000 (15:08 -0700)]
Merge branch 'jn/subtree-test-fixes'

Test fix.

* jn/subtree-test-fixes:
  subtree test: simplify preparation of expected results
  subtree test: add missing && to &&-chain

2 years agoMerge branch 'cb/p4-pre-submit-hook'
Junio C Hamano [Wed, 15 Aug 2018 22:08:27 +0000 (15:08 -0700)]
Merge branch 'cb/p4-pre-submit-hook'

"git p4 submit" learns to ask its own pre-submit hook if it should
continue with submitting.

* cb/p4-pre-submit-hook:
  git-p4: add the `p4-pre-submit` hook

2 years agoMerge branch 'js/vscode'
Junio C Hamano [Wed, 15 Aug 2018 22:08:26 +0000 (15:08 -0700)]
Merge branch 'js/vscode'

Add a script (in contrib/) to help users of VSCode work better with
our codebase.

* js/vscode:
  vscode: let cSpell work on commit messages, too
  vscode: add a dictionary for cSpell
  vscode: use 8-space tabs, no trailing ws, etc for Git's source code
  vscode: wrap commit messages at column 72 by default
  vscode: only overwrite C/C++ settings
  mingw: define WIN32 explicitly
  cache.h: extract enum declaration from inside a struct declaration
  vscode: hard-code a couple defines
  contrib: add a script to initialize VS Code configuration

2 years agoMerge branch 'bb/redecl-enum-fix'
Junio C Hamano [Wed, 15 Aug 2018 22:08:26 +0000 (15:08 -0700)]
Merge branch 'bb/redecl-enum-fix'

Compilation fix.

* bb/redecl-enum-fix:
  packfile: ensure that enum object_type is defined

2 years agoMerge branch 'jk/banned-function'
Junio C Hamano [Wed, 15 Aug 2018 22:08:26 +0000 (15:08 -0700)]
Merge branch 'jk/banned-function'

It is too easy to misuse system API functions such as strcat();
these selected functions are now forbidden in this codebase and
will cause a compilation failure.

* jk/banned-function:
  banned.h: mark strncpy() as banned
  banned.h: mark sprintf() as banned
  banned.h: mark strcat() as banned
  automatically ban strcpy()

2 years agoMerge branch 'en/merge-recursive-skip-fix'
Junio C Hamano [Wed, 15 Aug 2018 22:08:25 +0000 (15:08 -0700)]
Merge branch 'en/merge-recursive-skip-fix'

When the sparse checkout feature is in use, "git cherry-pick" and
other mergy operations lost the skip_worktree bit when a path that
is excluded from checkout requires content level merge, which is
resolved as the same as the HEAD version, without materializing the
merge result in the working tree, which made the path appear as
deleted.  This has been corrected by preserving the skip_worktree
bit (and not materializing the file in the working tree).

* en/merge-recursive-skip-fix:
  merge-recursive: preserve skip_worktree bit when necessary
  t3507: add a testcase showing failure with sparse checkout

2 years agoMerge branch 'jt/tag-following-with-proto-v2-fix'
Junio C Hamano [Wed, 15 Aug 2018 22:08:25 +0000 (15:08 -0700)]
Merge branch 'jt/tag-following-with-proto-v2-fix'

The wire-protocol v2 relies on the client to send "ref prefixes" to
limit the bandwidth spent on the initial ref advertisement.  "git
fetch $remote branch:branch" that asks tags that point into the
history leading to the "branch" automatically followed sent to
narrow prefix and broke the tag following, which has been fixed.

* jt/tag-following-with-proto-v2-fix:
  fetch: send "refs/tags/" prefix upon CLI refspecs
  t5702: test fetch with multiple refspecs at a time

2 years agoMerge branch 'jk/size-t'
Junio C Hamano [Wed, 15 Aug 2018 22:08:25 +0000 (15:08 -0700)]
Merge branch 'jk/size-t'

Code clean-up to use size_t/ssize_t when they are the right type.

* jk/size-t:
  strbuf_humanise: use unsigned variables
  pass st.st_size as hint for strbuf_readlink()
  strbuf_readlink: use ssize_t
  strbuf: use size_t for length in intermediate variables
  reencode_string: use size_t for string lengths
  reencode_string: use st_add/st_mult helpers

2 years agoMerge branch 'sg/coccicheck-updates'
Junio C Hamano [Wed, 15 Aug 2018 22:08:25 +0000 (15:08 -0700)]
Merge branch 'sg/coccicheck-updates'

Update the way we use Coccinelle to find out-of-style code that
need to be modernised.

* sg/coccicheck-updates:
  coccinelle: extract dedicated make target to clean Coccinelle's results
  coccinelle: put sane filenames into output patches
  coccinelle: exclude sha1dc source files from static analysis
  coccinelle: use $(addsuffix) in 'coccicheck' make target
  coccinelle: mark the 'coccicheck' make target as .PHONY

2 years agoMerge branch 'sb/histogram-less-memory'
Junio C Hamano [Wed, 15 Aug 2018 22:08:25 +0000 (15:08 -0700)]
Merge branch 'sb/histogram-less-memory'

"git diff --histogram" had a bad memory usage pattern, which has
been rearranged to reduce the peak usage.

* sb/histogram-less-memory:
  xdiff/histogram: remove tail recursion
  xdiff/xhistogram: move index allocation into find_lcs
  xdiff/xhistogram: factor out memory cleanup into free_index()
  xdiff/xhistogram: pass arguments directly to fall_back_to_classic_diff

2 years agoMerge branch 'nd/i18n'
Junio C Hamano [Wed, 15 Aug 2018 22:08:23 +0000 (15:08 -0700)]
Merge branch 'nd/i18n'

Many more strings are prepared for l10n.

* nd/i18n: (23 commits)
  transport-helper.c: mark more strings for translation
  transport.c: mark more strings for translation
  sha1-file.c: mark more strings for translation
  sequencer.c: mark more strings for translation
  replace-object.c: mark more strings for translation
  refspec.c: mark more strings for translation
  refs.c: mark more strings for translation
  pkt-line.c: mark more strings for translation
  object.c: mark more strings for translation
  exec-cmd.c: mark more strings for translation
  environment.c: mark more strings for translation
  dir.c: mark more strings for translation
  convert.c: mark more strings for translation
  connect.c: mark more strings for translation
  config.c: mark more strings for translation
  commit-graph.c: mark more strings for translation
  builtin/replace.c: mark more strings for translation
  builtin/pack-objects.c: mark more strings for translation
  builtin/grep.c: mark strings for translation
  builtin/config.c: mark more strings for translation
  ...

2 years agoMerge branch 'hs/gpgsm'
Junio C Hamano [Wed, 15 Aug 2018 22:08:23 +0000 (15:08 -0700)]
Merge branch 'hs/gpgsm'

Teach "git tag -s" etc. a few configuration variables (gpg.format
that can be set to "openpgp" or "x509", and gpg.<format>.program
that is used to specify what program to use to deal with the format)
to allow x.509 certs with CMS via "gpgsm" to be used instead of
openpgp via "gnupg".

* hs/gpgsm:
  gpg-interface t: extend the existing GPG tests with GPGSM
  gpg-interface: introduce new signature format "x509" using gpgsm
  gpg-interface: introduce new config to select per gpg format program
  gpg-interface: do not hardcode the key string len anymore
  gpg-interface: introduce an abstraction for multiple gpg formats
  t/t7510: check the validation of the new config gpg.format
  gpg-interface: add new config to select how to sign a commit

2 years agoMerge branch 'bw/clone-ref-prefixes'
Junio C Hamano [Wed, 15 Aug 2018 22:08:23 +0000 (15:08 -0700)]
Merge branch 'bw/clone-ref-prefixes'

The wire-protocol v2 relies on the client to send "ref prefixes" to
limit the bandwidth spent on the initial ref advertisement.  "git
clone" when learned to speak v2 forgot to do so, which has been
corrected.

* bw/clone-ref-prefixes:
  clone: send ref-prefixes when using protocol v2

2 years agoMerge branch 'jk/core-use-replace-refs'
Junio C Hamano [Wed, 15 Aug 2018 22:08:22 +0000 (15:08 -0700)]
Merge branch 'jk/core-use-replace-refs'

A new configuration variable core.usereplacerefs has been added,
primarily to help server installations that want to ignore the
replace mechanism altogether.

* jk/core-use-replace-refs:
  add core.usereplacerefs config option
  check_replace_refs: rename to read_replace_refs
  check_replace_refs: fix outdated comment

2 years agoMerge branch 'jh/json-writer'
Junio C Hamano [Wed, 15 Aug 2018 22:08:22 +0000 (15:08 -0700)]
Merge branch 'jh/json-writer'

Preparatory code to later add json output for telemetry data.

* jh/json-writer:
  json_writer: new routines to create JSON data

2 years agoMerge branch 'bb/make-developer-pedantic'
Junio C Hamano [Wed, 15 Aug 2018 22:08:22 +0000 (15:08 -0700)]
Merge branch 'bb/make-developer-pedantic'

"make DEVELOPER=1 DEVOPTS=pedantic" allows developers to compile
with -pedantic option, which may catch more problematic program
constructs and potential bugs.

* bb/make-developer-pedantic:
  Makefile: add a DEVOPTS flag to get pedantic compilation

2 years agoMerge branch 'es/diff-color-moved-fix'
Junio C Hamano [Wed, 15 Aug 2018 22:08:22 +0000 (15:08 -0700)]
Merge branch 'es/diff-color-moved-fix'

One of the "diff --color-moved" mode "dimmed_zebra" that was named
in an unusual way has been deprecated and replaced by
"dimmed-zebra".

* es/diff-color-moved-fix:
  diff: --color-moved: rename "dimmed_zebra" to "dimmed-zebra"

2 years agoMerge branch 'bw/protocol-v2'
Junio C Hamano [Wed, 15 Aug 2018 22:08:21 +0000 (15:08 -0700)]
Merge branch 'bw/protocol-v2'

Doc update.

* bw/protocol-v2:
  pack-protocol: mention and point to docs for protocol v2

2 years agoMerge branch 'sg/travis-cocci-diagnose-failure'
Junio C Hamano [Wed, 15 Aug 2018 22:08:21 +0000 (15:08 -0700)]
Merge branch 'sg/travis-cocci-diagnose-failure'

Update the way we run static analysis tool at TravisCI to make it
easier to use its findings.

* sg/travis-cocci-diagnose-failure:
  travis-ci: fail if Coccinelle static analysis found something to transform
  travis-ci: run Coccinelle static analysis with two parallel jobs

2 years agoMerge branch 'js/t7406-recursive-submodule-update-order-fix'
Junio C Hamano [Wed, 15 Aug 2018 22:08:21 +0000 (15:08 -0700)]
Merge branch 'js/t7406-recursive-submodule-update-order-fix'

Test fix.

* js/t7406-recursive-submodule-update-order-fix:
  t7406: avoid failures solely due to timing issues

2 years agoMerge branch 'bw/fetch-pack-i18n'
Junio C Hamano [Wed, 15 Aug 2018 22:08:20 +0000 (15:08 -0700)]
Merge branch 'bw/fetch-pack-i18n'

i18n updates.

* bw/fetch-pack-i18n:
  fetch-pack: mark die strings for translation

2 years agoMerge branch 'sg/fast-import-dump-refs-on-checkpoint-fix'
Junio C Hamano [Wed, 15 Aug 2018 22:08:20 +0000 (15:08 -0700)]
Merge branch 'sg/fast-import-dump-refs-on-checkpoint-fix'

Test update.

* sg/fast-import-dump-refs-on-checkpoint-fix:
  t9300: wait for background fast-import process to die after killing it

2 years agoMerge branch 'sb/trailers-docfix'
Junio C Hamano [Wed, 15 Aug 2018 22:08:19 +0000 (15:08 -0700)]
Merge branch 'sb/trailers-docfix'

Doc update.

* sb/trailers-docfix:
  Documentation/git-interpret-trailers: explain possible values

2 years agoMerge branch 'jk/ui-color-always-to-auto'
Junio C Hamano [Wed, 15 Aug 2018 22:08:19 +0000 (15:08 -0700)]
Merge branch 'jk/ui-color-always-to-auto'

Doc formatting fix.

* jk/ui-color-always-to-auto:
  Documentation: fix --color option formatting

2 years agogit-submodule.sh: accept verbose flag in cmd_update to be non-quiet
Stefan Beller [Tue, 14 Aug 2018 18:22:02 +0000 (11:22 -0700)]
git-submodule.sh: accept verbose flag in cmd_update to be non-quiet

In a56771a668d (builtin/pull: respect verbosity settings in submodules,
2018-01-25), we made sure to pass on both quiet and verbose flag from
builtin/pull.c to the submodule shell script. However git-submodule doesn't
understand a verbose flag, which results in a bug when invoking

  git pull --recurse-submodules -v [...]

There are a few different approaches to fix this bug:

1) rewrite 'argv_push_verbosity' or its caller in builtin/pull.c to
   cap opt_verbosity at 0. Then 'argv_push_verbosity' would only add
   '-q' if any.

2) Have a flag in 'argv_push_verbosity' that specifies if we allow adding
  -q or -v (or both).

3) Add -v to git-submodule.sh and make it a no-op

(1) seems like a maintenance burden: What if we add code after
the submodule operations or move submodule operations higher up,
then we have altered the opt_verbosity setting further down the line
in builtin/pull.c.

(2) seems like it could work reasonably well without more regressions

(3) seems easiest to implement as well as actually is a feature with the
    last-one-wins rule of passing flags to Git commands.

Reported-by: Jochen Kühner
Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agofor_each_*_object: move declarations to object-store.h
Jeff King [Tue, 14 Aug 2018 18:21:18 +0000 (14:21 -0400)]
for_each_*_object: move declarations to object-store.h

The for_each_loose_object() and for_each_packed_object()
functions are meant to be part of a unified interface: they
use the same set of for_each_object_flags, and it's not
inconceivable that we might one day add a single
for_each_object() wrapper around them.

Let's put them together in a single file, so we can avoid
awkwardness like saying "the flags for this function are
over in cache.h". Moving the loose functions to packfile.h
is silly. Moving the packed functions to cache.h works, but
makes the "cache.h is a kitchen sink" problem worse. The
best place is the recently-created object-store.h, since
these are quite obviously related to object storage.

The for_each_*_in_objdir() functions do not use the same
flags, but they are logically part of the same interface as
for_each_loose_object(), and share callback signatures. So
we'll move those, as well, as they also make sense in
object-store.h.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocat-file: use a single strbuf for all output
Jeff King [Tue, 14 Aug 2018 18:20:22 +0000 (14:20 -0400)]
cat-file: use a single strbuf for all output

When we're in batch mode, we end up in batch_object_write()
for each object, which allocates its own strbuf for each
call. Instead, we can provide a single "scratch" buffer that
gets reused for each output. When running:

  git cat-file --batch-all-objects --batch-check='%(objectname)'

on git.git, my best-of-five time drops from:

  real 0m0.171s
  user 0m0.159s
  sys 0m0.012s

to:

  real 0m0.133s
  user 0m0.121s
  sys 0m0.012s

Note that we could do this just by putting the "scratch"
pointer into "struct expand_data", but I chose instead to
add an extra parameter to the callstack. That's more
verbose, but it makes it a bit more obvious what is going
on, which in turn makes it easy to see where we need to be
releasing the string in the caller (right after the loop
which uses it in each case).

Based-on-a-patch-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocat-file: split batch "buf" into two variables
Jeff King [Tue, 14 Aug 2018 18:18:06 +0000 (14:18 -0400)]
cat-file: split batch "buf" into two variables

We use the "buf" strbuf for two things: to read incoming
lines, and as a scratch space for test-expanding the
user-provided format. Let's split this into two variables
with descriptive names, which makes their purpose and
lifetime more clear.

It will also help in a future patch when we start using the
"output" buffer for more expansions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocat-file: use oidset check-and-insert
Jeff King [Tue, 14 Aug 2018 18:14:27 +0000 (14:14 -0400)]
cat-file: use oidset check-and-insert

We don't need to check if the oidset has our object before
we insert it; that's done as part of the insertion. We can
just rely on the return value from oidset_insert(), which
saves one hash lookup per object.

This measurable speedup is tiny and within the run-to-run
noise, but the result is simpler to read, too.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test
SZEDER Gábor [Tue, 14 Aug 2018 11:47:21 +0000 (13:47 +0200)]
t5310-pack-bitmaps: fix bogus 'pack-objects to file can use bitmap' test

The test 'pack-objects to file can use bitmap' added in 645c432d61
(pack-objects: use reachability bitmap index when generating
non-stdout pack, 2016-09-10) is silently buggy and doesn't check what
it's supposed to.

In 't5310-pack-bitmaps.sh', the 'list_packed_objects' helper function
does what its name implies by running:

  git show-index <"$1" | cut -d' ' -f2

The test in question invokes this function like this:

  list_packed_objects <packa-$packasha1.idx >packa.objects &&
  list_packed_objects <packb-$packbsha1.idx >packb.objects &&
  test_cmp packa.objects packb.objects

Note how these two callsites don't specify the name of the pack index
file as the function's parameter, but redirect the function's standard
input from it.  This triggers an error message from the shell, as it
has no filename to redirect from in the function, but this error is
ignored, because it happens upstream of a pipe.  Consequently, both
invocations produce empty 'pack{a,b}.objects' files, and the
subsequent 'test_cmp' happily finds those two empty files identical.

Fix these two 'list_packed_objects' invocations by specifying the pack
index files as parameters.  Furthermore, eliminate the pipe in that
function by replacing it with an &&-chained pair of commands using an
intermediate file, so a failure of 'git show-index' or the shell
redirection will fail the test.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomingw: enable atomic O_APPEND
Johannes Sixt [Mon, 13 Aug 2018 19:02:50 +0000 (21:02 +0200)]
mingw: enable atomic O_APPEND

The Windows CRT implements O_APPEND "manually": on write() calls, the
file pointer is set to EOF before the data is written. Clearly, this is
not atomic. And in fact, this is the root cause of failures observed in
t5552-skipping-fetch-negotiator.sh and t5503-tagfollow.sh, where
different processes write to the same trace file simultanously; it also
occurred in t5400-send-pack.sh, but there it was worked around in
71406ed4d6 ("t5400: avoid concurrent writes into a trace file",
2017-05-18).

Fortunately, Windows does support atomic O_APPEND semantics using the
file access mode FILE_APPEND_DATA. Provide an implementation that does.

This implementation is minimal in such a way that it only implements
the open modes that are actually used in the Git code base. Emulation
for other modes can be added as necessary later. To become aware of
the necessity early, the unusal error ENOSYS is reported if an
unsupported mode is encountered.

Diagnosed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Helped-by: Jeff Hostetler <git@jeffhostetler.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoblame.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:41 +0000 (18:14 +0200)]
blame.c: remove implicit dependency on the_index

Side note, since we gain access to the right repository, we can stop
rely on the_repository in this code as well.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoapply.c: remove implicit dependency on the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:40 +0000 (18:14 +0200)]
apply.c: remove implicit dependency on the_index

Use apply_state->repo->index instead of the_index (in most cases,
unless we need to use a temporary index in some functions). Let the
callers (am and apply) tell us what to use, instead of always assuming
to operate on the_index.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoapply.c: make init_apply_state() take a struct repository
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:39 +0000 (18:14 +0200)]
apply.c: make init_apply_state() take a struct repository

We're moving away from the_index in this code. "struct index_state *"
could be added to struct apply_state. But let's aim long term and put
struct repository here instead so that we could even avoid more global
states in the future. The index will be available via
apply_state->repo->index.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoapply.c: pass struct apply_state to more functions
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:38 +0000 (18:14 +0200)]
apply.c: pass struct apply_state to more functions

we're going to remove the dependency on the_index by moving 'struct
index_state *' to somewhere inside struct apply_state. Let's make sure
relevant functions have access to this struct now and reduce the diff
noise when the actual conversion happens.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoresolve-undo.c: use the right index instead of the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:37 +0000 (18:14 +0200)]
resolve-undo.c: use the right index instead of the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoarchive-*.c: use the right repository
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:36 +0000 (18:14 +0200)]
archive-*.c: use the right repository

With 'struct archive_args' gaining new repository pointer, we don't
have to assume the_repository in the archive backends anymore.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoarchive.c: avoid access to the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:35 +0000 (18:14 +0200)]
archive.c: avoid access to the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogrep: use the right index instead of the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:34 +0000 (18:14 +0200)]
grep: use the right index instead of the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoattr: remove index from git_attr_set_direction()
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:33 +0000 (18:14 +0200)]
attr: remove index from git_attr_set_direction()

Since attr checking API now take the index, there's no need to set an
index in advance with this call. Most call sites are straightforward
because they either pass the_index or NULL (which defaults back to
the_index previously). There's only one suspicious call site in
unpack-trees.c where it sets a different index.

This code in unpack-trees is about to check out entries from the
new/temporary index after merging is done in it. The attributes will
be used by entry.c code to do crlf conversion if needed. entry.c now
respects struct checkout's istate field, and this field is correctly
set in unpack-trees.c, there should be no regression from this change.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoentry.c: use the right index instead of the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:32 +0000 (18:14 +0200)]
entry.c: use the right index instead of the_index

checkout-index.c needs update because if checkout->istate is NULL,
ie_match_stat() will crash. Previously this is ie_match_stat(&the_index, ..)
so it will not crash, but it is not technically correct either.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosubmodule.c: use the right index instead of the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:31 +0000 (18:14 +0200)]
submodule.c: use the right index instead of the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopathspec.c: use the right index instead of the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:30 +0000 (18:14 +0200)]
pathspec.c: use the right index instead of the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agounpack-trees: avoid the_index in verify_absent()
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:29 +0000 (18:14 +0200)]
unpack-trees: avoid the_index in verify_absent()

Both functions that are updated in this commit are called by
verify_absent(), which is part of the "unpack-trees" operation that is
supposed to work on any index file specified by the caller. Thanks to
Brandon [1] [2], an implicit dependency on the_index is exposed. This
commit fixes it.

In both functions, it makes sense to use src_index to check for
exclusion because it's almost unchanged and should give us the same
outcome as if running the exclude check before the unpack.

It's "almost unchanged" because we do invalidate cache-tree and
untracked cache in the source index. But this should not affect how
exclude machinery uses the index: to see if a file is tracked, and to
read a blob from the index instead of worktree if it's marked
skip-worktree (i.e. it's not available in worktree)

[1] a0bba65b10 (dir: convert is_excluded to take an index - 2017-05-05
[2] 2c1eb10454 (dir: convert read_directory to take an index - 2017-05-05)

Helped-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agounpack-trees: convert clear_ce_flags* to avoid the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:28 +0000 (18:14 +0200)]
unpack-trees: convert clear_ce_flags* to avoid the_index

Prior to fba92be8f7, this code implicitly (and incorrectly) assumes
the_index when running the exclude machinery. fba92be8f7 helps show
this problem clearer because unpack-trees operation is supposed to
work on whatever index the caller specifies... not specifically
the_index.

Update the code to use "istate" argument that's originally from
mark_new_skip_worktree(). From the call sites, both in unpack_trees(),
you can see that this function works on two separate indexes:
o->src_index and o->result. The second mark_new_skip_worktree() so far
has incorecctly applied exclude rules on o->src_index instead of
o->result. It's unclear what is the consequences of this, but it's
definitely wrong.

[1] fba92be8f7 (dir: convert is_excluded_from_list to take an index -
    2017-05-05)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agounpack-trees: don't shadow global var the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:27 +0000 (18:14 +0200)]
unpack-trees: don't shadow global var the_index

This function mark_new_skip_worktree() has an argument named the_index
which is also the name of a global variable. While they have different
types (the global the_index is not a pointer) mistakes can easily
happen and it's also confusing for readers. Rename the function
argument to something other than the_index.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agounpack-trees: add a note about path invalidation
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:26 +0000 (18:14 +0200)]
unpack-trees: add a note about path invalidation

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agounpack-trees: remove 'extern' on function declaration
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:25 +0000 (18:14 +0200)]
unpack-trees: remove 'extern' on function declaration

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agols-files: correct index argument to get_convert_attr_ascii()
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:24 +0000 (18:14 +0200)]
ls-files: correct index argument to get_convert_attr_ascii()

write_eolinfo() does take an istate as function argument and it should
be used instead of the_index.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agopreload-index.c: use the right index instead of the_index
Nguyễn Thái Ngọc Duy [Mon, 13 Aug 2018 16:14:23 +0000 (18:14 +0200)]
preload-index.c: use the right index instead of the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>