git
7 years agoMerge branch 'mb/diff-default-to-indent-heuristics'
Junio C Hamano [Mon, 5 Jun 2017 00:18:10 +0000 (09:18 +0900)] 
Merge branch 'mb/diff-default-to-indent-heuristics'

Make the "indent" heuristics the default in "diff" and diff.indentHeuristics
configuration variable an escape hatch for those who do no want it.

* mb/diff-default-to-indent-heuristics:
  add--interactive: drop diff.indentHeuristic handling
  diff: enable indent heuristic by default
  diff: have the diff-* builtins configure diff before initializing revisions
  diff: make the indent heuristic part of diff's basic configuration

7 years agoMerge branch 'jh/close-index-before-stat'
Junio C Hamano [Mon, 5 Jun 2017 00:18:10 +0000 (09:18 +0900)] 
Merge branch 'jh/close-index-before-stat'

The timestamp of the index file is now taken after the file is
closed, to help Windows, on which a stale timestamp is reported by
fstat() on a file that is opened for writing and data was written
but not yet closed.

* jh/close-index-before-stat:
  read-cache: close index.lock in do_write_index

7 years agoSync with maint
Junio C Hamano [Sun, 4 Jun 2017 01:29:26 +0000 (10:29 +0900)] 
Sync with maint

7 years agoPrepare for 2.13.1; more topics to follow
Junio C Hamano [Sun, 4 Jun 2017 01:25:42 +0000 (10:25 +0900)] 
Prepare for 2.13.1; more topics to follow

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'tg/stash-push-fixup' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:07 +0000 (10:21 +0900)] 
Merge branch 'tg/stash-push-fixup' into maint

The shell completion script (in contrib/) learned "git stash" has
a new "push" subcommand.

* tg/stash-push-fixup:
  completion: add git stash push

7 years agoMerge branch 'km/log-showsignature-doc' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:07 +0000 (10:21 +0900)] 
Merge branch 'km/log-showsignature-doc' into maint

Doc update.

* km/log-showsignature-doc:
  config.txt: add an entry for log.showSignature

7 years agoMerge branch 'jt/use-trailer-api-in-commands' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:06 +0000 (10:21 +0900)] 
Merge branch 'jt/use-trailer-api-in-commands' into maint

"git cherry-pick" and other uses of the sequencer machinery
mishandled a trailer block whose last line is an incomplete line.
This has been fixed so that an additional sign-off etc. are added
after completing the existing incomplete line.

* jt/use-trailer-api-in-commands:
  sequencer: add newline before adding footers

7 years agoMerge branch 'jt/push-options-doc' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:05 +0000 (10:21 +0900)] 
Merge branch 'jt/push-options-doc' into maint

The receive-pack program now makes sure that the push certificate
records the same set of push options used for pushing.

* jt/push-options-doc:
  receive-pack: verify push options in cert
  docs: correct receive.advertisePushOptions default

7 years agoMerge branch 'js/plug-leaks' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:04 +0000 (10:21 +0900)] 
Merge branch 'js/plug-leaks' into maint

Fix memory leaks pointed out by Coverity (and people).

* js/plug-leaks: (26 commits)
  checkout: fix memory leak
  submodule_uses_worktrees(): plug memory leak
  show_worktree(): plug memory leak
  name-rev: avoid leaking memory in the `deref` case
  remote: plug memory leak in match_explicit()
  add_reflog_for_walk: avoid memory leak
  shallow: avoid memory leak
  line-log: avoid memory leak
  receive-pack: plug memory leak in update()
  fast-export: avoid leaking memory in handle_tag()
  mktree: plug memory leaks reported by Coverity
  pack-redundant: plug memory leak
  setup_discovered_git_dir(): plug memory leak
  setup_bare_git_dir(): help static analysis
  split_commit_in_progress(): simplify & fix memory leak
  checkout: fix memory leak
  cat-file: fix memory leak
  mailinfo & mailsplit: check for EOF while parsing
  status: close file descriptor after reading git-rebase-todo
  difftool: address a couple of resource/memory leaks
  ...

7 years agoMerge branch 'js/eol-on-ourselves' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:04 +0000 (10:21 +0900)] 
Merge branch 'js/eol-on-ourselves' into maint

Make sure our tests would pass when the sources are checked out
with "platform native" line ending convention by default on
Windows.  Some "text" files out tests use and the test scripts
themselves that are meant to be run with /bin/sh, ought to be
checked out with eol=LF even on Windows.

* js/eol-on-ourselves:
  t4051: mark supporting files as requiring LF-only line endings
  Fix the remaining tests that failed with core.autocrlf=true
  t3901: move supporting files into t/t3901/
  completion: mark bash script as LF-only
  git-new-workdir: mark script as LF-only
  Fix build with core.autocrlf=true

7 years agoMerge branch 'jk/update-links-in-docs' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:04 +0000 (10:21 +0900)] 
Merge branch 'jk/update-links-in-docs' into maint

A few http:// links that are redirected to https:// in the
documentation have been updated to https:// links.

* jk/update-links-in-docs:
  doc: use https links to Wikipedia to avoid http redirects

7 years agoMerge branch 'jk/ignore-broken-tags-when-ignoring-missing-links' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:03 +0000 (10:21 +0900)] 
Merge branch 'jk/ignore-broken-tags-when-ignoring-missing-links' into maint

Tag objects, which are not reachable from any ref, that point at
missing objects were mishandled by "git gc" and friends (they
should silently be ignored instead)

* jk/ignore-broken-tags-when-ignoring-missing-links:
  revision.c: ignore broken tags with ignore_missing_links

7 years agoMerge branch 'jk/doc-config-include' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:02 +0000 (10:21 +0900)] 
Merge branch 'jk/doc-config-include' into maint

Clarify documentation for include.path and includeIf.<condition>.path
configuration variables.

* jk/doc-config-include:
  docs/config: consistify include.path examples
  docs/config: avoid the term "expand" for includes
  docs/config: give a relative includeIf example
  docs/config: clarify include/includeIf relationship

7 years agoMerge branch 'jk/disable-pack-reuse-when-broken' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:02 +0000 (10:21 +0900)] 
Merge branch 'jk/disable-pack-reuse-when-broken' into maint

"pack-objects" can stream a slice of an existing packfile out when
the pack bitmap can tell that the reachable objects are all needed
in the output, without inspecting individual objects.  This
strategy however would not work well when "--local" and other
options are in use, and need to be disabled.

* jk/disable-pack-reuse-when-broken:
  t5310: fix "; do" style
  pack-objects: disable pack reuse for object-selection options

7 years agoMerge branch 'jk/am-leakfix' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:01 +0000 (10:21 +0900)] 
Merge branch 'jk/am-leakfix' into maint

The codepath in "git am" that is used when running "git rebase"
leaked memory held for the log message of the commits being rebased.

* jk/am-leakfix:
  am: shorten ident_split variable name in get_commit_info()
  am: simplify allocations in get_commit_info()
  am: fix commit buffer leak in get_commit_info()

7 years agoMerge branch 'jc/read-tree-empty-with-m' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:21:00 +0000 (10:21 +0900)] 
Merge branch 'jc/read-tree-empty-with-m' into maint

"git read-tree -m" (no tree-ish) gave a nonsense suggestion "use
--empty if you want to clear the index".  With "-m", such a request
will still fail anyway, as you'd need to name at least one tree-ish
to be merged.

* jc/read-tree-empty-with-m:
  read-tree: "read-tree -m --empty" does not make sense

7 years agoMerge branch 'jc/apply-fix-mismerge' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:20:59 +0000 (10:20 +0900)] 
Merge branch 'jc/apply-fix-mismerge' into maint

Mismerge fix.

* jc/apply-fix-mismerge:
  apply.c: fix whitespace-only mismerge

7 years agoMerge branch 'ja/do-not-ask-needless-questions' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:20:58 +0000 (10:20 +0900)] 
Merge branch 'ja/do-not-ask-needless-questions' into maint

Git sometimes gives an advice in a rhetorical question that does
not require an answer, which can confuse new users and non native
speakers.  Attempt to rephrase them.

* ja/do-not-ask-needless-questions:
  git-filter-branch: be more direct in an error message
  read-tree -m: make error message for merging 0 trees less smart aleck
  usability: don't ask questions if no reply is required

7 years agoMerge branch 'bw/submodule-with-bs-path' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:20:58 +0000 (10:20 +0900)] 
Merge branch 'bw/submodule-with-bs-path' into maint

A hotfix to a topic that is already in v2.13.

* bw/submodule-with-bs-path:
  t7400: add !CYGWIN prerequisite to 'add with \\ in path'

7 years agoMerge branch 'ah/log-decorate-default-to-auto' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:20:57 +0000 (10:20 +0900)] 
Merge branch 'ah/log-decorate-default-to-auto' into maint

Setting "log.decorate=false" in the configuration file did not take
effect in v2.13, which has been corrected.

* ah/log-decorate-default-to-auto:
  builtin/log: honor log.decorate

7 years agoMerge branch 'ab/fix-poison-tests' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:20:56 +0000 (10:20 +0900)] 
Merge branch 'ab/fix-poison-tests' into maint

Update tests to pass under GETTEXT_POISON (a mechanism to ensure
that output strings that should not be translated are not
translated by mistake), and tell TravisCI to run them.

* ab/fix-poison-tests:
  travis-ci: add job to run tests with GETTEXT_POISON
  travis-ci: setup "prove cache" in "script" step
  tests: fix tests broken under GETTEXT_POISON=YesPlease

7 years agoMerge branch 'ab/doc-replace-gmane-links' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:20:56 +0000 (10:20 +0900)] 
Merge branch 'ab/doc-replace-gmane-links' into maint

The Web interface to gmane news archive is long gone, even though
the articles are still accessible via NTTP.  Replace the links with
ones to public-inbox.org.  Because their message identification is
based on the actual message-id, it is likely that it will be easier
to migrate away from it if/when necessary.

* ab/doc-replace-gmane-links:
  doc: replace more gmane links
  doc: replace a couple of broken gmane links

7 years agoMerge branch 'ab/aix-needs-compat-regex' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:20:56 +0000 (10:20 +0900)] 
Merge branch 'ab/aix-needs-compat-regex' into maint

Build fix.

* ab/aix-needs-compat-regex:
  config.mak.uname: set NO_REGEX=NeedsStartEnd on AIX

7 years agoMerge branch 'pw/rebase-i-regression-fix' into maint
Junio C Hamano [Sun, 4 Jun 2017 01:20:55 +0000 (10:20 +0900)] 
Merge branch 'pw/rebase-i-regression-fix' into maint

Just the first one of three? new tests that follows up a regression
fix.

* pw/rebase-i-regression-fix:
  rebase -i: add missing newline to end of message
  rebase -i: silence stash apply
  rebase -i: fix reflog message

7 years agoSixth batch for 2.14
Junio C Hamano [Sun, 4 Jun 2017 00:58:01 +0000 (09:58 +0900)] 
Sixth batch for 2.14

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jk/url-insteadof-config'
Junio C Hamano [Sun, 4 Jun 2017 00:55:45 +0000 (09:55 +0900)] 
Merge branch 'jk/url-insteadof-config'

The interaction of "url.*.insteadOf" and custom URL scheme's
whitelisting is now documented better.

* jk/url-insteadof-config:
  docs/config: mention protocol implications of url.insteadOf

7 years agoMerge branch 'ah/doc-rev-parse-short-default'
Junio C Hamano [Sun, 4 Jun 2017 00:55:45 +0000 (09:55 +0900)] 
Merge branch 'ah/doc-rev-parse-short-default'

Doc update.

* ah/doc-rev-parse-short-default:
  doc: rewrite description for rev-parse --short

7 years agoMerge branch 'rf/completion-config-commit'
Junio C Hamano [Sun, 4 Jun 2017 00:55:44 +0000 (09:55 +0900)] 
Merge branch 'rf/completion-config-commit'

Completion update.

* rf/completion-config-commit:
  completion: add completions for git config commit

7 years agoMerge branch 'ab/c-translators-comment-style'
Junio C Hamano [Sun, 4 Jun 2017 00:55:44 +0000 (09:55 +0900)] 
Merge branch 'ab/c-translators-comment-style'

Update the C style recommendation for notes for translators, as
recent versions of gettext tools can work with our style of
multi-line comments.

* ab/c-translators-comment-style:
  C style: use standard style for "TRANSLATORS" comments

7 years agoMerge branch 'jk/unbreak-am-h'
Junio C Hamano [Sun, 4 Jun 2017 00:55:44 +0000 (09:55 +0900)] 
Merge branch 'jk/unbreak-am-h'

"git am -h" triggered a BUG().

* jk/unbreak-am-h:
  am: handle "-h" argument earlier

7 years agoMerge branch 'ab/t3070-test-dedup'
Junio C Hamano [Sun, 4 Jun 2017 00:55:43 +0000 (09:55 +0900)] 
Merge branch 'ab/t3070-test-dedup'

Test cleanup.

* ab/t3070-test-dedup:
  wildmatch test: remove redundant duplicate test

7 years agoMerge branch 'ah/doc-filter-branch-export-env'
Junio C Hamano [Sun, 4 Jun 2017 00:55:43 +0000 (09:55 +0900)] 
Merge branch 'ah/doc-filter-branch-export-env'

Docfix.

* ah/doc-filter-branch-export-env:
  doc: filter-branch does not require re-export of vars

7 years agoMerge branch 'sd/t3200-typofix'
Junio C Hamano [Sun, 4 Jun 2017 00:55:42 +0000 (09:55 +0900)] 
Merge branch 'sd/t3200-typofix'

Test fix.

* sd/t3200-typofix:
  branch test: fix invalid config key access

7 years agoMerge branch 'ab/sha1dc-maint'
Junio C Hamano [Sun, 4 Jun 2017 00:55:41 +0000 (09:55 +0900)] 
Merge branch 'ab/sha1dc-maint'

The "collision detecting" SHA-1 implementation shipped with 2.13
was quite broken on some big-endian platforms and/or platforms that
do not like unaligned fetches.  Update to the upstream code which
has already fixed these issues.

* ab/sha1dc-maint:
  sha1dc: update from upstream

7 years agoFifth batch for 2.14
Junio C Hamano [Fri, 2 Jun 2017 06:07:36 +0000 (15:07 +0900)] 
Fifth batch for 2.14

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'ab/grep-preparatory-cleanup'
Junio C Hamano [Fri, 2 Jun 2017 06:06:05 +0000 (15:06 +0900)] 
Merge branch 'ab/grep-preparatory-cleanup'

The internal implementation of "git grep" has seen some clean-up.

* ab/grep-preparatory-cleanup: (31 commits)
  grep: assert that threading is enabled when calling grep_{lock,unlock}
  grep: given --threads with NO_PTHREADS=YesPlease, warn
  pack-objects: fix buggy warning about threads
  pack-objects & index-pack: add test for --threads warning
  test-lib: add a PTHREADS prerequisite
  grep: move is_fixed() earlier to avoid forward declaration
  grep: change internal *pcre* variable & function names to be *pcre1*
  grep: change the internal PCRE macro names to be PCRE1
  grep: factor test for \0 in grep patterns into a function
  grep: remove redundant regflags assignments
  grep: catch a missing enum in switch statement
  perf: add a comparison test of log --grep regex engines with -F
  perf: add a comparison test of log --grep regex engines
  perf: add a comparison test of grep regex engines with -F
  perf: add a comparison test of grep regex engines
  perf: emit progress output when unpacking & building
  perf: add a GIT_PERF_MAKE_COMMAND for when *_MAKE_OPTS won't do
  grep: add tests to fix blind spots with \0 patterns
  grep: prepare for testing binary regexes containing rx metacharacters
  grep: add a test helper function for less verbose -f \0 tests
  ...

7 years agoMerge branch 'jk/diff-blob'
Junio C Hamano [Fri, 2 Jun 2017 06:06:05 +0000 (15:06 +0900)] 
Merge branch 'jk/diff-blob'

The result from "git diff" that compares two blobs, e.g. "git diff
$commit1:$path $commit2:$path", used to be shown with the full
object name as given on the command line, but it is more natural to
use the $path in the output and use it to look up .gitattributes.

* jk/diff-blob:
  diff: use blob path for blob/file diffs
  diff: use pending "path" if it is available
  diff: use the word "path" instead of "name" for blobs
  diff: pass whole pending entry in blobinfo
  handle_revision_arg: record paths for pending objects
  handle_revision_arg: record modes for "a..b" endpoints
  t4063: add tests of direct blob diffs
  get_sha1_with_context: dynamically allocate oc->path
  get_sha1_with_context: always initialize oc->symlink_path
  sha1_name: consistently refer to object_context as "oc"
  handle_revision_arg: add handle_dotdot() helper
  handle_revision_arg: hoist ".." check out of range parsing
  handle_revision_arg: stop using "dotdot" as a generic pointer
  handle_revision_arg: simplify commit reference lookups
  handle_revision_arg: reset "dotdot" consistently

7 years agoMerge branch 'sl/clean-d-ignored-fix'
Junio C Hamano [Fri, 2 Jun 2017 06:06:04 +0000 (15:06 +0900)] 
Merge branch 'sl/clean-d-ignored-fix'

"git clean -d" used to clean directories that has ignored files,
even though the command should not lose ignored ones without "-x".
"git status --ignored"  did not list ignored and untracked files
without "-uall".  These have been corrected.

* sl/clean-d-ignored-fix:
  clean: teach clean -d to preserve ignored paths
  dir: expose cmp_name() and check_contains()
  dir: hide untracked contents of untracked dirs
  dir: recurse into untracked dirs for ignored files
  t7061: status --ignored should search untracked dirs
  t7300: clean -d should skip dirs with ignored files

7 years agoMerge branch 'sb/t5531-update-desc'
Junio C Hamano [Fri, 2 Jun 2017 06:06:03 +0000 (15:06 +0900)] 
Merge branch 'sb/t5531-update-desc'

The description strings for a few tests have been updated.

* sb/t5531-update-desc:
  t5531: fix test description

7 years agoMerge branch 'ah/doc-pretty-format-fix'
Junio C Hamano [Fri, 2 Jun 2017 06:06:03 +0000 (15:06 +0900)] 
Merge branch 'ah/doc-pretty-format-fix'

Documentation fix.

* ah/doc-pretty-format-fix:
  Documentation: fix formatting typo in pretty-formats.txt

7 years agoMerge branch 'ah/doc-interpret-trailers-ifexists'
Junio C Hamano [Fri, 2 Jun 2017 06:06:02 +0000 (15:06 +0900)] 
Merge branch 'ah/doc-interpret-trailers-ifexists'

Documentation fix.

* ah/doc-interpret-trailers-ifexists:
  Documentation: fix reference to ifExists for interpret-trailers

7 years agoMerge branch 'rs/mingw-path-lookup-simplify'
Junio C Hamano [Fri, 2 Jun 2017 06:06:01 +0000 (15:06 +0900)] 
Merge branch 'rs/mingw-path-lookup-simplify'

Code simplification.

* rs/mingw-path-lookup-simplify:
  mingw: simplify PATH handling

7 years agoMerge branch 'ab/ref-filter-no-contains'
Junio C Hamano [Fri, 2 Jun 2017 06:06:00 +0000 (15:06 +0900)] 
Merge branch 'ab/ref-filter-no-contains'

Doc update to a recent topic.

* ab/ref-filter-no-contains:
  tag: duplicate mention of --contains should mention --no-contains

7 years agoMerge branch 'jt/send-email-validate-hook'
Junio C Hamano [Fri, 2 Jun 2017 06:05:59 +0000 (15:05 +0900)] 
Merge branch 'jt/send-email-validate-hook'

A hotfix for a topic already in 'master'.

* jt/send-email-validate-hook:
  send-email: check for repo before invoking hook

7 years agoMerge branch 'dk/send-email-avoid-net-smtp-ssl-when-able'
Junio C Hamano [Fri, 2 Jun 2017 06:05:59 +0000 (15:05 +0900)] 
Merge branch 'dk/send-email-avoid-net-smtp-ssl-when-able'

A hotfix to a topic in 'master'.

* dk/send-email-avoid-net-smtp-ssl-when-able:
  send-email: Net::SMTP::starttls was introduced in v2.34

7 years agoMerge branch 'js/bs-is-a-dir-sep-on-windows'
Junio C Hamano [Fri, 2 Jun 2017 06:05:58 +0000 (15:05 +0900)] 
Merge branch 'js/bs-is-a-dir-sep-on-windows'

"foo\bar\baz" in "git fetch foo\bar\baz", even though there is no
slashes in it, cannot be a nickname for a remote on Windows, as
that is likely to be a pathname on a local filesystem.

* js/bs-is-a-dir-sep-on-windows:
  Windows: do not treat a path with backslashes as a remote's nick name
  mingw.h: permit arguments with side effects for is_dir_sep

7 years agosend-email: check for repo before invoking hook
Jonathan Tan [Thu, 1 Jun 2017 23:50:55 +0000 (16:50 -0700)] 
send-email: check for repo before invoking hook

Unless --no-validate is passed, send-email will invoke
$repo->repo_path() in its search for a validate hook regardless of
whether a Git repo is actually present.  Teach send-email to first check
for repo existence.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosend-email: Net::SMTP::starttls was introduced in v2.34
Jonathan Nieder [Thu, 1 Jun 2017 00:17:43 +0000 (17:17 -0700)] 
send-email: Net::SMTP::starttls was introduced in v2.34

We cannot rely on the starttls method being present in Net::SMTP until
c274b798e6881a941d941808c6d89966975cb8c8 (Merge branch 'ipv6_ssl' of
https://github.com/noxxi/perl-libnet into noxxi-ipv6_ssl, 2014-06-02),
which set the module version to 2.34.

This version was first shipped as part of perl in v5.21.5~169 (Update
libnet to CPAN version 3.01, 2014-10-10).

Noticed on an Ubuntu system with perl 5.18.2-2ubuntu1.1, which
provides Net::SMTP version 2.31. The error message is

  Can't locate object method "starttls" via package "Net::SMTP" at /usr/lib/git-core/git-send-email line 1410.

Reported-by: Brandon Williams <bmwill@google.com>
Reported-and-tested-by: Eric Biggers <ebiggers3@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodoc: rewrite description for rev-parse --short
Andreas Heiduk [Wed, 31 May 2017 21:39:29 +0000 (23:39 +0200)] 
doc: rewrite description for rev-parse --short

`git rev-parse --short` is not a generic modifier but just a variant
of `--verify` and considers the given length only as a suggestion to
ensure uniqueness.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodocs/config: mention protocol implications of url.insteadOf
Jeff King [Wed, 31 May 2017 05:18:04 +0000 (01:18 -0400)] 
docs/config: mention protocol implications of url.insteadOf

If a URL rewrite switches the protocol to something
nonstandard (like "persistent-https" for "https"), the user
may be bitten by the fact that the default protocol
restrictions are different between the two. Let's drop a
note in insteadOf that points the user in the right
direction.

It would be nice if we could make this work out of the box,
but we can't without knowing the security implications of
the user's rewrite. Only the documentation for a particular
remote helper can advise one way or the other. Since we do
include the persistent-https helper in contrib/ (and since
it was the helper in the real-world case that inspired that
patch), let's also drop a note there.

Suggested-by: Elliott Cable <me@ell.io>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoC style: use standard style for "TRANSLATORS" comments
Ævar Arnfjörð Bjarmason [Thu, 11 May 2017 21:20:12 +0000 (21:20 +0000)] 
C style: use standard style for "TRANSLATORS" comments

Change all the "TRANSLATORS: [...]" comments in the C code to use the
regular Git coding style, and amend the style guide so that the
example there uses that style.

This custom style was necessary back in 2010 when the gettext support
was initially added, and was subsequently documented in commit
cbcfd4e3ea ("i18n: mention "TRANSLATORS:" marker in
Documentation/CodingGuidelines", 2014-04-18).

GNU xgettext hasn't had the parsing limitation that necessitated this
exception for almost 3 years. Since its 0.19 release on 2014-06-02
it's been able to recognize TRANSLATOR comments in the standard Git
comment syntax[1].

Usually we'd like to keep compatibility with software that's that
young, but in this case literally the only person who needs to be
using a gettext newer than 3 years old is Jiang Xin (the only person
who runs & commits "make pot" results), so I think in this case we can
make an exception.

This xgettext parsing feature was added after a thread on the Git
mailing list[2] which continued on the bug-gettext[3] list, but we
never subsequently changed our style & styleguide, do so.

There are already longstanding changes in git that use the standard
comment style & have their TRANSLATORS comments extracted properly
without getting the literal "*"'s mixed up in the text, as would
happen before xgettext 0.19.

Commit 7ff2683253 ("builtin-am: implement -i/--interactive",
2015-08-04) added one such comment, which in commit df0617bfa7 ("l10n:
git.pot: v2.6.0 round 1 (123 new, 41 removed)", 2015-09-05) got picked
up in the po/git.pot file with the right format, showing that Jiang
already runs a modern xgettext.

The xgettext parser does not handle the sort of non-standard comment
style that I'm amending here in sequencer.c, but that isn't standard
Git comment syntax anyway. With this change to sequencer.c & "make
pot" the comment in the pot file is now correct:

     #. TRANSLATORS: %s will be "revert", "cherry-pick" or
    -#. * "rebase -i".
    +#. "rebase -i".

1. http://git.savannah.gnu.org/cgit/gettext.git/commit/?id=10af7fe6bd
2. <2ce9ec406501d112e032c8208417f8100bed04c6.1397712142.git.worldhello.net@gmail.com>
   (https://public-inbox.org/git/2ce9ec406501d112e032c8208417f8100bed04c6.1397712142.git.worldhello.net@gmail.com/)
3. https://lists.gnu.org/archive/html/bug-gettext/2014-04/msg00016.html

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoam: handle "-h" argument earlier
Jeff King [Tue, 30 May 2017 05:11:23 +0000 (01:11 -0400)] 
am: handle "-h" argument earlier

If the user provides "-h" on the command line, then our
parse_options() invocation will show a usage message and
quit. But if "-h" is the only argument, the git wrapper
behaves specially: it ignores our RUN_SETUP flag and calls
cmd_am() without having done repository setup at all.  This
is due to 99caeed05 (Let 'git <command> -h' show usage
without a git dir, 2009-11-09).

Before cmd_am() calls parse_options(), though, it runs a few
other setup functions. One of these is am_state_init(),
which uses git_pathdup() to set up the default rebase-apply
path. But calling git_pathdup() when we haven't done
repository setup will fall back to using ".git". That's
mostly harmless (since we won't use the value anyway), but
is forbidden since b1ef400eec ("setup_git_env: avoid blind
fall-back to ".git"", 2016-10-20), and we now BUG().

We can't easily move that setup to after the parse_options()
call; the point is to set up defaults that are overwritten
by the option parsing. Instead, we'll detect the "-h" case
early and show the usage then. This matches the behavior of
other builtins which have a similar setup-ordering issue
(e.g., git-branch).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agocompletion: add completions for git config commit
Rikard Falkeborn [Sun, 28 May 2017 12:13:25 +0000 (14:13 +0200)] 
completion: add completions for git config commit

Add missing completions for git config:

* commit.cleanup
* commit.gpgSign
* commit.verbose

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoFourth batch for 2.14
Junio C Hamano [Tue, 30 May 2017 02:20:10 +0000 (11:20 +0900)] 
Fourth batch for 2.14

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'dt/unpack-save-untracked-cache-extension'
Junio C Hamano [Tue, 30 May 2017 02:16:45 +0000 (11:16 +0900)] 
Merge branch 'dt/unpack-save-untracked-cache-extension'

When "git checkout", "git merge", etc. manipulates the in-core
index, various pieces of information in the index extensions are
discarded from the original state, as it is usually not the case
that they are kept up-to-date and in-sync with the operation on the
main index.  The untracked cache extension is copied across these
operations now, which would speed up "git status" (as long as the
cache is properly invalidated).

* dt/unpack-save-untracked-cache-extension:
  unpack-trees: preserve index extensions

7 years agoMerge branch 'js/larger-timestamps'
Junio C Hamano [Tue, 30 May 2017 02:16:45 +0000 (11:16 +0900)] 
Merge branch 'js/larger-timestamps'

A follow-up hotfix for a topic already in 'master'.

* js/larger-timestamps:
  name-rev: change a "long" variable to timestamp_t

7 years agoMerge branch 'dk/send-email-avoid-net-smtp-ssl-when-able'
Junio C Hamano [Tue, 30 May 2017 02:16:45 +0000 (11:16 +0900)] 
Merge branch 'dk/send-email-avoid-net-smtp-ssl-when-able'

"git send-email" now uses Net::SMTP::SSL, which is obsolete, only
when needed.  Recent versions of Net::SMTP can do TLS natively.

* dk/send-email-avoid-net-smtp-ssl-when-able:
  send-email: Net::SMTP::SSL is obsolete, use only when necessary

7 years agoMerge branch 'jc/skip-test-in-the-middle'
Junio C Hamano [Tue, 30 May 2017 02:16:44 +0000 (11:16 +0900)] 
Merge branch 'jc/skip-test-in-the-middle'

A recent update to t5545-push-options.sh started skipping all the
tests in the script when a web server testing is disabled or
unavailable, not just the ones that require a web server.  Non HTTP
tests have been salvaged to always run in this script.

* jc/skip-test-in-the-middle:
  t5545: enhance test coverage when no http server is installed
  test: allow skipping the remainder

7 years agoMerge branch 'ab/conditional-config-with-symlinks'
Junio C Hamano [Tue, 30 May 2017 02:16:43 +0000 (11:16 +0900)] 
Merge branch 'ab/conditional-config-with-symlinks'

The recently introduced "[includeIf "gitdir:$dir"] path=..."
mechansim has further been taught to take symlinks into account.
The directory "$dir" specified in "gitdir:$dir" may be a symlink to
a real location, not something that $(getcwd) may return.  In such
a case, a realpath of "$dir" is compared with the real path of the
current repository to determine if the contents from the named path
should be included.

* ab/conditional-config-with-symlinks:
  config: match both symlink & realpath versions in IncludeIf.gitdir:*

7 years agoMerge branch 'jt/fetch-allow-tip-sha1-implicitly'
Junio C Hamano [Tue, 30 May 2017 02:16:43 +0000 (11:16 +0900)] 
Merge branch 'jt/fetch-allow-tip-sha1-implicitly'

There is no good reason why "git fetch $there $sha1" should fail
when the $sha1 names an object at the tip of an advertised ref,
even when the other side hasn't enabled allowTipSHA1InWant.

* jt/fetch-allow-tip-sha1-implicitly:
  fetch-pack: always allow fetching of literal SHA1s

7 years agoMerge branch 'jt/send-email-validate-hook'
Junio C Hamano [Tue, 30 May 2017 02:16:43 +0000 (11:16 +0900)] 
Merge branch 'jt/send-email-validate-hook'

"git send-email" learned to run sendemail-validate hook to inspect
and reject a message before sending it out.

* jt/send-email-validate-hook:
  send-email: support validate hook

7 years agoMerge branch 'jh/memihash-opt'
Junio C Hamano [Tue, 30 May 2017 02:16:42 +0000 (11:16 +0900)] 
Merge branch 'jh/memihash-opt'

perf-test update.

* jh/memihash-opt:
  p0004: don't error out if test repo is too small
  p0004: don't abort if multi-threaded is too slow
  p0004: use test_perf
  p0004: avoid using pipes
  p0004: simplify calls of test-lazy-init-name-hash

7 years agoMerge branch 'bp/sub-process-convert-filter'
Junio C Hamano [Tue, 30 May 2017 02:16:42 +0000 (11:16 +0900)] 
Merge branch 'bp/sub-process-convert-filter'

Code from "conversion using external process" codepath has been
extracted to a separate sub-process.[ch] module.

* bp/sub-process-convert-filter:
  convert: update subprocess_read_status() to not die on EOF
  sub-process: move sub-process functions into separate files
  convert: rename reusable sub-process functions
  convert: update generic functions to only use generic data structures
  convert: separate generic structures and variables from the filter specific ones
  convert: split start_multi_file_filter() into two separate functions
  pkt-line: annotate packet_writel with LAST_ARG_MUST_BE_NULL
  convert: move packet_write_line() into pkt-line as packet_writel()
  pkt-line: add packet_read_line_gently()
  pkt-line: fix packet_read_line() to handle len < 0 errors
  convert: remove erroneous tests for errno == EPIPE

7 years agoMerge branch 'bw/forking-and-threading'
Junio C Hamano [Tue, 30 May 2017 02:16:41 +0000 (11:16 +0900)] 
Merge branch 'bw/forking-and-threading'

The "run-command" API implementation has been made more robust
against dead-locking in a threaded environment.

* bw/forking-and-threading:
  usage.c: drop set_error_handle()
  run-command: restrict PATH search to executable files
  run-command: expose is_executable function
  run-command: block signals between fork and execve
  run-command: add note about forking and threading
  run-command: handle dup2 and close errors in child
  run-command: eliminate calls to error handling functions in child
  run-command: don't die in child when duping /dev/null
  run-command: prepare child environment before forking
  string-list: add string_list_remove function
  run-command: use the async-signal-safe execv instead of execvp
  run-command: prepare command before forking
  t0061: run_command executes scripts without a #! line
  t5550: use write_script to generate post-update hook

7 years agoMerge branch 'ab/perf-wildmatch'
Junio C Hamano [Tue, 30 May 2017 02:16:40 +0000 (11:16 +0900)] 
Merge branch 'ab/perf-wildmatch'

Add perf-test for wildmatch.

* ab/perf-wildmatch:
  perf: add test showing exponential growth in path globbing
  perf: add function to setup a fresh test repo

7 years agoMerge branch 'bw/pathspec-sans-the-index'
Junio C Hamano [Tue, 30 May 2017 02:16:40 +0000 (11:16 +0900)] 
Merge branch 'bw/pathspec-sans-the-index'

Simplify parse_pathspec() codepath and stop it from looking at the
default in-core index.

* bw/pathspec-sans-the-index:
  pathspec: convert find_pathspecs_matching_against_index to take an index
  pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP
  ls-files: prevent prune_cache from overeagerly pruning submodules
  pathspec: remove PATHSPEC_STRIP_SUBMODULE_SLASH_EXPENSIVE flag
  submodule: add die_in_unpopulated_submodule function
  pathspec: provide a more descriptive die message

7 years agoMerge branch 'jc/name-rev-lw-tag'
Junio C Hamano [Tue, 30 May 2017 02:16:39 +0000 (11:16 +0900)] 
Merge branch 'jc/name-rev-lw-tag'

"git describe --contains" penalized light-weight tags so much that
they were almost never considered.  Instead, give them about the
same chance to be considered as an annotated tag that is the same
age as the underlying commit would.

* jc/name-rev-lw-tag:
  name-rev: favor describing with tags and use committer date to tiebreak
  name-rev: refactor logic to see if a new candidate is a better name

7 years agobranch test: fix invalid config key access
Sahil Dua [Sun, 28 May 2017 17:12:16 +0000 (19:12 +0200)] 
branch test: fix invalid config key access

Fixes the test by changing "branch.s/s/dummy" to "branch.s/s.dummy" which is
the right way of accessing config key "branch.s/s.dummy". Purpose of
this test is to confirm that this key doesn't exist after the branch
"s/s" has been renamed to "s".

Earlier it was trying to access invalid config key and hence was getting
an error. However, this wasn't caught because we were expecting the
command to fail for other reason as mentioned above.

Signed-off-by: Sahil Dua <sahildua2305@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoThird batch for 2.14
Junio C Hamano [Mon, 29 May 2017 03:39:46 +0000 (12:39 +0900)] 
Third batch for 2.14

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'jk/ignore-broken-tags-when-ignoring-missing-links'
Junio C Hamano [Mon, 29 May 2017 03:34:54 +0000 (12:34 +0900)] 
Merge branch 'jk/ignore-broken-tags-when-ignoring-missing-links'

Tag objects, which are not reachable from any ref, that point at
missing objects were mishandled by "git gc" and friends (they
should silently be ignored instead)

* jk/ignore-broken-tags-when-ignoring-missing-links:
  revision.c: ignore broken tags with ignore_missing_links

7 years agoMerge branch 'jk/alternate-ref-optim'
Junio C Hamano [Mon, 29 May 2017 03:34:53 +0000 (12:34 +0900)] 
Merge branch 'jk/alternate-ref-optim'

A test allowed both "git push" and "git receive-pack" on the other
end write their traces into the same file.  This is OK on platforms
that allows atomically appending to a file opened with O_APPEND,
but on other platforms led to a mangled output, causing
intermittent test failures.  This has been fixed by disabling
traces from "receive-pack" in the test.

* jk/alternate-ref-optim:
  t5400: avoid concurrent writes into a trace file

7 years agoMerge branch 'bm/interpret-trailers-cut-line-is-eom'
Junio C Hamano [Mon, 29 May 2017 03:34:52 +0000 (12:34 +0900)] 
Merge branch 'bm/interpret-trailers-cut-line-is-eom'

"git interpret-trailers", when used as GIT_EDITOR for "git commit
-v", looked for and appended to a trailer block at the very end,
i.e. at the end of the "diff" output.  The command has been
corrected to pay attention to the cut-mark line "commit -v" adds to
the buffer---the real trailer block should appear just before it.

* bm/interpret-trailers-cut-line-is-eom:
  interpret-trailers: honor the cut line

7 years agoMerge branch 'tg/stash-push-fixup'
Junio C Hamano [Mon, 29 May 2017 03:34:52 +0000 (12:34 +0900)] 
Merge branch 'tg/stash-push-fixup'

The shell completion script (in contrib/) learned "git stash" has
a new "push" subcommand.

* tg/stash-push-fixup:
  completion: add git stash push

7 years agoMerge branch 'pw/rebase-i-regression-fix'
Junio C Hamano [Mon, 29 May 2017 03:34:51 +0000 (12:34 +0900)] 
Merge branch 'pw/rebase-i-regression-fix'

Regression fix to topic recently merged to 'master'.

* pw/rebase-i-regression-fix:
  rebase -i: add missing newline to end of message
  rebase -i: silence stash apply
  rebase -i: fix reflog message

7 years agoMerge branch 'kn/ref-filter-branch-list'
Junio C Hamano [Mon, 29 May 2017 03:34:50 +0000 (12:34 +0900)] 
Merge branch 'kn/ref-filter-branch-list'

"git for-each-ref --format=..." with %(HEAD) in the format used to
resolve the HEAD symref as many times as it had processed refs,
which was wasteful, and "git branch" shared the same problem.

* kn/ref-filter-branch-list:
  ref-filter: resolve HEAD when parsing %(HEAD) atom

7 years agoMerge branch 'km/log-showsignature-doc'
Junio C Hamano [Mon, 29 May 2017 03:34:49 +0000 (12:34 +0900)] 
Merge branch 'km/log-showsignature-doc'

* km/log-showsignature-doc:
  config.txt: add an entry for log.showSignature

7 years agoMerge branch 'jk/update-links-in-docs'
Junio C Hamano [Mon, 29 May 2017 03:34:48 +0000 (12:34 +0900)] 
Merge branch 'jk/update-links-in-docs'

A few http:// links that are redirected to https:// in the
documentation have been updated to https:// links.

* jk/update-links-in-docs:
  doc: use https links to Wikipedia to avoid http redirects

7 years agoMerge branch 'ja/do-not-ask-needless-questions'
Junio C Hamano [Mon, 29 May 2017 03:34:48 +0000 (12:34 +0900)] 
Merge branch 'ja/do-not-ask-needless-questions'

Git sometimes gives an advice in a rhetorical question that does
not require an answer, which can confuse new users and non native
speakers.  Attempt to rephrase them.

* ja/do-not-ask-needless-questions:
  git-filter-branch: be more direct in an error message
  read-tree -m: make error message for merging 0 trees less smart aleck
  usability: don't ask questions if no reply is required

7 years agoMerge branch 'jk/doc-config-include'
Junio C Hamano [Mon, 29 May 2017 03:34:47 +0000 (12:34 +0900)] 
Merge branch 'jk/doc-config-include'

Clarify documentation for include.path and includeIf.<condition>.path
configuration variables.

* jk/doc-config-include:
  docs/config: consistify include.path examples
  docs/config: avoid the term "expand" for includes
  docs/config: give a relative includeIf example
  docs/config: clarify include/includeIf relationship

7 years agoMerge branch 'sg/core-filemode-doc-typofix'
Junio C Hamano [Mon, 29 May 2017 03:34:46 +0000 (12:34 +0900)] 
Merge branch 'sg/core-filemode-doc-typofix'

* sg/core-filemode-doc-typofix:
  docs/config.txt: fix indefinite article in core.fileMode description

7 years agoMerge branch 'jk/bug-to-abort'
Junio C Hamano [Mon, 29 May 2017 03:34:45 +0000 (12:34 +0900)] 
Merge branch 'jk/bug-to-abort'

Introduce the BUG() macro to improve die("BUG: ...").

* jk/bug-to-abort:
  usage: add NORETURN to BUG() function definitions
  config: complain about --local outside of a git repo
  setup_git_env: convert die("BUG") to BUG()
  usage.c: add BUG() function

7 years agoMerge branch 'js/eol-on-ourselves'
Junio C Hamano [Mon, 29 May 2017 03:34:45 +0000 (12:34 +0900)] 
Merge branch 'js/eol-on-ourselves'

Make sure our tests would pass when the sources are checked out
with "platform native" line ending convention by default on
Windows.  Some "text" files out tests use and the test scripts
themselves that are meant to be run with /bin/sh, ought to be
checked out with eol=LF even on Windows.

* js/eol-on-ourselves:
  t4051: mark supporting files as requiring LF-only line endings
  Fix the remaining tests that failed with core.autocrlf=true
  t3901: move supporting files into t/t3901/
  completion: mark bash script as LF-only
  git-new-workdir: mark script as LF-only
  Fix build with core.autocrlf=true

7 years agoMerge branch 'jc/read-tree-empty-with-m'
Junio C Hamano [Mon, 29 May 2017 03:34:45 +0000 (12:34 +0900)] 
Merge branch 'jc/read-tree-empty-with-m'

"git read-tree -m" (no tree-ish) gave a nonsense suggestion "use
--empty if you want to clear the index".  With "-m", such a request
will still fail anyway, as you'd need to name at least one tree-ish
to be merged.

* jc/read-tree-empty-with-m:
  read-tree: "read-tree -m --empty" does not make sense

7 years agoMerge branch 'js/plug-leaks'
Junio C Hamano [Mon, 29 May 2017 03:34:44 +0000 (12:34 +0900)] 
Merge branch 'js/plug-leaks'

Fix memory leaks pointed out by Coverity (and people).

* js/plug-leaks: (26 commits)
  checkout: fix memory leak
  submodule_uses_worktrees(): plug memory leak
  show_worktree(): plug memory leak
  name-rev: avoid leaking memory in the `deref` case
  remote: plug memory leak in match_explicit()
  add_reflog_for_walk: avoid memory leak
  shallow: avoid memory leak
  line-log: avoid memory leak
  receive-pack: plug memory leak in update()
  fast-export: avoid leaking memory in handle_tag()
  mktree: plug memory leaks reported by Coverity
  pack-redundant: plug memory leak
  setup_discovered_git_dir(): plug memory leak
  setup_bare_git_dir(): help static analysis
  split_commit_in_progress(): simplify & fix memory leak
  checkout: fix memory leak
  cat-file: fix memory leak
  mailinfo & mailsplit: check for EOF while parsing
  status: close file descriptor after reading git-rebase-todo
  difftool: address a couple of resource/memory leaks
  ...

7 years agoMerge branch 'jk/disable-pack-reuse-when-broken'
Junio C Hamano [Mon, 29 May 2017 03:34:44 +0000 (12:34 +0900)] 
Merge branch 'jk/disable-pack-reuse-when-broken'

"pack-objects" can stream a slice of an existing packfile out when
the pack bitmap can tell that the reachable objects are all needed
in the output, without inspecting individual objects.  This
strategy however would not work well when "--local" and other
options are in use, and need to be disabled.

* jk/disable-pack-reuse-when-broken:
  t5310: fix "; do" style
  pack-objects: disable pack reuse for object-selection options

7 years agoMerge branch 'bc/object-id'
Junio C Hamano [Mon, 29 May 2017 03:34:43 +0000 (12:34 +0900)] 
Merge branch 'bc/object-id'

Conversion from uchar[20] to struct object_id continues.

* bc/object-id: (53 commits)
  object: convert parse_object* to take struct object_id
  tree: convert parse_tree_indirect to struct object_id
  sequencer: convert do_recursive_merge to struct object_id
  diff-lib: convert do_diff_cache to struct object_id
  builtin/ls-tree: convert to struct object_id
  merge: convert checkout_fast_forward to struct object_id
  sequencer: convert fast_forward_to to struct object_id
  builtin/ls-files: convert overlay_tree_on_cache to object_id
  builtin/read-tree: convert to struct object_id
  sha1_name: convert internals of peel_onion to object_id
  upload-pack: convert remaining parse_object callers to object_id
  revision: convert remaining parse_object callers to object_id
  revision: rename add_pending_sha1 to add_pending_oid
  http-push: convert process_ls_object and descendants to object_id
  refs/files-backend: convert many internals to struct object_id
  refs: convert struct ref_update to use struct object_id
  ref-filter: convert some static functions to struct object_id
  Convert struct ref_array_item to struct object_id
  Convert the verify_pack callback to struct object_id
  Convert lookup_tag to struct object_id
  ...

7 years agoMerge branch 'nd/split-index-unshare'
Junio C Hamano [Mon, 29 May 2017 03:34:43 +0000 (12:34 +0900)] 
Merge branch 'nd/split-index-unshare'

Plug some leaks and updates internal API used to implement the
split index feature to make it easier to avoid such a leak in the
future.

* nd/split-index-unshare:
  p3400: add perf tests for rebasing many changes
  split-index: add and use unshare_split_index()

7 years agoMerge branch 'jk/diff-submodule-diff-inline'
Junio C Hamano [Mon, 29 May 2017 03:34:42 +0000 (12:34 +0900)] 
Merge branch 'jk/diff-submodule-diff-inline'

"git diff --submodule=diff" now recurses into nested submodules.

* jk/diff-submodule-diff-inline:
  diff: recurse into nested submodules for inline diff

7 years agoMerge branch 'bw/dir-c-stops-relying-on-the-index'
Junio C Hamano [Mon, 29 May 2017 03:34:41 +0000 (12:34 +0900)] 
Merge branch 'bw/dir-c-stops-relying-on-the-index'

API update.

* bw/dir-c-stops-relying-on-the-index:
  dir: convert fill_directory to take an index
  dir: convert read_directory to take an index
  dir: convert read_directory_recursive to take an index
  dir: convert open_cached_dir to take an index
  dir: convert is_excluded to take an index
  dir: convert prep_exclude to take an index
  dir: convert add_excludes to take an index
  dir: convert is_excluded_from_list to take an index
  dir: convert last_exclude_matching_from_list to take an index
  dir: convert dir_add* to take an index
  dir: convert get_dtype to take index
  dir: convert directory_exists_in_index to take index
  dir: convert read_skip_worktree_file_from_index to take an index
  dir: stop using the index compatibility macros

7 years agoMerge branch 'sb/checkout-recurse-submodules'
Junio C Hamano [Mon, 29 May 2017 03:34:41 +0000 (12:34 +0900)] 
Merge branch 'sb/checkout-recurse-submodules'

"git checkout --recurse-submodules" did not quite work with a
submodule that itself has submodules.

* sb/checkout-recurse-submodules:
  submodule: properly recurse for read-tree and checkout
  submodule: avoid auto-discovery in new working tree manipulator code
  submodule_move_head: reuse child_process structure for futher commands

7 years agoMerge branch 'jc/repack-threads'
Junio C Hamano [Mon, 29 May 2017 03:34:41 +0000 (12:34 +0900)] 
Merge branch 'jc/repack-threads'

"git repack" learned to accept the --threads=<n> option and pass it
to pack-objects.

* jc/repack-threads:
  repack: accept --threads=<n> and pass it down to pack-objects

7 years agoMerge branch 'sb/reset-recurse-submodules'
Junio C Hamano [Mon, 29 May 2017 03:34:40 +0000 (12:34 +0900)] 
Merge branch 'sb/reset-recurse-submodules'

"git reset" learned "--recurse-submodules" option.

* sb/reset-recurse-submodules:
  builtin/reset: add --recurse-submodules switch
  submodule.c: submodule_move_head works with broken submodules
  submodule.c: uninitialized submodules are ignored in recursive commands
  entry.c: submodule recursing: respect force flag correctly

7 years agowildmatch test: remove redundant duplicate test
Ævar Arnfjörð Bjarmason [Fri, 26 May 2017 20:56:57 +0000 (20:56 +0000)] 
wildmatch test: remove redundant duplicate test

Remove a test line that's exactly the same as the preceding
line.

This was brought in in commit feabcc173b ("Integrate wildmatch to
git", 2012-10-15), these tests are originally copied from rsync.git,
but the duplicate line was never present there, so must have just
snuck in during integration with git by accident.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodoc: filter-branch does not require re-export of vars
Andreas Heiduk [Fri, 26 May 2017 17:36:54 +0000 (19:36 +0200)] 
doc: filter-branch does not require re-export of vars

The function `set_ident` in `filter-branch` exported the variables
GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL|DATE) at least since 6f6826c52b in 2007.
Therefore the filter scripts don't need to re-eport them again.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep: assert that threading is enabled when calling grep_{lock,unlock}
Ævar Arnfjörð Bjarmason [Thu, 25 May 2017 19:45:35 +0000 (19:45 +0000)] 
grep: assert that threading is enabled when calling grep_{lock,unlock}

Change the grep_{lock,unlock} functions to assert that num_threads is
true, instead of only locking & unlocking the pthread mutex lock when
it is.

These functions are never called when num_threads isn't true, this
logic has gone through multiple iterations since the initial
introduction of grep threading in commit 5b594f457a ("Threaded grep",
2010-01-25), but ever since then they'd only be called if num_threads
was true, so this check made the code confusing to read.

Replace the check with an assertion, so that it's clear to the reader
that this code path is never taken unless we're spawning threads.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep: given --threads with NO_PTHREADS=YesPlease, warn
Ævar Arnfjörð Bjarmason [Thu, 25 May 2017 19:45:34 +0000 (19:45 +0000)] 
grep: given --threads with NO_PTHREADS=YesPlease, warn

Add a warning about missing thread support when grep.threads or
--threads is set to a non 0 (default) or 1 (no parallelism) value
under NO_PTHREADS=YesPlease.

This is for consistency with the index-pack & pack-objects commands,
which also take a --threads option & are configurable via
pack.threads, and have long warned about the same under
NO_PTHREADS=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopack-objects: fix buggy warning about threads
Ævar Arnfjörð Bjarmason [Thu, 25 May 2017 19:45:33 +0000 (19:45 +0000)] 
pack-objects: fix buggy warning about threads

Fix a buggy warning about threads under NO_PTHREADS=YesPlease. Due to
re-using the delta_search_threads variable for both the state of the
"pack.threads" config & the --threads option, setting "pack.threads"
but not supplying --threads would trigger the warning for both
"pack.threads" & --threads.

Solve this bug by resetting the delta_search_threads variable in
git_pack_config(), it might then be set by --threads again and be
subsequently warned about, as the test I'm changing here asserts.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopack-objects & index-pack: add test for --threads warning
Ævar Arnfjörð Bjarmason [Thu, 25 May 2017 19:45:32 +0000 (19:45 +0000)] 
pack-objects & index-pack: add test for --threads warning

Add a test for the warning that's emitted when --threads or
pack.threads is provided under NO_PTHREADS=YesPlease. This uses the
new PTHREADS prerequisite.

The assertion for C_LOCALE_OUTPUT in the latter test is currently
redundant, since unlike index-pack the pack-objects warnings aren't
i18n'd. However they might be changed to be i18n'd in the future, and
there's no harm in future-proofing the test.

There's an existing bug in the implementation of pack-objects which
this test currently tests for as-is. Details about the bug & the fix
are included in a follow-up change.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotest-lib: add a PTHREADS prerequisite
Ævar Arnfjörð Bjarmason [Thu, 25 May 2017 19:45:31 +0000 (19:45 +0000)] 
test-lib: add a PTHREADS prerequisite

Add a PTHREADS prerequisite which is false when git is compiled with
NO_PTHREADS=YesPlease.

There's lots of custom code that runs when threading isn't available,
but before this prerequisite there was no way to test it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep: move is_fixed() earlier to avoid forward declaration
Ævar Arnfjörð Bjarmason [Thu, 25 May 2017 19:45:30 +0000 (19:45 +0000)] 
grep: move is_fixed() earlier to avoid forward declaration

Move the is_fixed() function which are currently only used in
compile_regexp() earlier so it can be used in the PCRE family of
functions in a later change.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>