Commit graph

46631 commits

Author SHA1 Message Date
Jeff Hostetler 06b6d81b79 read-cache: speed up has_dir_name (part 1)
Teach has_dir_name() to see if the path of the new item
is greater than the last path in the index array before
attempting to search for it.

has_dir_name() is looking for file/directory collisions
in the index and has to consider each sub-directory
prefix in turn.  This can cause multiple binary searches
for each path.

During operations like checkout, merge_working_tree()
populates the new index in sorted order, so we expect
to be able to append in many cases.

This commit is part 1 of 2.  This commit handles the top
of has_dir_name() and the trivial optimization.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-04-19 20:33:01 -07:00
Jeff Hostetler e5494631ed read-cache: speed up add_index_entry during checkout
Teach add_index_entry_with_check() to see if the path
of the new item is greater than the last path in the
index array before attempting to search for it.

During checkout, merge_working_tree() populates the new
index in sorted order, so this change will save a binary
lookups per file.  This preserves the original behavior
but simply checks the last element before starting the
search.

This helps performance on very large repositories.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-04-19 20:33:01 -07:00
Jeff Hostetler 350d870143 p0006-read-tree-checkout: perf test to time read-tree
Created t/perf/repos/many-files.sh to generate large, but
artificial repositories.

Created t/perf/inflate-repo.sh to alter an EXISTING repo
to have a set of large commits.  This can be used to create
a branch with 1M+ files in repositories like git.git or
linux.git, but with more realistic content.  It does this
by making multiple copies of the entire worktree in a series
of sub-directories.

The branch name and ballast structure created by both scripts
match, so either script can be used to generate very large
test repositories for the following perf test.

Created t/perf/p0006-read-tree-checkout.sh to measure
performance on various read-tree, checkout, and update-index
operations.  This test can run using either normal repos or
ones from the above scripts.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-04-19 20:33:01 -07:00
Jeff Hostetler a6db3fbb6e read-cache: add strcmp_offset function
Add strcmp_offset() function to also return the offset of the
first change.

Add unit test and helper to verify.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-04-15 02:21:12 -07:00
Junio C Hamano cf11a67975 Eleventh batch for 2.13
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-04-11 00:27:05 -07:00
Junio C Hamano 71e38d40e9 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
2017-04-11 00:21:52 -07:00
Junio C Hamano 77a24b7dc4 Merge branch 'cc/untracked'
Code cleanup.

* cc/untracked:
  update-index: fix xgetcwd() related memory leak
2017-04-11 00:21:51 -07:00
Junio C Hamano d9758cf81c 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
2017-04-11 00:21:51 -07:00
Junio C Hamano d1d3d46146 Merge branch 'ab/ref-filter-no-contains'
"git tag/branch/for-each-ref" family of commands long allowed to
filter the refs by "--contains X" (show only the refs that are
descendants of X), "--merged X" (show only the refs that are
ancestors of X), "--no-merged X" (show only the refs that are not
ancestors of X).  One curious omission, "--no-contains X" (show
only the refs that are not descendants of X) has been added to
them.

* ab/ref-filter-no-contains:
  tag: add tests for --with and --without
  ref-filter: reflow recently changed branch/tag/for-each-ref docs
  ref-filter: add --no-contains option to tag/branch/for-each-ref
  tag: change --point-at to default to HEAD
  tag: implicitly supply --list given another list-like option
  tag: change misleading --list <pattern> documentation
  parse-options: add OPT_NONEG to the "contains" option
  tag: add more incompatibles mode tests
  for-each-ref: partly change <object> to <commit> in help
  tag tests: fix a typo in a test description
  tag: remove a TODO item from the test suite
  ref-filter: add test for --contains on a non-commit
  ref-filter: make combining --merged & --no-merged an error
  tag doc: reword --[no-]merged to talk about commits, not tips
  tag doc: split up the --[no-]merged documentation
  tag doc: move the description of --[no-]merged earlier
2017-04-11 00:21:50 -07:00
Junio C Hamano b14f27f917 Tenth batch for 2.13
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-30 14:14:32 -07:00
Junio C Hamano 876eb616d3 Merge branch 'jk/make-coccicheck-detect-errors'
Build fix.

* jk/make-coccicheck-detect-errors:
  Makefile: detect errors in running spatch
2017-03-30 14:07:19 -07:00
Junio C Hamano e711824c5e 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
2017-03-30 14:07:18 -07:00
Junio C Hamano cd49f9bfb8 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()
2017-03-30 14:07:17 -07:00
Junio C Hamano 4b945eea40 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
2017-03-30 14:07:17 -07:00
Junio C Hamano 3e8ff5e4f3 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
2017-03-30 14:07:17 -07:00
Junio C Hamano 42e1cc517b 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
2017-03-30 14:07:16 -07:00
Junio C Hamano e7cbfd98e3 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..."
2017-03-30 14:07:16 -07:00
Junio C Hamano de8a8ed155 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
2017-03-30 14:07:16 -07:00
Junio C Hamano 49a8fe8e96 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
2017-03-30 14:07:15 -07:00
Junio C Hamano 3736c92558 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
2017-03-30 14:07:15 -07:00
Junio C Hamano ccf680dea3 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
2017-03-30 14:07:15 -07:00
Junio C Hamano bf650608be 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()
2017-03-30 14:07:14 -07:00
Junio C Hamano a93dcb0a56 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
2017-03-30 14:07:14 -07:00
Junio C Hamano 7a09a61e66 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"
2017-03-30 14:07:13 -07:00
Junio C Hamano 1fdbfc443e 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
2017-03-30 14:07:13 -07:00
Christian Couder c105f563d1 update-index: fix xgetcwd() related memory leak
As xgetcwd() returns an allocated buffer, we should free this
buffer when we don't need it any more.

This was found by Coverity.

Reported-by: Jeff King <peff@peff.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-30 10:33:31 -07:00
Jeff King f5c2bc2b96 Makefile: detect errors in running spatch
The "make coccicheck" target runs spatch against each source
file. But it does so in a for loop, so "make" never sees the
exit code of spatch. Worse, it redirects stderr to a log
file, so the user has no indication of any failure. And then
to top it all off, because we touched the patch file's
mtime, make will refuse to repeat the command because it
think the target is up-to-date.

So for example:

  $ make coccicheck SPATCH=does-not-exist
      SPATCH contrib/coccinelle/free.cocci
      SPATCH contrib/coccinelle/qsort.cocci
      SPATCH contrib/coccinelle/xstrdup_or_null.cocci
      SPATCH contrib/coccinelle/swap.cocci
      SPATCH contrib/coccinelle/strbuf.cocci
      SPATCH contrib/coccinelle/object_id.cocci
      SPATCH contrib/coccinelle/array.cocci
  $ make coccicheck SPATCH=does-not-exist
  make: Nothing to be done for 'coccicheck'.

With this patch, you get:

  $ make coccicheck SPATCH=does-not-exist
       SPATCH contrib/coccinelle/free.cocci
  /bin/sh: 4: does-not-exist: not found
  Makefile:2338: recipe for target 'contrib/coccinelle/free.cocci.patch' failed
  make: *** [contrib/coccinelle/free.cocci.patch] Error 1

It also dumps the log on failure, so any errors from spatch
itself (like syntax errors in our .cocci files) will be seen
by the user.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-29 09:07:12 -07:00
Junio C Hamano e1104a5ee5 Ninth batch for 2.13
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-28 14:14:56 -07:00
Junio C Hamano e471fa3405 Sync with 'maint' 2017-03-28 14:14:24 -07:00
Junio C Hamano 62dc8b5fbc 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
2017-03-28 14:06:00 -07:00
Junio C Hamano 0330344e0f 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
2017-03-28 14:06:00 -07:00
Junio C Hamano 53a0f9f7ad 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
2017-03-28 14:05:59 -07:00
Junio C Hamano f494890292 Merge branch 'sg/skip-prefix-in-prettify-refname'
Code cleanup.

* sg/skip-prefix-in-prettify-refname:
  refs.c: use skip_prefix() in prettify_refname()
2017-03-28 14:05:59 -07:00
Junio C Hamano e779b0f070 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>`
2017-03-28 14:05:59 -07:00
Junio C Hamano 6a5ff7acb5 Merge branch 'jk/pager-in-use'
Code clean-up.

* jk/pager-in-use:
  pager_in_use: use git_env_bool()
2017-03-28 14:05:59 -07:00
Junio C Hamano a612436f14 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
2017-03-28 14:05:58 -07:00
Junio C Hamano e394fa01d6 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
2017-03-28 14:05:58 -07:00
Junio C Hamano ff8b7e63de 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
2017-03-28 14:05:57 -07:00
Junio C Hamano 49800c9407 Prepare for 2.12.3 2017-03-28 13:54:14 -07:00
Junio C Hamano 67476f59bc Merge branch 'km/config-grammofix' into maint
Doc update.

* km/config-grammofix:
  doc/config: grammar fixes for core.{editor,commentChar}
2017-03-28 13:52:29 -07:00
Junio C Hamano 88fb4aa23a Merge branch 'sb/t3600-rephrase' into maint
A test retitling.

* sb/t3600-rephrase:
  t3600: rename test to describe its functionality
2017-03-28 13:52:29 -07:00
Junio C Hamano 04b4f7d579 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
2017-03-28 13:52:29 -07:00
Junio C Hamano 27ee56f9db 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
2017-03-28 13:52:28 -07:00
Junio C Hamano fd7c41ec97 Merge branch 'rs/update-hook-optim' into maint
Code clean-up.

* rs/update-hook-optim:
  receive-pack: simplify run_update_post_hook()
2017-03-28 13:52:28 -07:00
Junio C Hamano fb0ab976c6 Merge branch 'rs/shortlog-cleanup' into maint
Code clean-up.

* rs/shortlog-cleanup:
  shortlog: don't set after_subject to an empty string
2017-03-28 13:52:28 -07:00
Junio C Hamano 1c91ec0b8e Merge branch 'rs/path-name-safety-cleanup' into maint
Code clean-up.

* rs/path-name-safety-cleanup:
  revision: remove declaration of path_name()
2017-03-28 13:52:27 -07:00
Junio C Hamano 310b94528c 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()
2017-03-28 13:52:26 -07:00
Junio C Hamano e3c551dd7b 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
2017-03-28 13:52:26 -07:00
Junio C Hamano ba5e05ffef 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
2017-03-28 13:52:25 -07:00
Junio C Hamano 8f71209d1e 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
2017-03-28 13:52:25 -07:00