git/git.git
3 years agoMerge branch 'bc/push-cert-receive-fix'
Junio C Hamano [Thu, 30 Mar 2017 21:07:18 +0000 (14:07 -0700)]
Merge branch 'bc/push-cert-receive-fix'

"git receive-pack" could have been forced to die by attempting
allocate an unreasonably large amount of memory with a crafted push
certificate; this has been fixed.

* bc/push-cert-receive-fix:
  builtin/receive-pack: fix incorrect pointer arithmetic

3 years agoMerge branch 'mh/notes-tree-consolidate-fix'
Junio C Hamano [Thu, 30 Mar 2017 21:07:17 +0000 (14:07 -0700)]
Merge branch 'mh/notes-tree-consolidate-fix'

Removing an entry from a notes tree and then looking another note
entry from the resulting tree using the internal notes API
functions did not work as expected.  No in-tree users of the API
has such access pattern, but it still is worth fixing.

* mh/notes-tree-consolidate-fix:
  notes: do not break note_tree structure in note_tree_consolidate()

3 years agoMerge branch 'js/rebase-i-reword-to-run-hooks'
Junio C Hamano [Thu, 30 Mar 2017 21:07:17 +0000 (14:07 -0700)]
Merge branch 'js/rebase-i-reword-to-run-hooks'

A recent update to "rebase -i" stopped running hooks for the "git
commit" command during "reword" action, which has been fixed.

* js/rebase-i-reword-to-run-hooks:
  sequencer: allow the commit-msg hooks to run during a `reword`
  sequencer: make commit options more extensible
  t7504: document regression: reword no longer calls commit-msg

3 years agoMerge branch 'mg/describe-debug-l10n'
Junio C Hamano [Thu, 30 Mar 2017 21:07:17 +0000 (14:07 -0700)]
Merge branch 'mg/describe-debug-l10n'

Some debugging output from "git describe" were marked for l10n,
but some weren't.  Mark missing ones for l10n.

* mg/describe-debug-l10n:
  l10n: de: translate describe debug terms
  describe: localize debug output fully

3 years agoMerge branch 'ab/case-insensitive-upstream-and-push-marker'
Junio C Hamano [Thu, 30 Mar 2017 21:07:16 +0000 (14:07 -0700)]
Merge branch 'ab/case-insensitive-upstream-and-push-marker'

On many keyboards, typing "@{" involves holding down SHIFT key and
one can easily end up with "@{Up..." when typing "@{upstream}".  As
the upstream/push keywords do not appear anywhere else in the syntax,
we can safely accept them case insensitively without introducing
ambiguity or confusion  to solve this.

* ab/case-insensitive-upstream-and-push-marker:
  rev-parse: match @{upstream}, @{u} and @{push} case-insensitively

3 years agoMerge branch 'ab/doc-submitting'
Junio C Hamano [Thu, 30 Mar 2017 21:07:16 +0000 (14:07 -0700)]
Merge branch 'ab/doc-submitting'

Doc update.

* ab/doc-submitting:
  doc/SubmittingPatches: show how to get a CLI commit summary
  doc/SubmittingPatches: clarify the casing convention for "area: change..."

3 years agoMerge branch 'ab/test-readme-updates'
Junio C Hamano [Thu, 30 Mar 2017 21:07:16 +0000 (14:07 -0700)]
Merge branch 'ab/test-readme-updates'

Doc updates.

* ab/test-readme-updates:
  t/README: clarify the test_have_prereq documentation
  t/README: change "Inside <X> part" to "Inside the <X> part"
  t/README: link to metacpan.org, not search.cpan.org

3 years agoMerge branch 'rs/freebsd-getcwd-workaround'
Junio C Hamano [Thu, 30 Mar 2017 21:07:15 +0000 (14:07 -0700)]
Merge branch 'rs/freebsd-getcwd-workaround'

FreeBSD implementation of getcwd(3) behaved differently when an
intermediate directory is unreadable/unsearchable depending on the
length of the buffer provided, which our strbuf_getcwd() was not
aware of.  strbuf_getcwd() has been taught to cope with it better.

* rs/freebsd-getcwd-workaround:
  strbuf: support long paths w/o read rights in strbuf_getcwd() on FreeBSD

3 years agoMerge branch 'bw/recurse-submodules-relative-fix'
Junio C Hamano [Thu, 30 Mar 2017 21:07:15 +0000 (14:07 -0700)]
Merge branch 'bw/recurse-submodules-relative-fix'

A few commands that recently learned the "--recurse-submodule"
option misbehaved when started from a subdirectory of the
superproject.

* bw/recurse-submodules-relative-fix:
  ls-files: fix bug when recursing with relative pathspec
  ls-files: fix typo in variable name
  grep: fix bug when recursing with relative pathspec
  setup: allow for prefix to be passed to git commands
  grep: fix help text typo

3 years agoMerge branch 'sg/completion-ctags'
Junio C Hamano [Thu, 30 Mar 2017 21:07:15 +0000 (14:07 -0700)]
Merge branch 'sg/completion-ctags'

Command line completion updates.

* sg/completion-ctags:
  completion: offer ctags symbol names for 'git log -S', '-G' and '-L:'
  completion: extract completing ctags symbol names into helper function
  completion: put matching ctags symbol names directly into COMPREPLY

3 years agoMerge branch 'sg/completion-refs-speedup'
Junio C Hamano [Thu, 30 Mar 2017 21:07:14 +0000 (14:07 -0700)]
Merge branch 'sg/completion-refs-speedup'

The refs completion for large number of refs has been sped up,
partly by giving up disambiguating ambiguous refs and partly by
eliminating most of the shell processing between 'git for-each-ref'
and 'ls-remote' and Bash's completion facility.

* sg/completion-refs-speedup:
  completion: speed up branch and tag completion
  completion: fill COMPREPLY directly when completing fetch refspecs
  completion: fill COMPREPLY directly when completing refs
  completion: let 'for-each-ref' sort remote branches for 'checkout' DWIMery
  completion: let 'for-each-ref' filter remote branches for 'checkout' DWIMery
  completion: let 'for-each-ref' strip the remote name from remote branches
  completion: let 'for-each-ref' and 'ls-remote' filter matching refs
  completion: don't disambiguate short refs
  completion: don't disambiguate tags and branches
  completion: support excluding full refs
  completion: support completing fully qualified non-fast-forward refspecs
  completion: support completing full refs after '--option=refs/<TAB>'
  completion: wrap __git_refs() for better option parsing
  completion: remove redundant __gitcomp_nl() options from _git_commit()

3 years agoMerge branch 'bw/submodule-is-active'
Junio C Hamano [Thu, 30 Mar 2017 21:07:14 +0000 (14:07 -0700)]
Merge branch 'bw/submodule-is-active'

"what URL do we want to update this submodule?" and "are we
interested in this submodule?" are split into two distinct
concepts, and then the way used to express the latter got extended,
paving a way to make it easier to manage a project with many
submodules and make it possible to later extend use of multiple
worktrees for a project with submodules.

* bw/submodule-is-active:
  submodule add: respect submodule.active and submodule.<name>.active
  submodule--helper init: set submodule.<name>.active
  clone: teach --recurse-submodules to optionally take a pathspec
  submodule init: initialize active submodules
  submodule: decouple url and submodule interest
  submodule--helper clone: check for configured submodules using helper
  submodule sync: use submodule--helper is-active
  submodule sync: skip work for inactive submodules
  submodule status: use submodule--helper is-active
  submodule--helper: add is-active subcommand

3 years agoMerge branch 'jk/no-looking-at-dotgit-outside-repo-final'
Junio C Hamano [Thu, 30 Mar 2017 21:07:13 +0000 (14:07 -0700)]
Merge branch 'jk/no-looking-at-dotgit-outside-repo-final'

This is the endgame of the topic to avoid blindly falling back to
".git" when the setup sequence said we are _not_ in Git repository.
A corner case that happens to work right now may be broken by a
call to die("BUG").

* jk/no-looking-at-dotgit-outside-repo-final:
  setup_git_env: avoid blind fall-back to ".git"

3 years agoMerge branch 'jc/merge-drop-old-syntax'
Junio C Hamano [Thu, 30 Mar 2017 21:07:13 +0000 (14:07 -0700)]
Merge branch 'jc/merge-drop-old-syntax'

Stop supporting "git merge <message> HEAD <commit>" syntax that has
been deprecated since October 2007, and issues a deprecation
warning message since v2.5.0.

* jc/merge-drop-old-syntax:
  merge: drop 'git merge <message> HEAD <commit>' syntax

3 years agoNinth batch for 2.13
Junio C Hamano [Tue, 28 Mar 2017 21:14:56 +0000 (14:14 -0700)]
Ninth batch for 2.13

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSync with 'maint'
Junio C Hamano [Tue, 28 Mar 2017 21:14:24 +0000 (14:14 -0700)]
Sync with 'maint'

3 years agoMerge branch 'jk/sha1dc'
Junio C Hamano [Tue, 28 Mar 2017 21:06:00 +0000 (14:06 -0700)]
Merge branch 'jk/sha1dc'

sha1dc/sha1.c wanted to check the endianness of the target platform
at compilation time and used a CPP macro with a rather overly
generic name, "BIGENDIAN", to pass the result of the check around
in the file.  It wasn't prepared for the same macro set to 0
(false) by the platform to signal that the target is _not_ a big
endian box, and assumed that the endianness detection logic it has
alone would be the one that is setting the macro, resulting in a
breakage on Windows.  This has been fixed by using a bit less
generic name for the same purpose.

* jk/sha1dc:
  sha1dc: avoid CPP macro collisions

3 years agoMerge branch 'jh/memihash-opt'
Junio C Hamano [Tue, 28 Mar 2017 21:06:00 +0000 (14:06 -0700)]
Merge branch 'jh/memihash-opt'

The name-hash used for detecting paths that are different only in
cases (which matter on case insensitive filesystems) has been
optimized to take advantage of multi-threading when it makes sense.

* jh/memihash-opt:
  name-hash: add test-lazy-init-name-hash to .gitignore
  name-hash: add perf test for lazy_init_name_hash
  name-hash: add test-lazy-init-name-hash
  name-hash: perf improvement for lazy_init_name_hash
  hashmap: document memihash_cont, hashmap_disallow_rehash api
  hashmap: add disallow_rehash setting
  hashmap: allow memihash computation to be continued
  name-hash: specify initial size for istate.dir_hash table

3 years agoMerge branch 'jk/fast-import-cleanup'
Junio C Hamano [Tue, 28 Mar 2017 21:05:59 +0000 (14:05 -0700)]
Merge branch 'jk/fast-import-cleanup'

Code clean-up.

* jk/fast-import-cleanup:
  pack.h: define largest possible encoded object size
  encode_in_pack_object_header: respect output buffer length
  fast-import: use xsnprintf for formatting headers
  fast-import: use xsnprintf for writing sha1s

3 years agoMerge branch 'sg/skip-prefix-in-prettify-refname'
Junio C Hamano [Tue, 28 Mar 2017 21:05:59 +0000 (14:05 -0700)]
Merge branch 'sg/skip-prefix-in-prettify-refname'

Code cleanup.

* sg/skip-prefix-in-prettify-refname:
  refs.c: use skip_prefix() in prettify_refname()

3 years agoMerge branch 'ab/branch-list-doc'
Junio C Hamano [Tue, 28 Mar 2017 21:05:59 +0000 (14:05 -0700)]
Merge branch 'ab/branch-list-doc'

Doc update.

* ab/branch-list-doc:
  branch doc: update description for `--list`
  branch doc: change `git branch <pattern>` to use `<branchname>`

3 years agoMerge branch 'jk/pager-in-use'
Junio C Hamano [Tue, 28 Mar 2017 21:05:58 +0000 (14:05 -0700)]
Merge branch 'jk/pager-in-use'

Code clean-up.

* jk/pager-in-use:
  pager_in_use: use git_env_bool()

3 years agoMerge branch 'tg/stash-push-fixup'
Junio C Hamano [Tue, 28 Mar 2017 21:05:58 +0000 (14:05 -0700)]
Merge branch 'tg/stash-push-fixup'

Recent enhancement to "git stash push" command to support pathspec
to allow only a subset of working tree changes to be stashed away
was found to be too chatty and exposed the internal implementation
detail (e.g. when it uses reset to match the index to HEAD before
doing other things, output from reset seeped out).  These, and
other chattyness has been fixed.

* tg/stash-push-fixup:
  stash: keep untracked files intact in stash -k
  stash: pass the pathspec argument to git reset
  stash: don't show internal implementation details

3 years agoMerge branch 'sb/checkout-recurse-submodules'
Junio C Hamano [Tue, 28 Mar 2017 21:05:58 +0000 (14:05 -0700)]
Merge branch 'sb/checkout-recurse-submodules'

"git checkout" is taught the "--recurse-submodules" option.

* sb/checkout-recurse-submodules:
  builtin/read-tree: add --recurse-submodules switch
  builtin/checkout: add --recurse-submodules switch
  entry.c: create submodules when interesting
  unpack-trees: check if we can perform the operation for submodules
  unpack-trees: pass old oid to verify_clean_submodule
  update submodules: add submodule_move_head
  submodule.c: get_super_prefix_or_empty
  update submodules: move up prepare_submodule_repo_env
  submodules: introduce check to see whether to touch a submodule
  update submodules: add a config option to determine if submodules are updated
  update submodules: add submodule config parsing
  make is_submodule_populated gently
  lib-submodule-update.sh: define tests for recursing into submodules
  lib-submodule-update.sh: replace sha1 by hash
  lib-submodule-update: teach test_submodule_content the -C <dir> flag
  lib-submodule-update.sh: do not use ./. as submodule remote
  lib-submodule-update.sh: reorder create_lib_submodule_repo
  submodule--helper.c: remove duplicate code
  connect_work_tree_and_git_dir: safely create leading directories

3 years agoMerge branch 'bw/grep-recurse-submodules'
Junio C Hamano [Tue, 28 Mar 2017 21:05:57 +0000 (14:05 -0700)]
Merge branch 'bw/grep-recurse-submodules'

Build fix for NO_PTHREADS build.

* bw/grep-recurse-submodules:
  grep: fix builds with with no thread support
  grep: set default output method

3 years agoPrepare for 2.12.3
Junio C Hamano [Tue, 28 Mar 2017 20:54:14 +0000 (13:54 -0700)]
Prepare for 2.12.3

3 years agoMerge branch 'km/config-grammofix' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:29 +0000 (13:52 -0700)]
Merge branch 'km/config-grammofix' into maint

Doc update.

* km/config-grammofix:
  doc/config: grammar fixes for core.{editor,commentChar}

3 years agoMerge branch 'sb/t3600-rephrase' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:29 +0000 (13:52 -0700)]
Merge branch 'sb/t3600-rephrase' into maint

A test retitling.

* sb/t3600-rephrase:
  t3600: rename test to describe its functionality

3 years agoMerge branch 'sb/submodule-update-initial-runs-custom-script' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:29 +0000 (13:52 -0700)]
Merge branch 'sb/submodule-update-initial-runs-custom-script' into maint

A test fix.

* sb/submodule-update-initial-runs-custom-script:
  t7406: correct test case for submodule-update initial population

3 years agoMerge branch 'jk/quote-env-path-list-component' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:28 +0000 (13:52 -0700)]
Merge branch 'jk/quote-env-path-list-component' into maint

A test fix.

* jk/quote-env-path-list-component:
  t5615: fix a here-doc syntax error

3 years agoMerge branch 'rs/update-hook-optim' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:28 +0000 (13:52 -0700)]
Merge branch 'rs/update-hook-optim' into maint

Code clean-up.

* rs/update-hook-optim:
  receive-pack: simplify run_update_post_hook()

3 years agoMerge branch 'rs/shortlog-cleanup' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:27 +0000 (13:52 -0700)]
Merge branch 'rs/shortlog-cleanup' into maint

Code clean-up.

* rs/shortlog-cleanup:
  shortlog: don't set after_subject to an empty string

3 years agoMerge branch 'rs/path-name-safety-cleanup' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:27 +0000 (13:52 -0700)]
Merge branch 'rs/path-name-safety-cleanup' into maint

Code clean-up.

* rs/path-name-safety-cleanup:
  revision: remove declaration of path_name()

3 years agoMerge branch 'rs/http-push-cleanup' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:26 +0000 (13:52 -0700)]
Merge branch 'rs/http-push-cleanup' into maint

Code clean-up.

* rs/http-push-cleanup:
  http-push: don't check return value of lookup_unknown_object()

3 years agoMerge branch 'sb/wt-status-cleanup' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:26 +0000 (13:52 -0700)]
Merge branch 'sb/wt-status-cleanup' into maint

Code clean-up.

* sb/wt-status-cleanup:
  wt-status: simplify by using for_each_string_list_item

3 years agoMerge branch 'jk/pack-name-cleanups' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:25 +0000 (13:52 -0700)]
Merge branch 'jk/pack-name-cleanups' into maint

Code clean-up.

* jk/pack-name-cleanups:
  index-pack: make pointer-alias fallbacks safer
  replace snprintf with odb_pack_name()
  odb_pack_keep(): stop generating keepfile name
  sha1_file.c: make pack-name helper globally accessible
  move odb_* declarations out of git-compat-util.h

3 years agoMerge branch 'jk/rev-parse-cleanup' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:25 +0000 (13:52 -0700)]
Merge branch 'jk/rev-parse-cleanup' into maint

Code clean-up.

* jk/rev-parse-cleanup:
  rev-parse: simplify parsing of ref options
  rev-parse: add helper for parsing "--foo/--foo="
  rev-parse: use skip_prefix when parsing options

3 years agoMerge branch 'rs/blame-code-cleanup' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:25 +0000 (13:52 -0700)]
Merge branch 'rs/blame-code-cleanup' into maint

Code clean-up.

* rs/blame-code-cleanup:
  blame: move blame_entry duplication to add_blame_entry()

3 years agoMerge branch 'st/verify-tag' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:24 +0000 (13:52 -0700)]
Merge branch 'st/verify-tag' into maint

A few unterminated here documents in tests were fixed, which in
turn revealed incorrect expectations the tests make. These tests
have been updated.

* st/verify-tag:
  t7004, t7030: fix here-doc syntax errors

3 years agoMerge branch 'js/regexec-buf' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:24 +0000 (13:52 -0700)]
Merge branch 'js/regexec-buf' into maint

Fix for potential segv introduced in v2.11.0 and later (also
v2.10.2).

* js/regexec-buf:
  pickaxe: fix segfault with '-S<...> --pickaxe-regex'

3 years agoMerge branch 'jk/execv-dashed-external' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:23 +0000 (13:52 -0700)]
Merge branch 'jk/execv-dashed-external' into maint

Fix for NO_PTHREADS build.

* jk/execv-dashed-external:
  run-command: fix segfault when cleaning forked async process

3 years agoMerge branch 'ew/http-alternates-as-redirects-warning' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:23 +0000 (13:52 -0700)]
Merge branch 'ew/http-alternates-as-redirects-warning' into maint

Recent versions of Git treats http alternates (used in dumb http
transport) just like HTTP redirects and requires the client to
enable following it, due to security concerns.  But we forgot to
give a warning when we decide not to honor the alternates.

* ew/http-alternates-as-redirects-warning:
  http: release strbuf on disabled alternates
  http: inform about alternates-as-redirects behavior

3 years agoMerge branch 'dp/filter-branch-prune-empty' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:22 +0000 (13:52 -0700)]
Merge branch 'dp/filter-branch-prune-empty' into maint

"git filter-branch --prune-empty" drops a single-parent commit that
becomes a no-op, but did not drop a root commit whose tree is empty.

* dp/filter-branch-prune-empty:
  p7000: add test for filter-branch with --prune-empty
  filter-branch: fix --prune-empty on parentless commits
  t7003: ensure --prune-empty removes entire branch when applicable
  t7003: ensure --prune-empty can prune root commit

3 years agoMerge branch 'mm/fetch-show-error-message-on-unadvertised-object' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:22 +0000 (13:52 -0700)]
Merge branch 'mm/fetch-show-error-message-on-unadvertised-object' into maint

"git fetch" that requests a commit by object name, when the other
side does not allow such an request, failed without much
explanation.

* mm/fetch-show-error-message-on-unadvertised-object:
  fetch-pack: add specific error for fetching an unadvertised object
  fetch_refs_via_pack: call report_unmatched_refs
  fetch-pack: move code to report unmatched refs to a function

3 years agoMerge branch 'jk/interpret-branch-name' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:22 +0000 (13:52 -0700)]
Merge branch 'jk/interpret-branch-name' into maint

"git branch @" created refs/heads/@ as a branch, and in general the
code that handled @{-1} and @{upstream} was a bit too loose in
disambiguating.

* jk/interpret-branch-name:
  checkout: restrict @-expansions when finding branch
  strbuf_check_ref_format(): expand only local branches
  branch: restrict @-expansions when deleting
  t3204: test git-branch @-expansion corner cases
  interpret_branch_name: allow callers to restrict expansions
  strbuf_branchname: add docstring
  strbuf_branchname: drop return value
  interpret_branch_name: move docstring to header file
  interpret_branch_name(): handle auto-namelen for @{-1}

3 years agoMerge branch 'ab/cond-skip-tests' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:21 +0000 (13:52 -0700)]
Merge branch 'ab/cond-skip-tests' into maint

A few tests were run conditionally under (rare) conditions where
they cannot be run (like running cvs tests under 'root' account).

* ab/cond-skip-tests:
  gitweb tests: skip tests when we don't have Time::HiRes
  gitweb tests: change confusing "skip_all" phrasing
  cvs tests: skip tests that call "cvs commit" when running as root

3 years agoMerge branch 'jk/ident-empty' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:21 +0000 (13:52 -0700)]
Merge branch 'jk/ident-empty' into maint

user.email that consists of only cruft chars should consistently
error out, but didn't.

* jk/ident-empty:
  ident: do not ignore empty config name/email
  ident: reject all-crud ident name
  ident: handle NULL email when complaining of empty name
  ident: mark error messages for translation

3 years agoMerge branch 'jk/delta-chain-limit' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:20 +0000 (13:52 -0700)]
Merge branch 'jk/delta-chain-limit' into maint

"git repack --depth=<n>" for a long time busted the specified depth
when reusing delta from existing packs.  This has been corrected.

* jk/delta-chain-limit:
  pack-objects: convert recursion to iteration in break_delta_chain()
  pack-objects: enforce --depth limit in reused deltas

3 years agoMerge branch 'sg/test-with-stdin' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:20 +0000 (13:52 -0700)]
Merge branch 'sg/test-with-stdin' into maint

Teach the "debug" helper used in the test framework that allows a
command to run under "gdb" to make the session interactive.

* sg/test-with-stdin:
  tests: make the 'test_pause' helper work in non-verbose mode
  tests: create an interactive gdb session with the 'debug' helper

3 years agoMerge branch 'jk/interop-test' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:20 +0000 (13:52 -0700)]
Merge branch 'jk/interop-test' into maint

Picking two versions of Git and running tests to make sure the
older one and the newer one interoperate happily has now become
possible.

* jk/interop-test:
  t/interop: add test of old clients against modern git-daemon
  t: add an interoperability test harness

3 years agoMerge branch 'jt/perf-updates' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:19 +0000 (13:52 -0700)]
Merge branch 'jt/perf-updates' into maint

The t/perf performance test suite was not prepared to test not so
old versions of Git, but now it covers versions of Git that are not
so ancient.

* jt/perf-updates:
  t/perf: add fallback for pre-bin-wrappers versions of git
  t/perf: use $MODERN_GIT for all repo-copying steps
  t/perf: export variable used in other blocks

3 years agoMerge branch 'rs/strbuf-add-real-path' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:19 +0000 (13:52 -0700)]
Merge branch 'rs/strbuf-add-real-path' into maint

An helper function to make it easier to append the result from
real_path() to a strbuf has been added.

* rs/strbuf-add-real-path:
  strbuf: add strbuf_add_real_path()
  cocci: use ALLOC_ARRAY

3 years agoMerge branch 'jk/parse-config-key-cleanup' into maint
Junio C Hamano [Tue, 28 Mar 2017 20:52:18 +0000 (13:52 -0700)]
Merge branch 'jk/parse-config-key-cleanup' into maint

The "parse_config_key()" API function has been cleaned up.

* jk/parse-config-key-cleanup:
  parse_hide_refs_config: tell parse_config_key we don't want a subsection
  parse_config_key: allow matching single-level config
  parse_config_key: use skip_prefix instead of starts_with
  refs: parse_hide_refs_config to use parse_config_key

3 years agobuiltin/receive-pack: fix incorrect pointer arithmetic
brian m. carlson [Sun, 26 Mar 2017 16:01:28 +0000 (16:01 +0000)]
builtin/receive-pack: fix incorrect pointer arithmetic

If we had already processed the last newline in a push certificate, we
would end up subtracting NULL from the end-of-certificate pointer when
computing the length of the line.  This would have resulted in an
absurdly large length, and possibly a buffer overflow.  Instead,
subtract the beginning-of-certificate pointer from the
end-of-certificate pointer, which is what's expected.

Note that this situation should never occur, since not only do we
require the certificate to be newline terminated, but the signature will
only be read from the beginning of a line.  Nevertheless, it seems
prudent to correct it.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agonotes: do not break note_tree structure in note_tree_consolidate()
Mike Hommey [Sun, 26 Mar 2017 01:52:12 +0000 (10:52 +0900)]
notes: do not break note_tree structure in note_tree_consolidate()

After a note is removed, note_tree_consolidate is called to eliminate
some useless nodes. The typical case is that if you had an int_node
with 2 PTR_TYPE_NOTEs in it, and remove one of them, then the
PTR_TYPE_INTERNAL pointer in the parent tree can be replaced with the
remaining PTR_TYPE_NOTE.

This works fine when PTR_TYPE_NOTEs are involved, but falls flat when
other types are involved.

To put things in more practical terms, let's say we start from an empty
notes tree, and add 3 notes:

- one for a sha1 that starts with 424
- one for a sha1 that starts with 428
- one for a sha1 that starts with 4c

To keep track of this, note_tree.root will have a PTR_TYPE_INTERNAL at
a[4], pointing to an int_node*.
In turn, that int_node* will have a PTR_TYPE_NOTE at a[0xc], pointing to
the leaf_node* with the key and value, and a PTR_TYPE_INTERNAL at a[2],
pointing to another int_node*.
That other int_node* will have 2 PTR_TYPE_NOTE, one at a[4] and the
other at a[8].

When looking for the note for the sha1 starting with 428, get_note() will
recurse through (simplified) root.a[4].a[2].a[8].

Now, if we remove the note for the sha1 that starts with 4c, we're left
with a int_node* with only one PTR_TYPE_INTERNAL entry in it. After
note_tree_consolidate runs, root.a[4] now points to what used to be
pointed at by root.a[4].a[2].

Which means looking up for the note for the sha1 starting with 428 now
fails because there is nothing at root.a[4].a[2] anymore: there is only
root.a[4].a[4] and root.a[4].a[8], which don't match the expected
structure for the lookup.

So if all there is left in an int_node* is a PTR_TYPE_INTERNAL pointer,
we can't safely remove it. I think the same applies for PTR_TYPE_SUBTREE
pointers. IOW, only PTR_TYPE_NOTEs are safe to be moved to the parent
int_node*.

This doesn't have a practical effect on git because all that happens
after a remove_note is a write_notes_tree, which just iterates the entire
note tree, but this affects anything using libgit.a that would try to do
lookups after removing notes.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosequencer: allow the commit-msg hooks to run during a `reword`
Johannes Schindelin [Thu, 23 Mar 2017 16:07:17 +0000 (17:07 +0100)]
sequencer: allow the commit-msg hooks to run during a `reword`

The `reword` command used to call `git commit` in a manner that asks for
the prepare-commit-msg and commit-msg hooks to do their thing.

Converting that part of the interactive rebase to C code introduced the
regression where those hooks were no longer run.

Let's fix this.

Note: the flag is called `VERIFY_MSG` instead of the more intuitive
`RUN_COMMIT_MSG_HOOKS` to indicate that the flag suppresses the
`--no-verify` flag (which may do other things in the future in addition
to suppressing the commit message hooks, too).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosequencer: make commit options more extensible
Johannes Schindelin [Thu, 23 Mar 2017 16:07:11 +0000 (17:07 +0100)]
sequencer: make commit options more extensible

So far every time we need to tweak the behaviour of run_git_commit()
we have been adding a "int" parameter to it.  As the function gains
parameters and different callsites having different needs, this is
becoming a maintenance burden.  When a new knob needs to be added to
address a specific need for a single callsite, all the other callsites
need to add a "no, I do not want anything special with respect to the
new knob" argument.

Consolidate the existing four parameters into a flag word to make it
more maintainable, as we will be adding a new one to the mix soon.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agol10n: de: translate describe debug terms
Michael J Gruber [Mon, 27 Mar 2017 16:50:06 +0000 (18:50 +0200)]
l10n: de: translate describe debug terms

Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodescribe: localize debug output fully
Michael J Gruber [Mon, 27 Mar 2017 16:50:05 +0000 (18:50 +0200)]
describe: localize debug output fully

git describe --debug localizes all debug messages but not the terms
head, lightweight, annotated that it outputs for the candidates.
Localize them, too.

Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoEighth batch for 2.13
Junio C Hamano [Mon, 27 Mar 2017 18:00:12 +0000 (11:00 -0700)]
Eighth batch for 2.13

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'km/config-grammofix'
Junio C Hamano [Mon, 27 Mar 2017 17:59:29 +0000 (10:59 -0700)]
Merge branch 'km/config-grammofix'

Doc update.

* km/config-grammofix:
  doc/config: grammar fixes for core.{editor,commentChar}

3 years agoMerge branch 'sb/t3600-rephrase'
Junio C Hamano [Mon, 27 Mar 2017 17:59:28 +0000 (10:59 -0700)]
Merge branch 'sb/t3600-rephrase'

A test retitling.

* sb/t3600-rephrase:
  t3600: rename test to describe its functionality

3 years agoMerge branch 'sb/describe-broken'
Junio C Hamano [Mon, 27 Mar 2017 17:59:27 +0000 (10:59 -0700)]
Merge branch 'sb/describe-broken'

"git describe --dirty" dies when it cannot be determined if the
state in the working tree matches that of HEAD (e.g. broken
repository or broken submodule).  The command learned a new option
"git describe --broken" to give "$name-broken" (where $name is the
description of HEAD) in such a case.

* sb/describe-broken:
  builtin/describe: introduce --broken flag

3 years agoMerge branch 'sb/push-options-via-transport'
Junio C Hamano [Mon, 27 Mar 2017 17:59:27 +0000 (10:59 -0700)]
Merge branch 'sb/push-options-via-transport'

Recently we started passing the "--push-options" through the
external remote helper interface; now the "smart HTTP" remote
helper understands what to do with the passed information.

* sb/push-options-via-transport:
  remote-curl: allow push options
  send-pack: send push options correctly in stateless-rpc case

3 years agoMerge branch 'km/t1400-modernization'
Junio C Hamano [Mon, 27 Mar 2017 17:59:26 +0000 (10:59 -0700)]
Merge branch 'km/t1400-modernization'

Code clean-up.

* km/t1400-modernization:
  t1400: use test_when_finished for cleanup
  t1400: remove a set of unused output files
  t1400: use test_path_is_* helpers
  t1400: set core.logAllRefUpdates in "logged by touch" tests
  t1400: rename test descriptions to be unique

3 years agoMerge branch 'jk/prefix-filename'
Junio C Hamano [Mon, 27 Mar 2017 17:59:26 +0000 (10:59 -0700)]
Merge branch 'jk/prefix-filename'

Code clean-up with minor bugfixes.

* jk/prefix-filename:
  bundle: use prefix_filename with bundle path
  prefix_filename: simplify windows #ifdef
  prefix_filename: return newly allocated string
  prefix_filename: drop length parameter
  prefix_filename: move docstring to header file
  hash-object: fix buffer reuse with --path in a subdirectory

3 years agoMerge branch 'jc/lint-runaway-here-doc'
Junio C Hamano [Mon, 27 Mar 2017 17:59:25 +0000 (10:59 -0700)]
Merge branch 'jc/lint-runaway-here-doc'

The test framework learned to detect unterminated here documents.

* jc/lint-runaway-here-doc:
  tests: lint for run-away here-doc

3 years agoMerge branch 'st/verify-tag'
Junio C Hamano [Mon, 27 Mar 2017 17:59:22 +0000 (10:59 -0700)]
Merge branch 'st/verify-tag'

A few unterminated here documents in tests were fixed, which in
turn revealed incorrect expectations the tests make. These tests
have been updated.

* st/verify-tag:
  t7004, t7030: fix here-doc syntax errors

3 years agoMerge branch 'sb/submodule-update-initial-runs-custom-script'
Junio C Hamano [Mon, 27 Mar 2017 17:59:21 +0000 (10:59 -0700)]
Merge branch 'sb/submodule-update-initial-runs-custom-script'

A test fix.

* sb/submodule-update-initial-runs-custom-script:
  t7406: correct test case for submodule-update initial population

3 years agoMerge branch 'jk/quote-env-path-list-component'
Junio C Hamano [Mon, 27 Mar 2017 17:59:21 +0000 (10:59 -0700)]
Merge branch 'jk/quote-env-path-list-component'

A test fix.

* jk/quote-env-path-list-component:
  t5615: fix a here-doc syntax error

3 years agorev-parse: match @{upstream}, @{u} and @{push} case-insensitively
Ævar Arnfjörð Bjarmason [Mon, 27 Mar 2017 11:16:55 +0000 (11:16 +0000)]
rev-parse: match @{upstream}, @{u} and @{push} case-insensitively

Change the revision parsing logic to match @{upstream}, @{u} & @{push}
case-insensitively.

Before this change supplying anything except the lower-case forms
emits an "unknown revision or path not in the working tree"
error. This change makes upper-case & mixed-case versions equivalent
to the lower-case versions.

The use-case for this is being able to hold the shift key down while
typing @{u} on certain keyboard layouts, which makes the sequence
easier to type, and reduces cases where git throws an error at the
user where it could do what he means instead.

These suffixes now join various other suffixes & special syntax
documented in gitrevisions(7) that matches case-insensitively. A table
showing the status of the various forms documented there before &
after this patch is shown below. The key for the table is:

 - CI  = Case Insensitive
 - CIP = Case Insensitive Possible (without ambiguities)
 - AG  = Accepts Garbage (.e.g. @{./.4.minutes./.})

Before this change:

    |----------------+-----+------+-----|
    | What?          | CI? | CIP? | AG? |
    |----------------+-----+------+-----|
    | @{<date>}      | Y   | Y    | Y   |
    | @{upstream}    | N   | Y    | N   |
    | @{push}        | N   | Y    | N   |
    |----------------+-----+------+-----|

After it:

    |----------------+-----+------+-----|
    | What?          | CI? | CIP? | AG? |
    |----------------+-----+------+-----|
    | @{<date>}      | Y   | Y    | Y   |
    | @{upstream}    | Y   | Y    | N   |
    | @{push}        | Y   | Y    | N   |
    |----------------+-----+------+-----|

The ^{<type>} suffix is not made case-insensitive, because other
places that take <type> like "cat-file -t <type>" do want them case
sensitively (after all we never declared that type names are case
insensitive). Allowing case-insensitive typename only with this syntax
will make the resulting Git as a whole inconsistent.

This change was independently authored to scratch a longtime itch, but
when I was about to submit it I discovered that a similar patch had
been submitted unsuccessfully before by Conrad Irwin in August 2011 as
"rev-parse: Allow @{U} as a synonym for
@{u}" (<1313287071-7851-1-git-send-email-conrad.irwin@gmail.com>).

The tests for this patch are more exhaustive than in the 2011
submission. The starting point for them was to first change the code
to only support upper-case versions of the existing words, seeing what
broke, and amending the breaking tests to check upper case & mixed
case as appropriate, and where not redundant to other similar
tests. The implementation itself is equivalent.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agostrbuf: support long paths w/o read rights in strbuf_getcwd() on FreeBSD
René Scharfe [Sun, 26 Mar 2017 13:43:50 +0000 (15:43 +0200)]
strbuf: support long paths w/o read rights in strbuf_getcwd() on FreeBSD

FreeBSD implements getcwd(3) as a syscall, but falls back to a version
based on readdir(3) if it fails for some reason.  The latter requires
permissions to read and execute path components, while the former does
not.  That means that if our buffer is too small and we're missing
rights we could get EACCES, but we may succeed with a bigger buffer.

Keep retrying if getcwd(3) indicates lack of permissions until our
buffer can fit PATH_MAX bytes, as that's the maximum supported by the
syscall on FreeBSD anyway.  This way we do what we can to be able to
benefit from the syscall, but we also won't loop forever if there is a
real permission issue.

This fixes a regression introduced with 7333ed17 (setup: convert
setup_git_directory_gently_1 et al. to strbuf, 2014-07-28) for paths
longer than 127 bytes with components that miss read or execute
permissions (e.g. 0711 on /home for privacy reasons); we used a fixed
PATH_MAX-sized buffer before.

Reported-by: Zenobiusz Kunegunda <zenobiusz.kunegunda@interia.pl>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agodoc/SubmittingPatches: show how to get a CLI commit summary
Ævar Arnfjörð Bjarmason [Tue, 21 Mar 2017 14:21:54 +0000 (14:21 +0000)]
doc/SubmittingPatches: show how to get a CLI commit summary

Amend the section which describes how to get a commit summary to show
how do to that with "git show", currently the documentation only shows
how to do that with gitk.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agot/README: clarify the test_have_prereq documentation
Ævar Arnfjörð Bjarmason [Wed, 22 Mar 2017 22:18:54 +0000 (22:18 +0000)]
t/README: clarify the test_have_prereq documentation

Clarify the test_have_prereq documentation so that it's clear in the
reader's mind when the text says "most common use of this directly"
what the answer to "as opposed to what?" is.

Usually this function isn't used in lieu of using the prerequisite
support built into test_expect_*, mention that explicitly.

This changes documentation that I added in commit
9a897893a7 ("t/README: Document the prereq functions, and 3-arg
test_*", 2010-07-02).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agosha1dc: avoid CPP macro collisions
Junio C Hamano [Sat, 25 Mar 2017 17:05:13 +0000 (10:05 -0700)]
sha1dc: avoid CPP macro collisions

In an early part of sha1dc/sha1.c, the code checks the endianness of
the target platform by inspecting common CPP macros defined on
big-endian boxes, and sets BIGENDIAN macro to 1.  If these common
CPP macros are not defined, the code declares that the target
platform is little endian and does nothing (most notably, it does
not #undef its BIGENDIAN macro).

The code that does so even has this comment

    Note that all MSFT platforms are little endian,
    so none of these will be defined under the MSC compiler.

and later, the defined-ness of the BIGENDIAN macro is used to switch
the implementation of sha1_load() macro.

One thing the code did not anticipate is that somebody might define
BIGENDIAN macro in some header it includes to 0 on a little-endian
target platform.  Because the auto-detection based on common macros
do not touch BIGENDIAN macro when it detects a little-endian target,
such a definition is still valid and then defined-ness test will say
"Ah, BIGENDIAN is defined" and takes the wrong sha1_load().

As this auto-detection logic pretends as if it owns the BIGENDIAN
macro by ignoring the setting that may come from the outside and by
not explicitly unsetting when it decides that it is working for a
little-endian target, solve this problem without breaking that
assumption.  Namely, we can rename BIGENDIAN this code uses to
something much less generic, i.e. SHA1DC_BIGENDIAN.  For extra
protection, undef the macro on a little-endian target.

It is possible to work it around by instead #undef BIGENDIAN in
the auto-detection code, but a macro (or include) that happens later
in the code can be implemented in terms of BIGENDIAN on Windows and
it is possible that the implementation gets upset when it sees the
CPP macro undef'ed (instead of set to 0).  Renaming the private macro
intended to be used only in this file to a less generic name relieves
us from having to worry about that kind of breakage.

Noticed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoSync with 2.12.2
Junio C Hamano [Fri, 24 Mar 2017 20:31:01 +0000 (13:31 -0700)]
Sync with 2.12.2

3 years agoSeventh batch for 2.13
Junio C Hamano [Fri, 24 Mar 2017 20:30:34 +0000 (13:30 -0700)]
Seventh batch for 2.13

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'jk/sha1dc'
Junio C Hamano [Fri, 24 Mar 2017 20:07:38 +0000 (13:07 -0700)]
Merge branch 'jk/sha1dc'

The "detect attempt to create collisions" variant of SHA-1
implementation by Marc Stevens (CWI) and Dan Shumow (Microsoft)
has been integrated and made the default.

* jk/sha1dc:
  Makefile: make DC_SHA1 the default
  t0013: add a basic sha1 collision detection test
  Makefile: add DC_SHA1 knob
  sha1dc: disable safe_hash feature
  sha1dc: adjust header includes for git
  sha1dc: add collision-detecting sha1 implementation

3 years agoMerge branch 'sg/test-with-stdin'
Junio C Hamano [Fri, 24 Mar 2017 20:07:38 +0000 (13:07 -0700)]
Merge branch 'sg/test-with-stdin'

Teach the "debug" helper used in the test framework that allows a
command to run under "gdb" to make the session interactive.

* sg/test-with-stdin:
  tests: make the 'test_pause' helper work in non-verbose mode
  tests: create an interactive gdb session with the 'debug' helper

3 years agoMerge branch 'rs/update-hook-optim'
Junio C Hamano [Fri, 24 Mar 2017 20:07:37 +0000 (13:07 -0700)]
Merge branch 'rs/update-hook-optim'

Code clean-up.

* rs/update-hook-optim:
  receive-pack: simplify run_update_post_hook()

3 years agoMerge branch 'rs/shortlog-cleanup'
Junio C Hamano [Fri, 24 Mar 2017 20:07:37 +0000 (13:07 -0700)]
Merge branch 'rs/shortlog-cleanup'

Code clean-up.

* rs/shortlog-cleanup:
  shortlog: don't set after_subject to an empty string

3 years agoMerge branch 'rs/path-name-safety-cleanup'
Junio C Hamano [Fri, 24 Mar 2017 20:07:36 +0000 (13:07 -0700)]
Merge branch 'rs/path-name-safety-cleanup'

Code clean-up.

* rs/path-name-safety-cleanup:
  revision: remove declaration of path_name()

3 years agoMerge branch 'rs/http-push-cleanup'
Junio C Hamano [Fri, 24 Mar 2017 20:07:35 +0000 (13:07 -0700)]
Merge branch 'rs/http-push-cleanup'

Code clean-up.

* rs/http-push-cleanup:
  http-push: don't check return value of lookup_unknown_object()

3 years agoMerge branch 'js/regexec-buf'
Junio C Hamano [Fri, 24 Mar 2017 20:07:35 +0000 (13:07 -0700)]
Merge branch 'js/regexec-buf'

Fix for potential segv introduced in v2.11.0 and later (also
v2.10.2).

* js/regexec-buf:
  pickaxe: fix segfault with '-S<...> --pickaxe-regex'

3 years agoMerge branch 'jk/execv-dashed-external'
Junio C Hamano [Fri, 24 Mar 2017 20:07:34 +0000 (13:07 -0700)]
Merge branch 'jk/execv-dashed-external'

Fix for NO_PTHREADS build.

* jk/execv-dashed-external:
  run-command: fix segfault when cleaning forked async process

3 years agoMerge branch 'dl/credential-cache-socket-in-xdg-cache'
Junio C Hamano [Fri, 24 Mar 2017 20:07:34 +0000 (13:07 -0700)]
Merge branch 'dl/credential-cache-socket-in-xdg-cache'

The default location "~/.git-credential-cache/socket" for the
socket used to communicate with the credential-cache daemon has
been moved to "~/.cache/git/credential/socket".

* dl/credential-cache-socket-in-xdg-cache:
  credential-cache: add tests for XDG functionality
  credential-cache: use XDG_CACHE_HOME for socket
  path.c: add xdg_cache_home

3 years agoGit 2.12.2 v2.12.2
Junio C Hamano [Fri, 24 Mar 2017 19:59:15 +0000 (12:59 -0700)]
Git 2.12.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoMerge branch 'ab/doc-no-option-notation-fix' into maint
Junio C Hamano [Fri, 24 Mar 2017 19:57:55 +0000 (12:57 -0700)]
Merge branch 'ab/doc-no-option-notation-fix' into maint

Doc fix.

* ab/doc-no-option-notation-fix:
  doc: change erroneous --[no]-whatever into --[no-]whatever

3 years agoMerge branch 'ab/push-default-doc-fix' into maint
Junio C Hamano [Fri, 24 Mar 2017 19:57:54 +0000 (12:57 -0700)]
Merge branch 'ab/push-default-doc-fix' into maint

Doc fix.

* ab/push-default-doc-fix:
  push: mention "push.default=tracking" in the documentation

3 years agoMerge branch 'nd/commit-hook-doc-fix' into maint
Junio C Hamano [Fri, 24 Mar 2017 19:57:54 +0000 (12:57 -0700)]
Merge branch 'nd/commit-hook-doc-fix' into maint

Doc fix.

* nd/commit-hook-doc-fix:
  git-commit.txt: list post-rewrite in HOOKS section

3 years agoMerge branch 'jc/config-case-cmdline-take-2' into maint
Junio C Hamano [Fri, 24 Mar 2017 19:57:54 +0000 (12:57 -0700)]
Merge branch 'jc/config-case-cmdline-take-2' into maint

The code to parse "git -c VAR=VAL cmd" and set configuration
variable for the duration of cmd had two small bugs, which have
been fixed.
This supersedes jc/config-case-cmdline topic that has been discarded.

* jc/config-case-cmdline-take-2:
  config: use git_config_parse_key() in git_config_parse_parameter()
  config: move a few helper functions up

3 years agoMerge branch 'jk/grep-no-index-fix' into maint
Junio C Hamano [Fri, 24 Mar 2017 19:57:53 +0000 (12:57 -0700)]
Merge branch 'jk/grep-no-index-fix' into maint

The code to parse the command line "git grep <patterns>... <rev>
[[--] <pathspec>...]" has been cleaned up, and a handful of bugs
have been fixed (e.g. we used to check "--" if it is a rev).

* jk/grep-no-index-fix:
  grep: treat revs the same for --untracked as for --no-index
  grep: do not diagnose misspelt revs with --no-index
  grep: avoid resolving revision names in --no-index case
  grep: fix "--" rev/pathspec disambiguation
  grep: re-order rev-parsing loop
  grep: do not unnecessarily query repo for "--"
  grep: move thread initialization a little lower

3 years agoMerge branch 'jn/remote-helpers-with-git-dir' into maint
Junio C Hamano [Fri, 24 Mar 2017 19:57:53 +0000 (12:57 -0700)]
Merge branch 'jn/remote-helpers-with-git-dir' into maint

"git ls-remote" and "git archive --remote" are designed to work
without being in a directory under Git's control.  However, recent
updates revealed that we randomly look into a directory called
.git/ without actually doing necessary set-up when working in a
repository.  Stop doing so.

* jn/remote-helpers-with-git-dir:
  remote helpers: avoid blind fall-back to ".git" when setting GIT_DIR
  remote: avoid reading $GIT_DIR config in non-repo

3 years agoMerge branch 'sb/submodule-config-parse-ignore-fix' into maint
Junio C Hamano [Fri, 24 Mar 2017 19:57:52 +0000 (12:57 -0700)]
Merge branch 'sb/submodule-config-parse-ignore-fix' into maint

Code to read submodule.<name>.ignore config did not state the
variable name correctly when giving an error message diagnosing
misconfiguration.

* sb/submodule-config-parse-ignore-fix:
  submodule-config: correct error reporting for invalid ignore value

3 years agoMerge branch 'jk/push-deadlock-regression-fix' into maint
Junio C Hamano [Fri, 24 Mar 2017 19:57:52 +0000 (12:57 -0700)]
Merge branch 'jk/push-deadlock-regression-fix' into maint

"git push" had a handful of codepaths that could lead to a deadlock
when unexpected error happened, which has been fixed.

* jk/push-deadlock-regression-fix:
  send-pack: report signal death of pack-objects
  send-pack: read "unpack" status even on pack-objects failure
  send-pack: improve unpack-status error messages
  send-pack: use skip_prefix for parsing unpack status
  send-pack: extract parsing of "unpack" response
  receive-pack: fix deadlock when we cannot create tmpdir

3 years agopack.h: define largest possible encoded object size
Jeff King [Fri, 24 Mar 2017 17:26:50 +0000 (13:26 -0400)]
pack.h: define largest possible encoded object size

Several callers use fixed buffers for storing the pack
object header, and they've picked 10 as a magic number. This
is reasonable, since it handles objects up to 2^67. But
let's give them a constant so it's clear that the number
isn't pulled out of thin air.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agoencode_in_pack_object_header: respect output buffer length
Jeff King [Fri, 24 Mar 2017 17:26:40 +0000 (13:26 -0400)]
encode_in_pack_object_header: respect output buffer length

The encode_in_pack_object_header() writes a variable-length
header to an output buffer, but it doesn't actually know
long the buffer is. At first glance, this looks like it
might be possible to overflow.

In practice, this is probably impossible. The smallest
buffer we use is 10 bytes, which would hold the header for
an object up to 2^67 bytes. Obviously we're not likely to
see such an object, but we might worry that an object could
lie about its size (causing us to overflow before we realize
it does not actually have that many bytes). But the argument
is passed as a uintmax_t. Even on systems that have __int128
available, uintmax_t is typically restricted to 64-bit by
the ABI.

So it's unlikely that a system exists where this could be
exploited. Still, it's easy enough to use a normal out/len
pair and make sure we don't write too far. That protects the
hypothetical 128-bit system, makes it harder for callers to
accidentally specify a too-small buffer, and makes the
resulting code easier to audit.

Note that the one caller in fast-import tried to catch such
a case, but did so _after_ the call (at which point we'd
have already overflowed!). This check can now go away.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofast-import: use xsnprintf for formatting headers
Jeff King [Fri, 24 Mar 2017 17:26:24 +0000 (13:26 -0400)]
fast-import: use xsnprintf for formatting headers

The stream_blob() function checks the return value of
snprintf and dies. This is more simply done with
xsnprintf (and matches the similar call in store_object).

The message the user would get is less specific, but since
the point is that this _shouldn't_ ever happen, that's OK.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agofast-import: use xsnprintf for writing sha1s
Jeff King [Fri, 24 Mar 2017 17:25:22 +0000 (13:25 -0400)]
fast-import: use xsnprintf for writing sha1s

When we have to write a sha1 with a newline, we do so by
copying both into a single buffer, so that we can issue a
single write() call.

We use snprintf but don't bother to check the output, since
we know it will fit. However, we should use xsnprintf() in
such a case so that we're notified if our assumption turns
out to be wrong (and to make it easier to audit for
unchecked snprintf calls).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 years agomailmap: use Michael J Gruber's new address
Michael J Gruber [Fri, 24 Mar 2017 14:01:36 +0000 (15:01 +0100)]
mailmap: use Michael J Gruber's new address

Map both old addresses to the new, hopefully more permanent one.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>