git
7 years agoMerge branch 'ls/travis-doc-asciidoctor' into next
Junio C Hamano [Thu, 20 Apr 2017 05:10:07 +0000 (22:10 -0700)] 
Merge branch 'ls/travis-doc-asciidoctor' into next

Have Travis CI format the documentation with both AsciiDoc and
AsciiDoctor.

* ls/travis-doc-asciidoctor:
  travis-ci: unset compiler for jobs that do not need one
  travis-ci: parallelize documentation build
  travis-ci: build documentation with AsciiDoc and Asciidoctor

7 years agoMerge branch 'jh/verify-index-checksum-only-in-fsck' into next
Junio C Hamano [Thu, 20 Apr 2017 05:10:06 +0000 (22:10 -0700)] 
Merge branch 'jh/verify-index-checksum-only-in-fsck' into next

The index file has a trailing SHA-1 checksum to detect file
corruption, and historically we checked it every time the index
file is used.  Omit the validation during normal use, and instead
verify only in "git fsck".

* jh/verify-index-checksum-only-in-fsck:
  read-cache: force_verify_index_checksum

7 years agoMerge branch 'jh/unpack-trees-micro-optim' into next
Junio C Hamano [Thu, 20 Apr 2017 05:10:05 +0000 (22:10 -0700)] 
Merge branch 'jh/unpack-trees-micro-optim' into next

In a 2- and 3-way merge of trees, more than one source trees often
end up sharing an identical subtree; optimize by not reading the
same tree multiple times in such a case.

* jh/unpack-trees-micro-optim:
  unpack-trees: avoid duplicate ODB lookups during checkout

7 years agoMerge branch 'jh/string-list-micro-optim' into next
Junio C Hamano [Thu, 20 Apr 2017 05:10:04 +0000 (22:10 -0700)] 
Merge branch 'jh/string-list-micro-optim' into next

The string-list API used a custom reallocation strategy that was
very inefficient, instead of using the usual ALLOC_GROW() macro,
which has been fixed.

* jh/string-list-micro-optim:
  string-list: use ALLOC_GROW macro when reallocing string_list

7 years agoMerge branch 'nd/conditional-config-include' into next
Junio C Hamano [Thu, 20 Apr 2017 05:10:03 +0000 (22:10 -0700)] 
Merge branch 'nd/conditional-config-include' into next

$GIT_DIR may in some cases be normalized with all symlinks resolved
while "gitdir" path expansion in the pattern does not receive the
same treatment, leading to incorrect mismatch.  This has been fixed.

* nd/conditional-config-include:
  config: resolve symlinks in conditional include's patterns
  path.c: and an option to call real_path() in expand_user_path()

7 years agoMerge branch 'dt/http-postbuffer-can-be-large' into next
Junio C Hamano [Thu, 20 Apr 2017 05:10:02 +0000 (22:10 -0700)] 
Merge branch 'dt/http-postbuffer-can-be-large' into next

Allow the http.postbuffer configuration variable to be set to a
size that can be expressed in size_t, which can be larger than
ulong on some platforms.

* dt/http-postbuffer-can-be-large:
  http.postbuffer: allow full range of ssize_t values

7 years agoMerge branch 'tb/doc-eol-normalization' into next
Junio C Hamano [Thu, 20 Apr 2017 05:10:01 +0000 (22:10 -0700)] 
Merge branch 'tb/doc-eol-normalization' into next

Doc update.

* tb/doc-eol-normalization:
  gitattributes.txt: document how to normalize the line endings

7 years agoMerge branch 'sr/http-proxy-configuration-fix' into next
Junio C Hamano [Thu, 20 Apr 2017 05:10:00 +0000 (22:10 -0700)] 
Merge branch 'sr/http-proxy-configuration-fix' into next

"http.proxy" set to an empty string is used to disable the usage of
proxy.  We broke this early last year.

* sr/http-proxy-configuration-fix:
  http: fix the silent ignoring of proxy misconfiguraion
  http: honor empty http.proxy option to bypass proxy

7 years agoMerge branch 'nd/files-backend-git-dir' into next oblomov/worktree-add-existing
Junio C Hamano [Wed, 19 Apr 2017 05:36:38 +0000 (22:36 -0700)] 
Merge branch 'nd/files-backend-git-dir' into next

The "submodule" specific field in the ref_store structure is
replaced with a more generic "gitdir" that can later be used also
when dealing with ref_store that represents the set of refs visible
from the other worktrees.

* nd/files-backend-git-dir: (28 commits)
  refs.h: add a note about sorting order of for_each_ref_*
  t1406: new tests for submodule ref store
  t1405: some basic tests on main ref store
  t/helper: add test-ref-store to test ref-store functions
  refs: delete pack_refs() in favor of refs_pack_refs()
  files-backend: avoid ref api targeting main ref store
  refs: new transaction related ref-store api
  refs: add new ref-store api
  refs: rename get_ref_store() to get_submodule_ref_store() and make it public
  files-backend: replace submodule_allowed check in files_downcast()
  refs: move submodule code out of files-backend.c
  path.c: move some code out of strbuf_git_path_submodule()
  refs.c: make get_main_ref_store() public and use it
  refs.c: kill register_ref_store(), add register_submodule_ref_store()
  refs.c: flatten get_ref_store() a bit
  refs: rename lookup_ref_store() to lookup_submodule_ref_store()
  refs.c: introduce get_main_ref_store()
  files-backend: remove the use of git_path()
  files-backend: add and use files_ref_path()
  files-backend: add and use files_reflog_path()
  ...

7 years agoMerge branch 'jk/no-looking-at-dotgit-outside-repo' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:37 +0000 (22:36 -0700)] 
Merge branch 'jk/no-looking-at-dotgit-outside-repo' into next

Clean up fallouts from recent tightening of the set-up sequence,
where Git barfs when repository information is accessed without
first ensuring that it was started in a repository.

* jk/no-looking-at-dotgit-outside-repo:
  test-read-cache: setup git dir
  has_sha1_file: don't bother if we are not in a repository

7 years agoMerge branch 'vn/revision-shorthand-for-side-branch-log' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:36 +0000 (22:36 -0700)] 
Merge branch 'vn/revision-shorthand-for-side-branch-log' into next

Doc cleanup.

* vn/revision-shorthand-for-side-branch-log:
  doc/revisions: remove brackets from rev^-n shorthand

7 years agoMerge branch 'sf/putty-w-args' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:35 +0000 (22:36 -0700)] 
Merge branch 'sf/putty-w-args' into next

* sf/putty-w-args:
  connect.c: handle errors from split_cmdline

7 years agoMerge branch 'ld/p4-current-branch-fix' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:35 +0000 (22:36 -0700)] 
Merge branch 'ld/p4-current-branch-fix' into next

"git p4" used "name-rev HEAD" when it wants to learn what branch is
checked out; it should use "symbolic-ref HEAD".

* ld/p4-current-branch-fix:
  git-p4: don't use name-rev to get current branch
  git-p4: add read_pipe_text() internal function
  git-p4: add failing test for name-rev rather than symbolic-ref

7 years agoMerge branch 'dt/gc-ignore-old-gc-logs' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:34 +0000 (22:36 -0700)] 
Merge branch 'dt/gc-ignore-old-gc-logs' into next

* dt/gc-ignore-old-gc-logs:
  t6500: wait for detached auto gc at the end of the test script

7 years agoMerge branch 'bw/attr-pathspec' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:33 +0000 (22:36 -0700)] 
Merge branch 'bw/attr-pathspec' into next

* bw/attr-pathspec:
  pathspec: fix segfault in clear_pathspec

7 years agoMerge branch 'ab/grep-plug-pathspec-leak' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:32 +0000 (22:36 -0700)] 
Merge branch 'ab/grep-plug-pathspec-leak' into next

Call clear_pathspec() to release resources immediately before the
cmd_grep() function returns.

* ab/grep-plug-pathspec-leak:
  grep: plug a trivial memory leak

7 years agoMerge branch 'bw/submodule-is-active' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:31 +0000 (22:36 -0700)] 
Merge branch 'bw/submodule-is-active' into next

Error message fix.

* bw/submodule-is-active:
  submodule--helper: fix typo in is_active error message

7 years agoMerge branch 'va/i18n-perl-scripts' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:31 +0000 (22:36 -0700)] 
Merge branch 'va/i18n-perl-scripts' into next

Message fix.

* va/i18n-perl-scripts:
  git-add--interactive.perl: add missing dot in a message

7 years agoMerge branch 'sb/submodule-rm-absorb' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:30 +0000 (22:36 -0700)] 
Merge branch 'sb/submodule-rm-absorb' into next

Error message fix.

* sb/submodule-rm-absorb:
  submodule.c: add missing ' in error messages

7 years agoMerge branch 'ah/diff-files-ours-theirs-doc' into next
Junio C Hamano [Wed, 19 Apr 2017 05:36:29 +0000 (22:36 -0700)] 
Merge branch 'ah/diff-files-ours-theirs-doc' into next

The diff options "--ours", "--theirs" exist for quite some time.
But so far they were not documented. Now they are.

* ah/diff-files-ours-theirs-doc:
  diff-files: document --ours etc.

7 years agoMerge branch 'jh/memihash-opt' into next
Junio C Hamano [Wed, 19 Apr 2017 03:57:40 +0000 (20:57 -0700)] 
Merge branch 'jh/memihash-opt' into next

Hotfix for a topic that is already in 'master'.

* jh/memihash-opt:
  p0004: make perf test executable

7 years agop0004: make perf test executable
Christian Couder [Tue, 18 Apr 2017 14:24:07 +0000 (16:24 +0200)] 
p0004: make perf test executable

It looks like in 89c3b0ad43 (name-hash: add perf test for lazy_init_name_hash,
2017-03-23) p0004 was not created with the execute unix rights.
Let's fix that.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Acked-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodoc/revisions: remove brackets from rev^-n shorthand
Kyle Meyer [Sun, 16 Apr 2017 04:07:57 +0000 (00:07 -0400)] 
doc/revisions: remove brackets from rev^-n shorthand

Given that other instances of "{...}" in the revision documentation
represent literal characters of revision specifications, describing
the rev^-n shorthand as "<rev>^-{<n>}" incorrectly suggests that
something like "master^-{1}" is an acceptable form.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoSync with master
Junio C Hamano [Mon, 17 Apr 2017 06:38:53 +0000 (23:38 -0700)] 
Sync with master

* master:
  Twelfth batch for 2.13

7 years agoMerge branch 'lt/mailinfo-in-body-header-continuation' into next
Junio C Hamano [Mon, 17 Apr 2017 06:38:27 +0000 (23:38 -0700)] 
Merge branch 'lt/mailinfo-in-body-header-continuation' into next

If a patch e-mail had its first paragraph after an in-body header
indented (even after a blank line after the in-body header line),
the indented line was mistook as a continuation of the in-body
header.  This has been fixed.

* lt/mailinfo-in-body-header-continuation:
  mailinfo: fix in-body header continuations

7 years agoMerge branch 'bw/push-options-recursively-to-submodules' into next
Junio C Hamano [Mon, 17 Apr 2017 06:38:26 +0000 (23:38 -0700)] 
Merge branch 'bw/push-options-recursively-to-submodules' into next

"git push --recurse-submodules --push-option=<string>" learned to
propagate the push option recursively down to pushes in submodules.

* bw/push-options-recursively-to-submodules:
  push: propagate remote and refspec with --recurse-submodules
  submodule--helper: add push-check subcommand
  remote: expose parse_push_refspec function
  push: propagate push-options with --recurse-submodules
  push: unmark a local variable as static

7 years agoMerge branch 'bc/object-id' into next
Junio C Hamano [Mon, 17 Apr 2017 06:38:24 +0000 (23:38 -0700)] 
Merge branch 'bc/object-id' into next

Conversion from unsigned char [40] to struct object_id continues.

* bc/object-id:
  Documentation: update and rename api-sha1-array.txt
  Rename sha1_array to oid_array
  Convert sha1_array_for_each_unique and for_each_abbrev to object_id
  Convert sha1_array_lookup to take struct object_id
  Convert remaining callers of sha1_array_lookup to object_id
  Make sha1_array_append take a struct object_id *
  sha1-array: convert internal storage for struct sha1_array to object_id
  builtin/pull: convert to struct object_id
  submodule: convert check_for_new_submodule_commits to object_id
  sha1_name: convert disambiguate_hint_fn to take object_id
  sha1_name: convert struct disambiguate_state to object_id
  test-sha1-array: convert most code to struct object_id
  parse-options-cb: convert sha1_array_append caller to struct object_id
  fsck: convert init_skiplist to struct object_id
  builtin/receive-pack: convert portions to struct object_id
  builtin/pull: convert portions to struct object_id
  builtin/diff: convert to struct object_id
  Convert GIT_SHA1_RAWSZ used for allocation to GIT_MAX_RAWSZ
  Convert GIT_SHA1_HEXSZ used for allocation to GIT_MAX_HEXSZ
  Define new hash-size constants for allocating memory

7 years agoMerge branch 'sb/submodule-short-status' into next
Junio C Hamano [Mon, 17 Apr 2017 06:38:23 +0000 (23:38 -0700)] 
Merge branch 'sb/submodule-short-status' into next

The output from "git status --short" has been extended to show
various kinds of dirtyness in submodules differently; instead of to
"M" for modified, 'm' and '?' can be shown to signal changes only
to the working tree of the submodule but not the commit that is
checked out.

* sb/submodule-short-status:
  submodule.c: correctly handle nested submodules in is_submodule_modified
  short status: improve reporting for submodule changes
  submodule.c: stricter checking for submodules in is_submodule_modified
  submodule.c: port is_submodule_modified to use porcelain 2
  submodule.c: convert is_submodule_modified to use strbuf_getwholeline
  submodule.c: factor out early loop termination in is_submodule_modified
  submodule.c: use argv_array in is_submodule_modified

7 years agoTwelfth batch for 2.13
Junio C Hamano [Mon, 17 Apr 2017 06:30:49 +0000 (23:30 -0700)] 
Twelfth batch for 2.13

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'js/difftool-builtin'
Junio C Hamano [Mon, 17 Apr 2017 06:29:34 +0000 (23:29 -0700)] 
Merge branch 'js/difftool-builtin'

Code cleanup.

* js/difftool-builtin:
  difftool: fix use-after-free
  difftool: avoid strcpy

7 years agoMerge branch 'sb/unpack-trees-would-lose-submodule-message-update'
Junio C Hamano [Mon, 17 Apr 2017 06:29:34 +0000 (23:29 -0700)] 
Merge branch 'sb/unpack-trees-would-lose-submodule-message-update'

Update an error message.

* sb/unpack-trees-would-lose-submodule-message-update:
  unpack-trees.c: align submodule error message to the other error messages

7 years agoMerge branch 'ab/regen-perl-mak-with-different-perl'
Junio C Hamano [Mon, 17 Apr 2017 06:29:33 +0000 (23:29 -0700)] 
Merge branch 'ab/regen-perl-mak-with-different-perl'

Update the build dependency so that an update to /usr/bin/perl
etc. result in recomputation of perl.mak file.

* ab/regen-perl-mak-with-different-perl:
  perl: regenerate perl.mak if perl -V changes

7 years agoMerge branch 'sb/show-diff-for-submodule-in-diff-fix'
Junio C Hamano [Mon, 17 Apr 2017 06:29:32 +0000 (23:29 -0700)] 
Merge branch 'sb/show-diff-for-submodule-in-diff-fix'

"git diff --submodule=diff" learned to work better in a project
with a submodule that in turn has its own submodules.

* sb/show-diff-for-submodule-in-diff-fix:
  diff: submodule inline diff to initialize env array.

7 years agoMerge branch 'qp/bisect-docfix'
Junio C Hamano [Mon, 17 Apr 2017 06:29:31 +0000 (23:29 -0700)] 
Merge branch 'qp/bisect-docfix'

Doc update.

* qp/bisect-docfix:
  git-bisect.txt: add missing word

7 years agoMerge branch 'mm/ls-files-s-doc'
Junio C Hamano [Mon, 17 Apr 2017 06:29:30 +0000 (23:29 -0700)] 
Merge branch 'mm/ls-files-s-doc'

Doc update.

* mm/ls-files-s-doc:
  Documentation: document elements in "ls-files -s" output in order

7 years agoMerge branch 'jk/loose-object-info-report-error'
Junio C Hamano [Mon, 17 Apr 2017 06:29:30 +0000 (23:29 -0700)] 
Merge branch 'jk/loose-object-info-report-error'

Update error handling for codepath that deals with corrupt loose
objects.

* jk/loose-object-info-report-error:
  index-pack: detect local corruption in collision check
  sha1_loose_object_info: return error for corrupted objects

7 years agoMerge branch 'jc/bs-t-is-not-a-tab-for-sed'
Junio C Hamano [Mon, 17 Apr 2017 06:29:28 +0000 (23:29 -0700)] 
Merge branch 'jc/bs-t-is-not-a-tab-for-sed'

Code cleanup.

* jc/bs-t-is-not-a-tab-for-sed:
  contrib/git-resurrect.sh: do not write \t for HT in sed scripts

7 years agoMerge branch 'jc/unused-symbols'
Junio C Hamano [Mon, 17 Apr 2017 06:29:27 +0000 (23:29 -0700)] 
Merge branch 'jc/unused-symbols'

Code cleanup.

* jc/unused-symbols:
  remote.[ch]: parse_push_cas_option() can be static

7 years agoMerge branch 'jk/snprintf-cleanups'
Junio C Hamano [Mon, 17 Apr 2017 06:29:26 +0000 (23:29 -0700)] 
Merge branch 'jk/snprintf-cleanups'

Code clean-up.

* jk/snprintf-cleanups:
  daemon: use an argv_array to exec children
  gc: replace local buffer with git_path
  transport-helper: replace checked snprintf with xsnprintf
  convert unchecked snprintf into xsnprintf
  combine-diff: replace malloc/snprintf with xstrfmt
  replace unchecked snprintf calls with heap buffers
  receive-pack: print --pack-header directly into argv array
  name-rev: replace static buffer with strbuf
  create_branch: use xstrfmt for reflog message
  create_branch: move msg setup closer to point of use
  avoid using mksnpath for refs
  avoid using fixed PATH_MAX buffers for refs
  fetch: use heap buffer to format reflog
  tag: use strbuf to format tag header
  diff: avoid fixed-size buffer for patch-ids
  odb_mkstemp: use git_path_buf
  odb_mkstemp: write filename into strbuf
  do not check odb_mkstemp return value for errors

7 years agogit-p4: don't use name-rev to get current branch
Luke Diamand [Sat, 15 Apr 2017 10:36:09 +0000 (11:36 +0100)] 
git-p4: don't use name-rev to get current branch

git-p4 was using "git name-rev" to find out the current branch.

That is not safe, since if multiple branches or tags point at
the same revision, the result obtained might not be what is
expected.

Instead use "git symbolic-ref".

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-p4: add read_pipe_text() internal function
Luke Diamand [Sat, 15 Apr 2017 10:36:08 +0000 (11:36 +0100)] 
git-p4: add read_pipe_text() internal function

The existing read_pipe() function returns an empty string on
error, but also returns an empty string if the command returns
an empty string.

This leads to ugly constructions trying to detect error cases.

Add read_pipe_text() which just returns None on error.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-p4: add failing test for name-rev rather than symbolic-ref
Luke Diamand [Sat, 15 Apr 2017 10:36:07 +0000 (11:36 +0100)] 
git-p4: add failing test for name-rev rather than symbolic-ref

Using name-rev to find the current git branch means that git-p4
does not correctly get the current branch name if there are
multiple branches pointing at HEAD, or a tag.

This change adds a test case which demonstrates the problem.
Configuring which branches are allowed to be submitted from goes
wrong, as git-p4 gets confused about which branch is in use.

This appears to be the only place that git-p4 actually cares
about the current branch.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotest-read-cache: setup git dir
René Scharfe [Thu, 6 Apr 2017 20:41:41 +0000 (22:41 +0200)] 
test-read-cache: setup git dir

b1ef400e (setup_git_env: avoid blind fall-back to ".git") made programs
that tried to access a repository without initializing properly die with
a diagnostic message.  One offender is test-read-cache, which is used in
p0002.  Fix it by calling setup_git_directory() before accessing the
index.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot6500: wait for detached auto gc at the end of the test script
SZEDER Gábor [Thu, 13 Apr 2017 10:31:38 +0000 (12:31 +0200)] 
t6500: wait for detached auto gc at the end of the test script

The last test in 't6500-gc', 'background auto gc does not run if
gc.log is present and recent but does if it is old', added in
a831c06a2 (gc: ignore old gc.log files, 2017-02-10), may sporadically
trigger an error message from the test harness:

  rm: cannot remove 'trash directory.t6500-gc/.git/objects': Directory not empty

The test in question ends with executing an auto gc in the backround,
which occasionally takes so long that it's still running when
'test_done' is about to remove the trash directory.  This 'rm -rf
$trash' in the foreground might race with the detached auto gc to
create and delete files and directories, and gc might (re-)create a
path that 'rm' already visited and removed, triggering the above error
message when 'rm' attempts to remove its parent directory.

Commit bb05510e5 (t5510: run auto-gc in the foreground, 2016-05-01)
fixed the same problem in a different test script by simply
disallowing background gc.  Unfortunately, what worked there is not
applicable here, because the purpose of this test is to check the
behavior of a detached auto gc.

Make sure that the test doesn't continue before the gc is finished in
the background with a clever bit of shell trickery:

  - Open fd 9 in the shell, to be inherited by the background gc
    process, because our daemonize() only closes the standard fds 0,
    1 and 2.
  - Duplicate this fd 9 to stdout.
  - Read 'git gc's stdout, and thus fd 9, through a command
    substitution.  We don't actually care about gc's output, but this
    construct has two useful properties:
  - This read blocks until stdout or fd 9 are open.  While stdout is
    closed after the main gc process creates the background process
    and exits, fd 9 remains open until the backround process exits.
  - The variable assignment from the command substitution gets its
    exit status from the command executed within the command
    substitution, i.e. a failing main gc process will cause the test
    to fail.

Note, that this fd trickery doesn't work on Windows, because due to
MSYS limitations the git process only inherits the standard fds 0, 1
and 2 from the shell.  Luckily, it doesn't matter in this case,
because on Windows daemonize() is basically a noop, thus 'git gc
--auto' always runs in the foreground.

And since we can now continue the test reliably after the detached gc
finished, check that there is only a single packfile left at the end,
i.e. that the detached gc actually did what it was supposed to do.
Also add a comment at the end of the test script to warn developers of
future tests about this issue of long running detached gc processes.

Helped-by: Jeff King <peff@peff.net>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopathspec: fix segfault in clear_pathspec
Brandon Williams [Fri, 7 Apr 2017 19:29:19 +0000 (12:29 -0700)] 
pathspec: fix segfault in clear_pathspec

In 'clear_pathspec()' the incorrect index parameter is used to bound an
inner-loop which is used to free a 'struct attr_match' value field.
Using the incorrect index parameter (in addition to being incorrect)
occasionally causes segmentation faults when attempting to free an
invalid pointer.  Fix this by using the correct index parameter 'i'.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogrep: plug a trivial memory leak
Ævar Arnfjörð Bjarmason [Sun, 9 Apr 2017 19:59:00 +0000 (19:59 +0000)] 
grep: plug a trivial memory leak

Change the cleanup phase for the grep command to free the pathspec
struct that's allocated earlier in the same block, and used just a few
lines earlier.

With "grep hi README.md" valgrind reports a loss of 239 bytes now,
down from 351.

The relevant --num-callers=40 --leak-check=full --show-leak-kinds=all
backtrace is:

    [...] 187 (112 direct, 75 indirect) bytes in 1 blocks are definitely lost in loss record 70 of 110
    [...]    at 0x4C2BBAF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    [...]    by 0x60B339: do_xmalloc (wrapper.c:59)
    [...]    by 0x60B2F6: xmalloc (wrapper.c:86)
    [...]    by 0x576B37: parse_pathspec (pathspec.c:652)
    [...]    by 0x4519F0: cmd_grep (grep.c:1215)
    [...]    by 0x4062EF: run_builtin (git.c:371)
    [...]    by 0x40544D: handle_builtin (git.c:572)
    [...]    by 0x4060A2: run_argv (git.c:624)
    [...]    by 0x4051C6: cmd_main (git.c:701)
    [...]    by 0x4C5901: main (common-main.c:43)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconnect.c: handle errors from split_cmdline
Jeff King [Tue, 11 Apr 2017 00:30:23 +0000 (20:30 -0400)] 
connect.c: handle errors from split_cmdline

Commit e9d9a8a4d (connect: handle putty/plink also in
GIT_SSH_COMMAND, 2017-01-02) added a call to
split_cmdline(), but checks only for a non-zero return to
see if we got any output. Since the function returns
negative values (and a NULL argv) on error, we end up
dereferencing NULL and segfaulting.

Arguably we could report on the parsing error here, but it's
probably not worth it. This is a best-effort attempt to see
if we are using plink. So we can simply return here with
"no, it wasn't plink" and let the shell actually complain
about the bogus quoting.

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotravis-ci: unset compiler for jobs that do not need one
Lars Schneider [Tue, 11 Apr 2017 08:33:09 +0000 (10:33 +0200)] 
travis-ci: unset compiler for jobs that do not need one

TravisCI does not need to setup any compiler for the documentation
build. Clear the value to fix this.

The Linux32 build job does not define the compiler but it inherits the
value from the base job. Since it does not need the compiler either
because the build runs inside a Docker container we should clear this,
too.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotravis-ci: parallelize documentation build
Lars Schneider [Tue, 11 Apr 2017 08:33:08 +0000 (10:33 +0200)] 
travis-ci: parallelize documentation build

The documentation job without parallelization takes ~10min on TravisCI.
With parallelization ("--jobs=2") it takes ~6min.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotravis-ci: build documentation with AsciiDoc and Asciidoctor
Lars Schneider [Tue, 11 Apr 2017 08:33:07 +0000 (10:33 +0200)] 
travis-ci: build documentation with AsciiDoc and Asciidoctor

ec3366e introduced a knob to enable the use of Asciidoctor in addition
to AsciiDoc. Build the documentation on TravisCI with this knob to
reduce the likeliness of breaking Asciidoctor support in the future.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agounpack-trees: avoid duplicate ODB lookups during checkout
Jeff Hostetler [Fri, 14 Apr 2017 19:25:54 +0000 (19:25 +0000)] 
unpack-trees: avoid duplicate ODB lookups during checkout

Teach traverse_trees_recursive() to not do redundant ODB
lookups when both directories refer to the same OID.

In operations such as read-tree and checkout, there will
likely be many peer directories that have the same OID when
the differences between the commits are relatively small.
In these cases we can avoid hitting the ODB multiple times
for the same OID.

This patch handles n=2 and n=3 cases and simply copies the
data rather than repeating the fill_tree_descriptor().

================
On the Windows repo (500K trees, 3.1M files, 450MB index),
this reduced the overall time by 0.75 seconds when cycling
between 2 commits with a single file difference.

(avg) before: 22.699
(avg) after:  21.955
===============

================
On Linux using p0006-read-tree-checkout.sh with linux.git:

Test                                                          HEAD^              HEAD
-------------------------------------------------------------------------------------------------------
0006.2: read-tree br_base br_ballast (57994)                  0.24(0.20+0.03)    0.24(0.22+0.01) +0.0%
0006.3: switch between br_base br_ballast (57994)             10.58(6.23+2.86)   10.67(5.94+2.87) +0.9%
0006.4: switch between br_ballast br_ballast_plus_1 (57994)   0.60(0.44+0.17)    0.57(0.44+0.14) -5.0%
0006.5: switch between aliases (57994)                        0.59(0.48+0.13)    0.57(0.44+0.15) -3.4%
================

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agostring-list: use ALLOC_GROW macro when reallocing string_list
Jeff Hostetler [Fri, 14 Apr 2017 19:51:52 +0000 (19:51 +0000)] 
string-list: use ALLOC_GROW macro when reallocing string_list

Use ALLOC_GROW() macro when reallocing a string_list array
rather than simply increasing it by 32.  This is a performance
optimization.

During status on a very large repo and there are many changes,
a significant percentage of the total run time is spent
reallocing the wt_status.changes array.

This change decreases the time in wt_status_collect_changes_worktree()
from 125 seconds to 45 seconds on my very large repository.

This produced a modest gain on my 1M file artificial repo, but
broke even on linux.git.

Test                                            HEAD^^            HEAD
---------------------------------------------------------------------------------------
0005.2: read-tree status br_ballast (1000001)   8.29(5.62+2.62)   8.22(5.57+2.63) -0.8%

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'js/difftool-builtin' into next
Junio C Hamano [Sat, 15 Apr 2017 08:31:52 +0000 (01:31 -0700)] 
Merge branch 'js/difftool-builtin' into next

Code cleanup.

* js/difftool-builtin:
  difftool: fix use-after-free

7 years agoMerge branch 'jh/memihash-opt' into next
Junio C Hamano [Sat, 15 Apr 2017 08:31:51 +0000 (01:31 -0700)] 
Merge branch 'jh/memihash-opt' into next

Hotfix for a topic that is already in 'master'.

* jh/memihash-opt:
  t3008: skip lazy-init test on a single-core box
  test-online-cpus: helper to return cpu count

7 years agoread-cache: force_verify_index_checksum
Jeff Hostetler [Fri, 14 Apr 2017 20:32:21 +0000 (20:32 +0000)] 
read-cache: force_verify_index_checksum

Teach git to skip verification of the SHA1-1 checksum at the end of
the index file in verify_hdr() which is called from read_index()
unless the "force_verify_index_checksum" global variable is set.

Teach fsck to force this verification.

The checksum verification is for detecting disk corruption, and for
small projects, the time it takes to compute SHA-1 is not that
significant, but for gigantic repositories this calculation adds
significant time to every command.

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

Test                                          HEAD~1            HEAD
--------------------------------------------------------------------------------------
0002.1: read_cache/discard_cache 1000 times   0.66(0.44+0.20)   0.30(0.27+0.02) -54.5%

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoconfig: resolve symlinks in conditional include's patterns
Nguyễn Thái Ngọc Duy [Wed, 5 Apr 2017 10:24:39 +0000 (17:24 +0700)] 
config: resolve symlinks in conditional include's patterns

$GIT_DIR returned by get_git_dir() is normalized, with all symlinks
resolved (see setup_work_tree function). In order to match paths (or
patterns) against $GIT_DIR char-by-char, they have to be normalized
too. There is a note in config.txt about this, that the user need to
resolve symlinks by themselves if needed.

The problem is, we allow certain path expansion, '~/' and './', for
convenience and can't ask the user to resolve symlinks in these
expansions. Make sure the expanded paths have all symlinks resolved.

PS. The strbuf_realpath(&text, get_git_dir(), 1) is still needed because
get_git_dir() may return relative path.

Noticed-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopath.c: and an option to call real_path() in expand_user_path()
Nguyễn Thái Ngọc Duy [Wed, 5 Apr 2017 10:24:38 +0000 (17:24 +0700)] 
path.c: and an option to call real_path() in expand_user_path()

In the next patch we need the ability to expand '~' to
real_path($HOME). But we can't do that from outside because '~' is part
of a pattern, not a true path. Add an option to expand_user_path() to do
so.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs.h: add a note about sorting order of for_each_ref_*
Nguyễn Thái Ngọc Duy [Sun, 26 Mar 2017 02:42:41 +0000 (09:42 +0700)] 
refs.h: add a note about sorting order of for_each_ref_*

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot1406: new tests for submodule ref store
Nguyễn Thái Ngọc Duy [Sun, 26 Mar 2017 02:42:40 +0000 (09:42 +0700)] 
t1406: new tests for submodule ref store

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot1405: some basic tests on main ref store
Nguyễn Thái Ngọc Duy [Sun, 26 Mar 2017 02:42:39 +0000 (09:42 +0700)] 
t1405: some basic tests on main ref store

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot/helper: add test-ref-store to test ref-store functions
Nguyễn Thái Ngọc Duy [Sun, 26 Mar 2017 02:42:38 +0000 (09:42 +0700)] 
t/helper: add test-ref-store to test ref-store functions

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: delete pack_refs() in favor of refs_pack_refs()
Nguyễn Thái Ngọc Duy [Sun, 26 Mar 2017 02:42:37 +0000 (09:42 +0700)] 
refs: delete pack_refs() in favor of refs_pack_refs()

It only has one caller, not worth keeping just for convenience.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofiles-backend: avoid ref api targeting main ref store
Nguyễn Thái Ngọc Duy [Sun, 26 Mar 2017 02:42:36 +0000 (09:42 +0700)] 
files-backend: avoid ref api targeting main ref store

A small step towards making files-backend work as a non-main ref store
using the newly added store-aware API.

For the record, `join` and `nm` on refs.o and files-backend.o tell me
that files-backend no longer uses functions that default to
get_main_ref_store().

I'm not yet comfortable at the idea of removing
files_assert_main_repository() (or converting REF_STORE_MAIN to
REF_STORE_WRITE). More staring and testing is required before that can
happen. Well, except peel_ref(). I'm pretty sure that function is safe.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: new transaction related ref-store api
Nguyễn Thái Ngọc Duy [Sun, 26 Mar 2017 02:42:35 +0000 (09:42 +0700)] 
refs: new transaction related ref-store api

The transaction struct now takes a ref store at creation and will
operate on that ref store alone.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: add new ref-store api
Nguyễn Thái Ngọc Duy [Sun, 26 Mar 2017 02:42:34 +0000 (09:42 +0700)] 
refs: add new ref-store api

This is not meant to cover all existing API. It adds enough to test ref
stores with the new test program test-ref-store, coming soon and to be
used by files-backend.c.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agorefs: rename get_ref_store() to get_submodule_ref_store() and make it public
Nguyễn Thái Ngọc Duy [Sun, 26 Mar 2017 02:42:33 +0000 (09:42 +0700)] 
refs: rename get_ref_store() to get_submodule_ref_store() and make it public

This function is intended to replace *_submodule() refs API. It provides
a ref store for a specific submodule, which can be operated on by a new
set of refs API.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agofiles-backend: replace submodule_allowed check in files_downcast()
Nguyễn Thái Ngọc Duy [Sun, 26 Mar 2017 02:42:32 +0000 (09:42 +0700)] 
files-backend: replace submodule_allowed check in files_downcast()

files-backend.c is unlearning submodules. Instead of having a specific
check for submodules to see what operation is allowed, files backend
now takes a set of flags at init. Each operation will check if the
required flags is present before performing.

For now we have four flags: read, write and odb access. Main ref store
has all flags, obviously, while submodule stores are read-only and have
access to odb (*).

The "main" flag stays because many functions in the backend calls
frontend ones without a ref store, so these functions always target the
main ref store. Ideally the flag should be gone after ref-store-aware
api is in place and used by backends.

(*) Submodule code needs for_each_ref. Try take REF_STORE_ODB flag
out. At least t3404 would fail. The "have access to odb" in submodule is
a bit hacky since we don't know from he whether add_submodule_odb() has
been called.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agohas_sha1_file: don't bother if we are not in a repository
Jonathan Nieder [Tue, 11 Apr 2017 22:47:13 +0000 (15:47 -0700)] 
has_sha1_file: don't bother if we are not in a repository

Most callers to this function already require that they are in a
git repository, but there is an exception: "git apply" uses
has_sha1_file to avoid work if the result of applying a binary
patch is already present in the repository. When run outside any
repository, this produces an error:

 fatal: BUG: setup_git_env called without repository

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agohttp.postbuffer: allow full range of ssize_t values
David Turner [Tue, 11 Apr 2017 18:13:57 +0000 (14:13 -0400)] 
http.postbuffer: allow full range of ssize_t values

Unfortunately, in order to push some large repos where a server does
not support chunked encoding, the http postbuffer must sometimes
exceed two gigabytes.  On a 64-bit system, this is OK: we just malloc
a larger buffer.

This means that we need to use CURLOPT_POSTFIELDSIZE_LARGE to set the
buffer size.

Signed-off-by: David Turner <dturner@twosigma.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule--helper: fix typo in is_active error message
Stefan Beller [Thu, 13 Apr 2017 22:08:54 +0000 (15:08 -0700)] 
submodule--helper: fix typo in is_active error message

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogit-add--interactive.perl: add missing dot in a message
Ralf Thielow [Thu, 13 Apr 2017 16:41:12 +0000 (18:41 +0200)] 
git-add--interactive.perl: add missing dot in a message

One message appears twice in the translations and the only
difference is a dot at the end.  So add this dot to make
the messages being identical.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule.c: add missing ' in error messages
Ralf Thielow [Thu, 13 Apr 2017 16:40:45 +0000 (18:40 +0200)] 
submodule.c: add missing ' in error messages

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodifftool: fix use-after-free
Johannes Schindelin [Thu, 13 Apr 2017 19:21:58 +0000 (21:21 +0200)] 
difftool: fix use-after-free

The left and right base directories were pointed to the buf field of
two strbufs, which were subject to change.

A contrived test case shows the problem where a file with a long enough
name to force the strbuf to grow is up-to-date (hence the code path is
used where the work tree's version of the file is reused), and then a
file that is not up-to-date needs to be written (hence the code path is
used where checkout_entry() uses the previously recorded base_dir that
is invalid by now).

Let's just copy the base_dir strings for use with checkout_entry(),
never touch them until the end, and release them then. This is an easily
verifiable fix (as opposed to the next-obvious alternative: to re-set
base_dir after every loop iteration).

This fixes https://github.com/git-for-windows/git/issues/1124

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agodiff-files: document --ours etc.
Andreas Heiduk [Tue, 11 Apr 2017 14:39:50 +0000 (16:39 +0200)] 
diff-files: document --ours etc.

git-diff understands "--ours", "--theirs" and "--base" for files with
conflicts. But so far they were not documented for the central diff
command but only for diff-files.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agogitattributes.txt: document how to normalize the line endings
Torsten Bögershausen [Wed, 12 Apr 2017 11:48:09 +0000 (13:48 +0200)] 
gitattributes.txt: document how to normalize the line endings

The instructions how to normalize the line endings should have been updated
as part of commit 6523728499e 'convert: unify the "auto" handling of CRLF',
(but that part never made it into the commit).

Update the documentation in Documentation/gitattributes.txt and add
a test case in t0025.

Reported by Kristian Adrup
https://github.com/git-for-windows/git/issues/954

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agohttp: fix the silent ignoring of proxy misconfiguraion
Sergey Ryazanov [Tue, 11 Apr 2017 20:22:19 +0000 (23:22 +0300)] 
http: fix the silent ignoring of proxy misconfiguraion

Earlier, the whole http.proxy option string was passed to curl without
any preprocessing so curl could complain about the invalid proxy
configuration.

After the commit 372370f167 ("http: use credential API to handle proxy
authentication", 2016-01-26), if the user specified an invalid HTTP
proxy option in the configuration, then the option parsing silently
fails and NULL will be passed to curl as a proxy. This forces curl to
fall back to detecting the proxy configuration from the environment,
causing the http.proxy option ignoring.

Fix this issue by checking the proxy option parsing result. If parsing
failed then print an error message and die. Such behaviour allows the
user to quickly figure the proxy misconfiguration and correct it.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agohttp: honor empty http.proxy option to bypass proxy
Sergey Ryazanov [Tue, 11 Apr 2017 20:22:18 +0000 (23:22 +0300)] 
http: honor empty http.proxy option to bypass proxy

Curl distinguishes between an empty proxy address and a NULL proxy
address. In the first case it completely disables proxy usage, but if
the proxy address option is NULL then curl attempts to determine the
proxy address from the http_proxy environment variable.

According to the documentation, if the http.proxy option is set to an
empty string, git should bypass proxy and connect to the server
directly:

    export http_proxy=http://network-proxy/
    cd ~/foobar-project
    git config remote.origin.proxy ""
    git fetch

Previously, proxy host was configured by one line:

    curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);

Commit 372370f167 ("http: use credential API to handle proxy
authentication", 2016-01-26) parses the proxy option, then extracts the
proxy host address and updates the curl configuration, making the
previous call a noop:

    credential_from_url(&proxy_auth, curl_http_proxy);
    curl_easy_setopt(result, CURLOPT_PROXY, proxy_auth.host);

But if the proxy option is empty then the proxy host field becomes NULL.
This forces curl to fall back to detecting the proxy configuration from
the environment, causing the http.proxy option to not work anymore.

Fix this issue by explicitly handling http.proxy being set the empty
string. This also makes the code a bit more clear and should help us
avoid such regressions in the future.

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agot3008: skip lazy-init test on a single-core box
Kevin Willford [Mon, 3 Apr 2017 15:16:42 +0000 (15:16 +0000)] 
t3008: skip lazy-init test on a single-core box

The lazy-init codepath will not be exercised uniless threaded.  Skip
the entire test on a single-core box.  Also replace a hard-coded
constant of 2000 (number of cache entries to manifacture for tests)
with a variable with a human readable name.

Signed-off-by: Kevin Willford <kewillf@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agotest-online-cpus: helper to return cpu count
Jeff Hostetler [Mon, 3 Apr 2017 15:16:41 +0000 (15:16 +0000)] 
test-online-cpus: helper to return cpu count

Created helper executable to print the value of online_cpus()
allowing multi-threaded tests to be skipped when appropriate.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoSync with master
Junio C Hamano [Tue, 11 Apr 2017 07:55:18 +0000 (00:55 -0700)] 
Sync with master

* master:
  Eleventh batch for 2.13
  travis-ci: build and test Git on Windows

7 years agoMerge branch 'sb/unpack-trees-would-lose-submodule-message-update' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:13 +0000 (00:55 -0700)] 
Merge branch 'sb/unpack-trees-would-lose-submodule-message-update' into next

Update an error message.

* sb/unpack-trees-would-lose-submodule-message-update:
  unpack-trees.c: align submodule error message to the other error messages

7 years agoMerge branch 'ab/regen-perl-mak-with-different-perl' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:12 +0000 (00:55 -0700)] 
Merge branch 'ab/regen-perl-mak-with-different-perl' into next

Update the build dependency so that an update to /usr/bin/perl
etc. result in recomputation of perl.mak file.

* ab/regen-perl-mak-with-different-perl:
  perl: regenerate perl.mak if perl -V changes

7 years agoMerge branch 'sb/show-diff-for-submodule-in-diff-fix' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:11 +0000 (00:55 -0700)] 
Merge branch 'sb/show-diff-for-submodule-in-diff-fix' into next

"git diff --submodule=diff" learned to work better in a project
with a submodule that in turn has its own submodules.

* sb/show-diff-for-submodule-in-diff-fix:
  diff: submodule inline diff to initialize env array.

7 years agoMerge branch 'qp/bisect-docfix' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:10 +0000 (00:55 -0700)] 
Merge branch 'qp/bisect-docfix' into next

Doc update.

* qp/bisect-docfix:
  git-bisect.txt: add missing word

7 years agoMerge branch 'mm/ls-files-s-doc' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:09 +0000 (00:55 -0700)] 
Merge branch 'mm/ls-files-s-doc' into next

Doc update.

* mm/ls-files-s-doc:
  Documentation: document elements in "ls-files -s" output in order

7 years agoMerge branch 'jk/loose-object-info-report-error' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:08 +0000 (00:55 -0700)] 
Merge branch 'jk/loose-object-info-report-error' into next

Update error handling for codepath that deals with corrupt loose
objects.

* jk/loose-object-info-report-error:
  index-pack: detect local corruption in collision check
  sha1_loose_object_info: return error for corrupted objects

7 years agoMerge branch 'jc/bs-t-is-not-a-tab-for-sed' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:07 +0000 (00:55 -0700)] 
Merge branch 'jc/bs-t-is-not-a-tab-for-sed' into next

Code cleanup.

* jc/bs-t-is-not-a-tab-for-sed:
  contrib/git-resurrect.sh: do not write \t for HT in sed scripts

7 years agoMerge branch 'jc/unused-symbols' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:06 +0000 (00:55 -0700)] 
Merge branch 'jc/unused-symbols' into next

Code cleanup.

* jc/unused-symbols:
  remote.[ch]: parse_push_cas_option() can be static

7 years agoMerge branch 'js/difftool-builtin' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:05 +0000 (00:55 -0700)] 
Merge branch 'js/difftool-builtin' into next

Code cleanup.

* js/difftool-builtin:
  difftool: avoid strcpy

7 years agoMerge branch 'jh/memihash-opt' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:05 +0000 (00:55 -0700)] 
Merge branch 'jh/memihash-opt' into next

Hotfix for a topic that is already in 'master'.

* jh/memihash-opt:
  name-hash: fix buffer overrun

7 years agoMerge branch 'jk/snprintf-cleanups' into next
Junio C Hamano [Tue, 11 Apr 2017 07:55:04 +0000 (00:55 -0700)] 
Merge branch 'jk/snprintf-cleanups' into next

Code clean-up.

* jk/snprintf-cleanups:
  daemon: use an argv_array to exec children
  gc: replace local buffer with git_path
  transport-helper: replace checked snprintf with xsnprintf
  convert unchecked snprintf into xsnprintf
  combine-diff: replace malloc/snprintf with xstrfmt
  replace unchecked snprintf calls with heap buffers
  receive-pack: print --pack-header directly into argv array
  name-rev: replace static buffer with strbuf
  create_branch: use xstrfmt for reflog message
  create_branch: move msg setup closer to point of use
  avoid using mksnpath for refs
  avoid using fixed PATH_MAX buffers for refs
  fetch: use heap buffer to format reflog
  tag: use strbuf to format tag header
  diff: avoid fixed-size buffer for patch-ids
  odb_mkstemp: use git_path_buf
  odb_mkstemp: write filename into strbuf
  do not check odb_mkstemp return value for errors

7 years agomailinfo: fix in-body header continuations
Linus Torvalds [Sat, 1 Apr 2017 19:14:39 +0000 (12:14 -0700)] 
mailinfo: fix in-body header continuations

An empty line should stop any pending in-body headers, and start the
actual body parsing.

This also modifies the original test for the in-body headers to actually
have a real commit body that starts with spaces, and changes the test to
check that the long line matches _exactly_, and doesn't get extra data
from the body.

Fixes:6b4b013f1884 ("mailinfo: handle in-body header continuations")
Cc: Jonathan Tan <jonathantanmy@google.com>
Cc: Jeff King <peff@peff.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopush: propagate remote and refspec with --recurse-submodules
Brandon Williams [Wed, 5 Apr 2017 17:47:19 +0000 (10:47 -0700)] 
push: propagate remote and refspec with --recurse-submodules

Teach "push --recurse-submodules" to propagate, if given a name as remote, the
provided remote and refspec recursively to the pushes performed in the
submodules. The push will therefore only succeed if all submodules have a
remote with such a name configured.

Note that "push --recurse-submodules" with a path or URL as remote will not
propagate the remote or refspec and instead use the default remote and refspec
configured in the submodule, preserving the current behavior.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agosubmodule--helper: add push-check subcommand
Brandon Williams [Wed, 5 Apr 2017 17:47:18 +0000 (10:47 -0700)] 
submodule--helper: add push-check subcommand

Add the 'push-check' subcommand to submodule--helper which is used to
check if the provided remote and refspec can be used as part of a push
operation in the submodule.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoremote: expose parse_push_refspec function
Brandon Williams [Wed, 5 Apr 2017 17:47:17 +0000 (10:47 -0700)] 
remote: expose parse_push_refspec function

A future patch needs access to the 'parse_push_refspec()' function so
let's export the function so other modules can use it.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agopush: propagate push-options with --recurse-submodules
Brandon Williams [Wed, 5 Apr 2017 17:47:16 +0000 (10:47 -0700)] 
push: propagate push-options with --recurse-submodules

Teach push --recurse-submodules to propagate push-options recursively to
the pushes performed in the submodules.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoEleventh batch for 2.13
Junio C Hamano [Tue, 11 Apr 2017 07:27:05 +0000 (00:27 -0700)] 
Eleventh batch for 2.13

Signed-off-by: Junio C Hamano <gitster@pobox.com>
7 years agoMerge branch 'ls/travis-relays-for-windows-ci'
Junio C Hamano [Tue, 11 Apr 2017 07:21:52 +0000 (00:21 -0700)] 
Merge branch 'ls/travis-relays-for-windows-ci'

Define a new task in .travis.yml that triggers a test session on
Windows run elsewhere.

* ls/travis-relays-for-windows-ci:
  travis-ci: build and test Git on Windows

7 years agoMerge branch 'cc/untracked'
Junio C Hamano [Tue, 11 Apr 2017 07:21:51 +0000 (00:21 -0700)] 
Merge branch 'cc/untracked'

Code cleanup.

* cc/untracked:
  update-index: fix xgetcwd() related memory leak

7 years agoMerge branch 'ah/log-decorate-default-to-auto'
Junio C Hamano [Tue, 11 Apr 2017 07:21:51 +0000 (00:21 -0700)] 
Merge branch 'ah/log-decorate-default-to-auto'

The default behaviour of "git log" in an interactive session has
been changed to enable "--decorate".

* ah/log-decorate-default-to-auto:
  log: if --decorate is not given, default to --decorate=auto