Commit Graph

50443 Commits

Author SHA1 Message Date
Junio C Hamano
077cde91d2 Merge branch 'ag/userdiff-go-funcname'
"git diff" and friends learned funcname patterns for Go language
source files.

* ag/userdiff-go-funcname:
  userdiff: add built-in pattern for golang
2018-03-08 12:36:30 -08:00
Junio C Hamano
9bb8eb0c88 Merge branch 'ab/gc-auto-in-commit'
"git commit" used to run "gc --auto" near the end, which was lost
when the command was reimplemented in C by mistake.

* ab/gc-auto-in-commit:
  commit: run git gc --auto just before the post-commit hook
2018-03-08 12:36:30 -08:00
Junio C Hamano
cdda65acae Merge branch 'bp/untracked-cache-noflush'
Writing out the index file when the only thing that changed in it
is the untracked cache information is often wasteful, and this has
been optimized out.

* bp/untracked-cache-noflush:
  untracked cache: use git_env_bool() not getenv() for customization
  dir.c: don't flag the index as dirty for changes to the untracked cache
2018-03-08 12:36:30 -08:00
Junio C Hamano
74735c9ca7 Merge branch 'rs/perf-repeat-thrice-by-default'
Perf test regression fix.

* rs/perf-repeat-thrice-by-default:
  perf: use GIT_PERF_REPEAT_COUNT=3 by default even without config file
2018-03-08 12:36:29 -08:00
Junio C Hamano
cd3d56a962 Merge branch 'mk/doc-pretty-fill'
Docfix.

* mk/doc-pretty-fill:
  docs/pretty-formats: fix typo '% <(<N>)' -> '%<|(<N>)'
2018-03-08 12:36:29 -08:00
Junio C Hamano
a8d45dcfc0 Merge branch 'jc/test-must-be-empty'
Test framework tweak to catch developer thinko.

* jc/test-must-be-empty:
  test_must_be_empty: make sure the file exists, not just empty
2018-03-08 12:36:28 -08:00
Junio C Hamano
d5120daba4 Merge branch 'ds/mark-parents-uninteresting-optim'
Micro optimization in revision traversal code.

* ds/mark-parents-uninteresting-optim:
  revision.c: reduce object database queries
2018-03-08 12:36:27 -08:00
Junio C Hamano
7519a60ffa Merge branch 'ds/find-unique-abbrev-optim'
While finding unique object name abbreviation, the code may
accidentally have read beyond the end of the array of object names
in a pack.

* ds/find-unique-abbrev-optim:
  sha1_name: fix uninitialized memory errors
2018-03-08 12:36:26 -08:00
Junio C Hamano
65ebfec515 Merge branch 'sg/subtree-signed-commits'
"git subtree" script (in contrib/) scripted around "git log", whose
output got affected by end-user configuration like log.showsignature

* sg/subtree-signed-commits:
  subtree: fix add and pull for GPG-signed commits
2018-03-08 12:36:25 -08:00
Junio C Hamano
5fc4a7ed5d Merge branch 'rv/grep-cleanup'
Threaded "git grep" has been optimized to avoid allocation in code
section that is covered under a mutex.

* rv/grep-cleanup:
  grep: simplify grep_oid and grep_file
  grep: move grep_source_init outside critical section
2018-03-08 12:36:25 -08:00
Junio C Hamano
9e69a1484f Merge branch 'ot/ref-filter-cleanup'
Code cleanup.

* ot/ref-filter-cleanup:
  ref-filter: get rid of goto
  ref-filter: get rid of duplicate code
2018-03-08 12:36:24 -08:00
Junio C Hamano
4094e47fd2 Merge branch 'jh/status-no-ahead-behind'
"git status" can spend a lot of cycles to compute the relation
between the current branch and its upstream, which can now be
disabled with "--no-ahead-behind" option.

* jh/status-no-ahead-behind:
  status: support --no-ahead-behind in long format
  status: update short status to respect --no-ahead-behind
  status: add --[no-]ahead-behind to status and commit for V2 format.
  stat_tracking_info: return +1 when branches not equal
2018-03-08 12:36:24 -08:00
Junio C Hamano
c710d182ea Merge branch 'sg/travis-build-during-script-phase'
Build the executable in 'script' phase in Travis CI integration, to
follow the established practice, rather than during 'before_script'
phase.  This allows the CI categorize the failures better ('failed'
is project's fault, 'errored' is build environment's).

* sg/travis-build-during-script-phase:
  travis-ci: build Git during the 'script' phase
2018-03-08 12:36:23 -08:00
Junio C Hamano
c6284da4ff Seventh batch for 2.17
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-06 14:59:10 -08:00
Junio C Hamano
179e1f53b8 Merge branch 'bw/perl-timegm-timelocal-fix'
Y2k20 fix ;-) for our perl scripts.

* bw/perl-timegm-timelocal-fix:
  perl: call timegm and timelocal with 4-digit year
2018-03-06 14:54:08 -08:00
Junio C Hamano
6c3e6f6fcb Merge branch 'jk/strbuf-read-file-close-error'
Code clean-up.

* jk/strbuf-read-file-close-error:
  strbuf_read_file(): preserve errno across close() call
2018-03-06 14:54:08 -08:00
Junio C Hamano
169c9c0169 Merge branch 'bw/c-plus-plus'
Avoid using identifiers that clash with C++ keywords.  Even though
it is not a goal to compile Git with C++ compilers, changes like
this help use of code analysis tools that targets C++ on our
codebase.

* bw/c-plus-plus: (37 commits)
  replace: rename 'new' variables
  trailer: rename 'template' variables
  tempfile: rename 'template' variables
  wrapper: rename 'template' variables
  environment: rename 'namespace' variables
  diff: rename 'template' variables
  environment: rename 'template' variables
  init-db: rename 'template' variables
  unpack-trees: rename 'new' variables
  trailer: rename 'new' variables
  submodule: rename 'new' variables
  split-index: rename 'new' variables
  remote: rename 'new' variables
  ref-filter: rename 'new' variables
  read-cache: rename 'new' variables
  line-log: rename 'new' variables
  imap-send: rename 'new' variables
  http: rename 'new' variables
  entry: rename 'new' variables
  diffcore-delta: rename 'new' variables
  ...
2018-03-06 14:54:07 -08:00
Junio C Hamano
c14d5f99cd Merge branch 'rs/strbuf-read-file-or-whine'
Code clean-up.

* rs/strbuf-read-file-or-whine:
  sequencer: factor out strbuf_read_file_or_whine()
2018-03-06 14:54:07 -08:00
Junio C Hamano
327e524d66 Merge branch 'ms/non-ascii-ticks'
Doc markup fix.

* ms/non-ascii-ticks:
  Documentation/gitsubmodules.txt: avoid non-ASCII apostrophes
2018-03-06 14:54:06 -08:00
Junio C Hamano
148bce96e5 Merge branch 'jk/test-helper-v-output-fix'
Test framework update.

* jk/test-helper-v-output-fix:
  t: send verbose test-helper output to fd 4
2018-03-06 14:54:05 -08:00
Junio C Hamano
e33c3322b6 Merge branch 'jk/cached-commit-buffer'
Code clean-up.

* jk/cached-commit-buffer:
  revision: drop --show-all option
  commit: drop uses of get_cached_commit_buffer()
2018-03-06 14:54:05 -08:00
Junio C Hamano
96608043d9 Merge branch 'bw/doc-submodule-recurse-config-with-clone'
Doc update.

* bw/doc-submodule-recurse-config-with-clone:
  submodule: indicate that 'submodule.recurse' doesn't apply to clone
2018-03-06 14:54:05 -08:00
Junio C Hamano
f88590e675 Merge branch 'jc/allow-ff-merging-kept-tags'
Since Git 1.7.9, "git merge" defaulted to --no-ff (i.e. even when
the side branch being merged is a descendant of the current commit,
create a merge commit instead of fast-forwarding) when merging a
tag object.  This was appropriate default for integrators who pull
signed tags from their downstream contributors, but caused an
unnecessary merges when used by downstream contributors who
habitually "catch up" their topic branches with tagged releases
from the upstream.  Update "git merge" to default to --no-ff only
when merging a tag object that does *not* sit at its usual place in
refs/tags/ hierarchy, and allow fast-forwarding otherwise, to
mitigate the problem.

* jc/allow-ff-merging-kept-tags:
  merge: allow fast-forward when merging a tracked tag
2018-03-06 14:54:04 -08:00
Junio C Hamano
f655707194 Merge branch 'ab/simplify-perl-makefile'
Hotfix for a topic already in 'master'.

* ab/simplify-perl-makefile:
  Makefile: generate Git(3pm) as dependency of the 'doc' and 'man' targets
2018-03-06 14:54:04 -08:00
Junio C Hamano
60f8b89518 Merge branch 'pw/add-p-single'
"git add -p" used to offer "/" (look for a matching hunk) as a
choice, even there was only one hunk, which has been corrected.
Also the single-key help is now given only for keys that are
enabled (e.g. help for '/' won't be shown when there is only one
hunk).

* pw/add-p-single:
  add -p: improve error messages
  add -p: only bind search key if there's more than one hunk
  add -p: only display help for active keys
2018-03-06 14:54:03 -08:00
Junio C Hamano
44f2f3f919 Merge branch 'sg/t6300-modernize'
Test update.

* sg/t6300-modernize:
  t6300-for-each-ref: fix "more than one quoting style" tests
2018-03-06 14:54:03 -08:00
Junio C Hamano
f2fd27c6bf Merge branch 'sb/color-h-cleanup'
Devdoc update.

* sb/color-h-cleanup:
  color.h: document and modernize header
2018-03-06 14:54:03 -08:00
Junio C Hamano
9ca488c04b Merge branch 'nd/rebase-show-current-patch'
The new "--show-current-patch" option gives an end-user facing way
to get the diff being applied when "git rebase" (and "git am")
stops with a conflict.

* nd/rebase-show-current-patch:
  rebase: introduce and use pseudo-ref REBASE_HEAD
  rebase: add --show-current-patch
  am: add --show-current-patch
2018-03-06 14:54:02 -08:00
Junio C Hamano
2cd91ec197 Merge branch 'xz/send-email-batch-size'
"git send-email" learned to complain when the batch-size option is
not defined when the relogin-delay option is, since these two are
mutually required.

* xz/send-email-batch-size:
  send-email: error out when relogin delay is missing
2018-03-06 14:54:02 -08:00
Junio C Hamano
c1a7902f9a Merge branch 'ab/fetch-prune'
Clarify how configured fetch refspecs interact with the "--prune"
option of "git fetch", and also add a handy short-hand for getting
rid of stale tags that are locally held.

* ab/fetch-prune:
  fetch: make the --prune-tags work with <url>
  fetch: add a --prune-tags option and fetch.pruneTags config
  fetch tests: add scaffolding for the new fetch.pruneTags
  git-fetch & config doc: link to the new PRUNING section
  git remote doc: correct dangerous lies about what prune does
  git fetch doc: add a new section to explain the ins & outs of pruning
  fetch tests: fetch <url> <spec> as well as fetch [<remote>]
  fetch tests: expand case/esac for later change
  fetch tests: double quote a variable for interpolation
  fetch tests: test --prune and refspec interaction
  fetch tests: add a tag to be deleted to the pruning tests
  fetch tests: re-arrange arguments for future readability
  fetch tests: refactor in preparation for testing tag pruning
  remote: add a macro for "refs/tags/*:refs/tags/*"
  fetch: stop accessing "remote" variable indirectly
  fetch: trivially refactor assignment to ref_nr
  fetch: don't redundantly NULL something calloc() gave us
2018-03-06 14:54:01 -08:00
Junio C Hamano
a4ae2e5a1c Merge branch 'sm/mv-dry-run-update'
Code clean-up.

* sm/mv-dry-run-update:
  mv: remove unneeded 'if (!show_only)'
  t7001: add test case for --dry-run
2018-03-06 14:54:00 -08:00
Junio C Hamano
05d290e1db Merge branch 'nm/tag-edit'
"git tag" learned an explicit "--edit" option that allows the
message given via "-m" and "-F" to be further edited.

* nm/tag-edit:
  tag: add --edit option
2018-03-06 14:53:59 -08:00
Alban Gruin
1dbf0c0ad6 userdiff: add built-in pattern for golang
This adds xfuncname and word_regex patterns for golang, a quite
popular programming language. It also includes test cases for the
xfuncname regex (t4018) and updated documentation.

The xfuncname regex finds functions, structs and interfaces.  Although
the Go language prohibits the opening brace from being on its own
line, the regex does not makes it mandatory, to be able to match
`func` statements like this:

    func foo(bar int,
    	baz int) {
    }

This is covered by the test case t4018/golang-long-func.

The word_regex pattern finds identifiers, integers, floats, complex
numbers and operators, according to the go specification.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-01 13:36:49 -08:00
Ævar Arnfjörð Bjarmason
095c741edd commit: run git gc --auto just before the post-commit hook
Change the behavior of git-commit back to what it was back in
d4bb43ee27 ("Invoke "git gc --auto" from commit, merge, am and
rebase.", 2007-09-05) when it was git-commit.sh.

Shortly afterwards in f5bbc3225c ("Port git commit to C.", 2007-11-08)
when it was ported to C, the "git gc --auto" invocation went away.

Since that unintended regression, git gc --auto only ran for git-am,
git-merge, git-fetch, and git-receive-pack.  It was possible to
write a script that would "git commit" a lot of data locally, and gc
would never run.

One such repository that was locally committing generated zone file
changes had grown to a size of ~60GB before a daily cronjob was added
to "git gc", bringing it down to less than 1GB. This will make such
cases work without intervention.

I think fixing such pathological cases where the repository will grow
forever is a worthwhile trade-off for spending a couple of
milliseconds calling "git gc --auto" (in the common cases where it
doesn't do anything).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-01 11:34:06 -08:00
Junio C Hamano
7e31236f65 Sixth batch for 2.17
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-28 13:39:24 -08:00
Junio C Hamano
69917e6439 Merge branch 'jk/push-options-via-transport-fix'
"git push" over http transport did not unquote the push-options
correctly.

* jk/push-options-via-transport-fix:
  remote-curl: unquote incoming push-options
  t5545: factor out http repository setup
2018-02-28 13:37:58 -08:00
Junio C Hamano
0996727879 Merge branch 'tz/do-not-clean-spec-file'
We no longer create any *.spec file, so "make clean" should not
remove it.

* tz/do-not-clean-spec-file:
  Makefile: remove *.spec from clean target
2018-02-28 13:37:58 -08:00
Junio C Hamano
2c20dc16ec Merge branch 'tg/worktree-create-tracking'
Hotfix for a recent topic.

* tg/worktree-create-tracking:
  git-worktree.txt: fix indentation of example and text of 'add' command
  git-worktree.txt: fix missing ")" typo
2018-02-28 13:37:57 -08:00
Junio C Hamano
ba5f3fc467 Merge branch 'gs/test-unset-xdg-cache-home'
Test update.

* gs/test-unset-xdg-cache-home:
  test-lib.sh: unset XDG_CACHE_HOME
2018-02-28 13:37:56 -08:00
Junio C Hamano
177bd65cf8 Merge branch 'tk/apply-dev-null-verify-name-fix'
Many places in "git apply" knew that "/dev/null" that signals
"there is no such file on this side of the diff" can be followed by
whitespace and garbage when parsing a patch, except for one, which
made an otherwise valid patch (e.g. ones from subversion) rejected.

* tk/apply-dev-null-verify-name-fix:
  apply: handle Subversion diffs with /dev/null gracefully
  apply: demonstrate a problem applying svn diffs
2018-02-28 13:37:55 -08:00
Junio C Hamano
7676b86ec2 Merge branch 'sb/status-doc-fix'
Docfix.

* sb/status-doc-fix:
  Documentation/git-status: clarify status table for porcelain mode
2018-02-28 13:37:54 -08:00
Junio C Hamano
619e5218cb Merge branch 'es/worktree-add-post-checkout-hook'
"git worktree add" learned to run the post-checkout hook, just like
"git clone" runs it upon the initial checkout.

* es/worktree-add-post-checkout-hook:
  worktree: add: fix 'post-checkout' not knowing new worktree location
2018-02-28 13:37:53 -08:00
Junio C Hamano
c22c624a9d Merge branch 'nd/am-quit'
"git am" has learned the "--quit" option, in addition to the existing
"--abort" option; having the pair mirrors a few other commands like
"rebase" and "cherry-pick".

* nd/am-quit:
  am: support --quit
2018-02-28 13:37:52 -08:00
Junio C Hamano
026336cb27 untracked cache: use git_env_bool() not getenv() for customization
GIT_DISABLE_UNTRACKED_CACHE and GIT_TEST_UNTRACKED_CACHE are only
sensed for their presense by using getenv(); use git_env_bool()
instead so that GIT_DISABLE_UNTRACKED_CACHE=false would work as
naïvely expected.

Also rename GIT_TEST_UNTRACKED_CACHE to GIT_FORCE_UNTRACKED_CACHE
to express what it does more honestly.  Forcing its use may be one
useful thing to do while testing the feature, but testing does not
have to be the only use of the knob.

While at it, avoid repeated calls to git_env_bool() by capturing the
return value from the first call in a static variable.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-28 13:27:10 -08:00
Derrick Stolee
ebbed3ba04 revision.c: reduce object database queries
In mark_parents_uninteresting(), we check for the existence of an
object file to see if we should treat a commit as parsed. The result
is to set the "parsed" bit on the commit.

Modify the condition to only check has_object_file() if the result
would change the parsed bit.

When a local branch is different from its upstream ref, "git status"
will compute ahead/behind counts. This uses paint_down_to_common()
and hits mark_parents_uninteresting(). On a copy of the Linux repo
with a local instance of "master" behind the remote branch
"origin/master" by ~60,000 commits, we find the performance of
"git status" went from 1.42 seconds to 1.32 seconds, for a relative
difference of -7.0%.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-27 15:04:52 -08:00
René Scharfe
53ba2c799a perf: use GIT_PERF_REPEAT_COUNT=3 by default even without config file
9ba95ed23c (perf/run: update get_var_from_env_or_config() for
subsections) stopped setting a default value for GIT_PERF_REPEAT_COUNT
if no perf config file is present, because get_var_from_env_or_config
returns early in that case.

Fix it by setting the default value after calling this function.  Its
fifth parameter is not used for any other variable, so remove the
associated code.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-27 15:01:04 -08:00
Derrick Stolee
21abed500c sha1_name: fix uninitialized memory errors
During abbreviation checks, we navigate to the position within a
pack-index that an OID would be inserted and check surrounding OIDs
for the maximum matching prefix. This position may be beyond the
last position, because the given OID is lexicographically larger
than every OID in the pack. Then nth_packed_object_oid() does not
initialize "oid".

Use the return value of nth_packed_object_oid() to prevent these
errors.

Also the comment about checking near-by objects miscounts the
neighbours.  If we have a hit at "first", we check "first-1" and
"first+1" to make sure we have sufficiently long abbreviation not to
match either.  If we do not have a hit, "first" is the smallest
among the objects that are larger than what we want to name, so we
check that and "first-1" to make sure we have sufficiently long
abbreviation not to match either.  In either case, we only check up
to two near-by objects.

Reported-by: Christian Couder <christian.couder@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-27 14:27:16 -08:00
Mårten Kongstad
768b9d6db7 docs/pretty-formats: fix typo '% <(<N>)' -> '%<|(<N>)'
Remove erroneous space between % and < in '% <(<N>)'.

Signed-off-by: Mårten Kongstad <marten.kongstad@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-27 14:13:55 -08:00
Junio C Hamano
11395a3b4b test_must_be_empty: make sure the file exists, not just empty
The helper function test_must_be_empty is meant to make sure the
given file is empty, but its implementation is:

	if test -s "$1"
	then
		... not empty, we detected a failure ...
	fi

Surely, the file having non-zero size is a sign that the condition
"the file must be empty" is violated, but it misses the case where
the file does not even exist.  It is an accident waiting to happen
with a buggy test like this:

	git frotz 2>error-message &&
	test_must_be_empty errro-message

that won't get caught until you deliberately break 'git frotz' and
notice why the test does not fail.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-27 13:58:43 -08:00
Junio C Hamano
2fc74f41c5 Fifth batch for 2.17
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-27 10:53:41 -08:00