gitweb.git
ref-filter: convert grab_objectname to struct object_idbrian m. carlson Mon, 12 Mar 2018 02:27:27 +0000 (02:27 +0000)

ref-filter: convert grab_objectname to struct object_id

This is necessary in order to convert find_unique_abbrev.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tree: convert read_tree_recursive to struct object_idbrian m. carlson Mon, 12 Mar 2018 02:27:26 +0000 (02:27 +0000)

tree: convert read_tree_recursive to struct object_id

Convert the callback functions for read_tree_recursive to take a pointer
to struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

resolve-undo: convert struct resolve_undo_info to object_idbrian m. carlson Mon, 12 Mar 2018 02:27:25 +0000 (02:27 +0000)

resolve-undo: convert struct resolve_undo_info to object_id

Convert the sha1 member of this struct to be an array of struct
object_id instead. This change is needed to convert find_unique_abbrev.

Convert some instances of hard-coded constants to use the_hash_algo as
well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cache-tree: convert remnants to struct object_idbrian m. carlson Mon, 12 Mar 2018 02:27:24 +0000 (02:27 +0000)

cache-tree: convert remnants to struct object_id

Convert the remaining portions of cache-tree.c to use struct object_id.
Convert several instances of 20 to use the_hash_algo instead.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cache-tree: convert write_*_as_tree to object_idbrian m. carlson Mon, 12 Mar 2018 02:27:23 +0000 (02:27 +0000)

cache-tree: convert write_*_as_tree to object_id

Convert write_index_as_tree and write_cache_as_tree to use struct
object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/write-tree: convert to struct object_idbrian m. carlson Mon, 12 Mar 2018 02:27:22 +0000 (02:27 +0000)

builtin/write-tree: convert to struct object_id

This is needed to convert parts of the cache-tree code.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bulk-checkin: convert index_bulk_checkin to struct... brian m. carlson Mon, 12 Mar 2018 02:27:21 +0000 (02:27 +0000)

bulk-checkin: convert index_bulk_checkin to struct object_id

Convert the index_bulk_checkin function, and the static functions it
calls, to use pointers to struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Eighth batch for 2.17Junio C Hamano Thu, 8 Mar 2018 20:42:06 +0000 (12:42 -0800)

Eighth batch for 2.17

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ag/userdiff-go-funcname'Junio C Hamano Thu, 8 Mar 2018 20:36:30 +0000 (12:36 -0800)

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

Merge branch 'ab/gc-auto-in-commit'Junio C Hamano Thu, 8 Mar 2018 20:36:30 +0000 (12:36 -0800)

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

Merge branch 'bp/untracked-cache-noflush'Junio C Hamano Thu, 8 Mar 2018 20:36:30 +0000 (12:36 -0800)

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

Merge branch 'rs/perf-repeat-thrice-by-default'Junio C Hamano Thu, 8 Mar 2018 20:36:29 +0000 (12:36 -0800)

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

Merge branch 'mk/doc-pretty-fill'Junio C Hamano Thu, 8 Mar 2018 20:36:29 +0000 (12:36 -0800)

Merge branch 'mk/doc-pretty-fill'

Docfix.

* mk/doc-pretty-fill:
docs/pretty-formats: fix typo '% <(<N>)' -> '%<|(<N>)'

Merge branch 'jc/test-must-be-empty'Junio C Hamano Thu, 8 Mar 2018 20:36:27 +0000 (12:36 -0800)

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

Merge branch 'ds/mark-parents-uninteresting-optim'Junio C Hamano Thu, 8 Mar 2018 20:36:27 +0000 (12:36 -0800)

Merge branch 'ds/mark-parents-uninteresting-optim'

Micro optimization in revision traversal code.

* ds/mark-parents-uninteresting-optim:
revision.c: reduce object database queries

Merge branch 'ds/find-unique-abbrev-optim'Junio C Hamano Thu, 8 Mar 2018 20:36:26 +0000 (12:36 -0800)

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

Merge branch 'sg/subtree-signed-commits'Junio C Hamano Thu, 8 Mar 2018 20:36:25 +0000 (12:36 -0800)

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

Merge branch 'rv/grep-cleanup'Junio C Hamano Thu, 8 Mar 2018 20:36:25 +0000 (12:36 -0800)

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

Merge branch 'ot/ref-filter-cleanup'Junio C Hamano Thu, 8 Mar 2018 20:36:24 +0000 (12:36 -0800)

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

Merge branch 'jh/status-no-ahead-behind'Junio C Hamano Thu, 8 Mar 2018 20:36:24 +0000 (12:36 -0800)

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

Merge branch 'sg/travis-build-during-script-phase'Junio C Hamano Thu, 8 Mar 2018 20:36:23 +0000 (12:36 -0800)

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

Seventh batch for 2.17Junio C Hamano Tue, 6 Mar 2018 22:59:10 +0000 (14:59 -0800)

Seventh batch for 2.17

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'bw/perl-timegm-timelocal-fix'Junio C Hamano Tue, 6 Mar 2018 22:54:08 +0000 (14:54 -0800)

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

Merge branch 'jk/strbuf-read-file-close-error'Junio C Hamano Tue, 6 Mar 2018 22:54:08 +0000 (14:54 -0800)

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

Merge branch 'bw/c-plus-plus'Junio C Hamano Tue, 6 Mar 2018 22:54:07 +0000 (14:54 -0800)

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
...

Merge branch 'rs/strbuf-read-file-or-whine'Junio C Hamano Tue, 6 Mar 2018 22:54:07 +0000 (14:54 -0800)

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()

Merge branch 'ms/non-ascii-ticks'Junio C Hamano Tue, 6 Mar 2018 22:54:06 +0000 (14:54 -0800)

Merge branch 'ms/non-ascii-ticks'

Doc markup fix.

* ms/non-ascii-ticks:
Documentation/gitsubmodules.txt: avoid non-ASCII apostrophes

Merge branch 'jk/test-helper-v-output-fix'Junio C Hamano Tue, 6 Mar 2018 22:54:05 +0000 (14:54 -0800)

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

Merge branch 'jk/cached-commit-buffer'Junio C Hamano Tue, 6 Mar 2018 22:54:05 +0000 (14:54 -0800)

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()

Merge branch 'bw/doc-submodule-recurse-config-with... Junio C Hamano Tue, 6 Mar 2018 22:54:05 +0000 (14:54 -0800)

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

Merge branch 'jc/allow-ff-merging-kept-tags'Junio C Hamano Tue, 6 Mar 2018 22:54:04 +0000 (14:54 -0800)

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

Merge branch 'ab/simplify-perl-makefile'Junio C Hamano Tue, 6 Mar 2018 22:54:04 +0000 (14:54 -0800)

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

Merge branch 'pw/add-p-single'Junio C Hamano Tue, 6 Mar 2018 22:54:03 +0000 (14:54 -0800)

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

Merge branch 'sg/t6300-modernize'Junio C Hamano Tue, 6 Mar 2018 22:54:03 +0000 (14:54 -0800)

Merge branch 'sg/t6300-modernize'

Test update.

* sg/t6300-modernize:
t6300-for-each-ref: fix "more than one quoting style" tests

Merge branch 'sb/color-h-cleanup'Junio C Hamano Tue, 6 Mar 2018 22:54:02 +0000 (14:54 -0800)

Merge branch 'sb/color-h-cleanup'

Devdoc update.

* sb/color-h-cleanup:
color.h: document and modernize header

Merge branch 'nd/rebase-show-current-patch'Junio C Hamano Tue, 6 Mar 2018 22:54:02 +0000 (14:54 -0800)

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

Merge branch 'xz/send-email-batch-size'Junio C Hamano Tue, 6 Mar 2018 22:54:02 +0000 (14:54 -0800)

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

Merge branch 'ab/fetch-prune'Junio C Hamano Tue, 6 Mar 2018 22:54:01 +0000 (14:54 -0800)

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

Merge branch 'sm/mv-dry-run-update'Junio C Hamano Tue, 6 Mar 2018 22:54:00 +0000 (14:54 -0800)

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

Merge branch 'nm/tag-edit'Junio C Hamano Tue, 6 Mar 2018 22:53:59 +0000 (14:53 -0800)

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

userdiff: add built-in pattern for golangAlban Gruin Thu, 1 Mar 2018 11:19:07 +0000 (12:19 +0100)

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>

commit: run git gc --auto just before the post-commit... Ævar Arnfjörð Bjarmason Wed, 28 Feb 2018 23:04:25 +0000 (23:04 +0000)

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>

Sixth batch for 2.17Junio C Hamano Wed, 28 Feb 2018 21:39:24 +0000 (13:39 -0800)

Sixth batch for 2.17

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jk/push-options-via-transport-fix'Junio C Hamano Wed, 28 Feb 2018 21:37:58 +0000 (13:37 -0800)

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

Merge branch 'tz/do-not-clean-spec-file'Junio C Hamano Wed, 28 Feb 2018 21:37:58 +0000 (13:37 -0800)

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

Merge branch 'tg/worktree-create-tracking'Junio C Hamano Wed, 28 Feb 2018 21:37:56 +0000 (13:37 -0800)

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

Merge branch 'gs/test-unset-xdg-cache-home'Junio C Hamano Wed, 28 Feb 2018 21:37:56 +0000 (13:37 -0800)

Merge branch 'gs/test-unset-xdg-cache-home'

Test update.

* gs/test-unset-xdg-cache-home:
test-lib.sh: unset XDG_CACHE_HOME

Merge branch 'tk/apply-dev-null-verify-name-fix'Junio C Hamano Wed, 28 Feb 2018 21:37:55 +0000 (13:37 -0800)

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

Merge branch 'sb/status-doc-fix'Junio C Hamano Wed, 28 Feb 2018 21:37:54 +0000 (13:37 -0800)

Merge branch 'sb/status-doc-fix'

Docfix.

* sb/status-doc-fix:
Documentation/git-status: clarify status table for porcelain mode

Merge branch 'es/worktree-add-post-checkout-hook'Junio C Hamano Wed, 28 Feb 2018 21:37:53 +0000 (13:37 -0800)

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

Merge branch 'nd/am-quit'Junio C Hamano Wed, 28 Feb 2018 21:37:52 +0000 (13:37 -0800)

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

untracked cache: use git_env_bool() not getenv() for... Junio C Hamano Wed, 28 Feb 2018 21:21:09 +0000 (13:21 -0800)

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>

revision.c: reduce object database queriesDerrick Stolee Sun, 25 Feb 2018 01:34:56 +0000 (20:34 -0500)

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>

perf: use GIT_PERF_REPEAT_COUNT=3 by default even witho... René Scharfe Sun, 25 Feb 2018 13:18:05 +0000 (14:18 +0100)

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>

sha1_name: fix uninitialized memory errorsDerrick Stolee Tue, 27 Feb 2018 11:47:04 +0000 (06:47 -0500)

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>

docs/pretty-formats: fix typo '% <(<N>)' -> '%<|(<N>)'Mårten Kongstad Tue, 27 Feb 2018 20:17:44 +0000 (21:17 +0100)

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>

test_must_be_empty: make sure the file exists, not... Junio C Hamano Tue, 27 Feb 2018 21:27:29 +0000 (13:27 -0800)

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>

Fifth batch for 2.17Junio C Hamano Tue, 27 Feb 2018 18:35:18 +0000 (10:35 -0800)

Fifth batch for 2.17

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Tue, 27 Feb 2018 18:53:19 +0000 (10:53 -0800)

Sync with maint

Merge branch 'ys/bisect-object-id-missing-conversion... Junio C Hamano Tue, 27 Feb 2018 18:43:55 +0000 (10:43 -0800)

Merge branch 'ys/bisect-object-id-missing-conversion-fix' into maint

Fix for a commented-out code to adjust it to a rather old API change.

* ys/bisect-object-id-missing-conversion-fix:
bisect: debug: convert struct object to object_id

Merge branch 'sb/submodule-update-reset-fix' into maintJunio C Hamano Tue, 27 Feb 2018 18:43:54 +0000 (10:43 -0800)

Merge branch 'sb/submodule-update-reset-fix' into maint

When resetting the working tree files recursively, the working tree
of submodules are now also reset to match.

* sb/submodule-update-reset-fix:
submodule: submodule_move_head omits old argument in forced case
unpack-trees: oneway_merge to update submodules
t/lib-submodule-update.sh: fix test ignoring ignored files in submodules
t/lib-submodule-update.sh: clarify test

Merge branch 'ab/commit-m-with-fixup' into maintJunio C Hamano Tue, 27 Feb 2018 18:43:54 +0000 (10:43 -0800)

Merge branch 'ab/commit-m-with-fixup' into maint

"git commit --fixup" did not allow "-m<message>" option to be used
at the same time; allow it to annotate resulting commit with more
text.

* ab/commit-m-with-fixup:
commit: add support for --fixup <commit> -m"<extra message>"
commit doc: document that -c, -C, -F and --fixup with -m error

Merge branch 'nd/ita-wt-renames-in-status' into maintJunio C Hamano Tue, 27 Feb 2018 18:39:34 +0000 (10:39 -0800)

Merge branch 'nd/ita-wt-renames-in-status' into maint

"git status" after moving a path in the working tree (hence making
it appear "removed") and then adding with the -N option (hence
making that appear "added") detected it as a rename, but did not
report the old and new pathnames correctly.

* nd/ita-wt-renames-in-status:
wt-status.c: handle worktree renames
wt-status.c: rename rename-related fields in wt_status_change_data
wt-status.c: catch unhandled diff status codes
wt-status.c: coding style fix
Use DIFF_DETECT_RENAME for detect_rename assignments
t2203: test status output with porcelain v2 format

Merge branch 'jt/binsearch-with-fanout'Junio C Hamano Tue, 27 Feb 2018 18:34:03 +0000 (10:34 -0800)

Merge branch 'jt/binsearch-with-fanout'

Refactor the code to binary search starting from a fan-out table
(which is how the packfile is indexed with object names) into a
reusable helper.

* jt/binsearch-with-fanout:
packfile: refactor hash search with fanout table
packfile: remove GIT_DEBUG_LOOKUP log statements

Merge branch 'rd/typofix'Junio C Hamano Tue, 27 Feb 2018 18:34:03 +0000 (10:34 -0800)

Merge branch 'rd/typofix'

Typofix.

* rd/typofix:
Correct mispellings of ".gitmodule" to ".gitmodules"
t/: correct obvious typo "detahced"

Merge branch 'jk/test-hashmap-updates'Junio C Hamano Tue, 27 Feb 2018 18:34:02 +0000 (10:34 -0800)

Merge branch 'jk/test-hashmap-updates'

Code clean-up.

* jk/test-hashmap-updates:
test-hashmap: use "unsigned int" for hash storage
test-hashmap: simplify alloc_test_entry
test-hashmap: use strbuf_getline rather than fgets
test-hashmap: use xsnprintf rather than snprintf
test-hashmap: check allocation computation for overflow
test-hashmap: use ALLOC_ARRAY rather than bare malloc

Merge branch 'jk/sq-dequote-on-bogus-input'Junio C Hamano Tue, 27 Feb 2018 18:34:02 +0000 (10:34 -0800)

Merge branch 'jk/sq-dequote-on-bogus-input'

Code to unquote single-quoted string (used in the parser for
configuration files, etc.) did not diagnose bogus input correctly
and produced bogus results instead.

* jk/sq-dequote-on-bogus-input:
sq_dequote: fix extra consumption of source string

Merge branch 'bp/fsmonitor'Junio C Hamano Tue, 27 Feb 2018 18:34:01 +0000 (10:34 -0800)

Merge branch 'bp/fsmonitor'

Doc update for a recently added feature.

* bp/fsmonitor:
fsmonitor: update documentation to remove reference to invalid config settings

Merge branch 'bc/doc-interpret-trailers-grammofix'Junio C Hamano Tue, 27 Feb 2018 18:34:00 +0000 (10:34 -0800)

Merge branch 'bc/doc-interpret-trailers-grammofix'

Docfix.

* bc/doc-interpret-trailers-grammofix:
docs/interpret-trailers: fix agreement error

Merge branch 'as/ll-i18n'Junio C Hamano Tue, 27 Feb 2018 18:33:58 +0000 (10:33 -0800)

Merge branch 'as/ll-i18n'

Some messages in low level start-up codepath have been i18n-ized.

* as/ll-i18n:
Mark messages for translations

Merge branch 'sg/doc-test-must-fail-args'Junio C Hamano Tue, 27 Feb 2018 18:33:58 +0000 (10:33 -0800)

Merge branch 'sg/doc-test-must-fail-args'

Devdoc update.

* sg/doc-test-must-fail-args:
t: document 'test_must_fail ok=<signal-name>'

Merge branch 'sb/describe-blob'Junio C Hamano Tue, 27 Feb 2018 18:33:57 +0000 (10:33 -0800)

Merge branch 'sb/describe-blob'

"git describe $garbage" stopped giving any errors when the garbage
happens to be a string with 40 hexadecimal letters.

* sb/describe-blob:
describe: confirm that blobs actually exist

Merge branch 'rs/check-ignore-multi'Junio C Hamano Tue, 27 Feb 2018 18:33:56 +0000 (10:33 -0800)

Merge branch 'rs/check-ignore-multi'

"git check-ignore" with multiple paths got confused when one is a
file and the other is a directory, which has been fixed.

* rs/check-ignore-multi:
check-ignore: fix mix of directories and other file types

Merge branch 'rj/sparse-updates'Junio C Hamano Tue, 27 Feb 2018 18:33:55 +0000 (10:33 -0800)

Merge branch 'rj/sparse-updates'

Devtool update.

* rj/sparse-updates:
Makefile: suppress a sparse warning for pack-revindex.c
config.mak.uname: remove SPARSE_FLAGS setting for cygwin

Merge branch 'jk/t0002-simplify'Junio C Hamano Tue, 27 Feb 2018 18:33:55 +0000 (10:33 -0800)

Merge branch 'jk/t0002-simplify'

Code cleanup.

* jk/t0002-simplify:
t0002: simplify error checking

Merge branch 'js/packet-read-line-check-null'Junio C Hamano Tue, 27 Feb 2018 18:33:54 +0000 (10:33 -0800)

Merge branch 'js/packet-read-line-check-null'

Some low level protocol codepath could crash when they get an
unexpected flush packet, which is now fixed.

* js/packet-read-line-check-null:
always check for NULL return from packet_read_line()
correct error messages for NULL packet_read_line()

Merge branch 'js/fix-merge-arg-quoting-in-rebase-p'Junio C Hamano Tue, 27 Feb 2018 18:33:54 +0000 (10:33 -0800)

Merge branch 'js/fix-merge-arg-quoting-in-rebase-p'

"git rebase -p" mangled log messages of a merge commit, which is
now fixed.

* js/fix-merge-arg-quoting-in-rebase-p:
rebase -p: fix incorrect commit message when calling `git merge`.

Merge branch 'jk/gettext-poison'Junio C Hamano Tue, 27 Feb 2018 18:33:54 +0000 (10:33 -0800)

Merge branch 'jk/gettext-poison'

Test updates.

* jk/gettext-poison:
git-sh-i18n: check GETTEXT_POISON before USE_GETTEXT_SCHEME
t0205: drop redundant test

Merge branch 'jk/doc-do-not-write-extern'Junio C Hamano Tue, 27 Feb 2018 18:33:53 +0000 (10:33 -0800)

Merge branch 'jk/doc-do-not-write-extern'

Devdoc update.

* jk/doc-do-not-write-extern:
CodingGuidelines: mention "static" and "extern"

Merge branch 'bp/name-hash-dirname-fix'Junio C Hamano Tue, 27 Feb 2018 18:33:53 +0000 (10:33 -0800)

Merge branch 'bp/name-hash-dirname-fix'

"git add" files in the same directory, but spelling the directory
path in different cases on case insensitive filesystem, corrupted
the name hash data structure and led to unexpected results. This
has been corrected.

* bp/name-hash-dirname-fix:
name-hash: properly fold directory names in adjust_dirname_case()

Merge branch 'jc/blame-missing-path'Junio C Hamano Tue, 27 Feb 2018 18:33:50 +0000 (10:33 -0800)

Merge branch 'jc/blame-missing-path'

"git blame HEAD COPYING" in a bare repository failed to run, while
"git blame HEAD -- COPYING" run just fine. This has been corrected.

* jc/blame-missing-path:
blame: tighten command line parser

Merge branch 'ab/untracked-cache-invalidation-docs'Junio C Hamano Tue, 27 Feb 2018 18:33:50 +0000 (10:33 -0800)

Merge branch 'ab/untracked-cache-invalidation-docs'

Doc update to warn against remaining bugs in untracked cache.

* ab/untracked-cache-invalidation-docs:
update-index doc: note the caveat with "could not open..."
update-index doc: note a fixed bug in the untracked cache

Merge branch 'nd/fix-untracked-cache-invalidation'Junio C Hamano Tue, 27 Feb 2018 18:33:49 +0000 (10:33 -0800)

Merge branch 'nd/fix-untracked-cache-invalidation'

Some bugs around "untracked cache" feature have been fixed.

* nd/fix-untracked-cache-invalidation:
dir.c: ignore paths containing .git when invalidating untracked cache
dir.c: stop ignoring opendir() error in open_cached_dir()
dir.c: fix missing dir invalidation in untracked code
dir.c: avoid stat() in valid_cached_dir()
status: add a failing test showing a core.untrackedCache bug

perl: call timegm and timelocal with 4-digit yearBernhard M. Wiedemann Fri, 23 Feb 2018 17:20:45 +0000 (18:20 +0100)

perl: call timegm and timelocal with 4-digit year

Amazingly, timegm(gmtime(0)) is only 0 before 2020 because perl's
timegm deviates from GNU timegm(3) in how it handles years.

man Time::Local says

Whenever possible, use an absolute four digit year instead.

with a detailed explanation about ambiguity of 2-digit years above that.

Even though this ambiguity is error-prone with >50% of users getting it
wrong, it has been like this for 20+ years, so we just use 4-digit years
everywhere to be on the safe side.

We add some extra logic to cvsimport because it allows 2-digit year
input and interpreting an 18 as 1918 can be avoided easily and safely.

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

subtree: fix add and pull for GPG-signed commitsStephen R Guglielmo Fri, 23 Feb 2018 20:41:25 +0000 (15:41 -0500)

subtree: fix add and pull for GPG-signed commits

If log.showsignature is true (or --show-signature is passed) while
performing a `subtree add` or `subtree pull`, the command fails.

toptree_for_commit() calls `log` and passes the output to `commit-tree`.
If this output shows the GPG signature data, `commit-tree` throws a
fatal error.

This commit fixes the issue by adding --no-show-signature to `log` calls
in a few places, as well as using the more appropriate `rev-parse`
instead where possible.

Signed-off-by: Stephen R Guglielmo <srg@guglielmo.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

strbuf_read_file(): preserve errno across close() callJeff King Fri, 23 Feb 2018 07:00:54 +0000 (02:00 -0500)

strbuf_read_file(): preserve errno across close() call

If we encounter a read error, the user may want to report it
by looking at errno. However, our close() call may clobber
errno, leading to confusing results. Let's save and restore
it in the error case.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: simplify grep_oid and grep_fileRasmus Villemoes Fri, 23 Feb 2018 14:47:57 +0000 (15:47 +0100)

grep: simplify grep_oid and grep_file

In the NO_PTHREADS or !num_threads case, this doesn't change
anything. In the threaded case, note that grep_source_init duplicates
its third argument, so there is no need to keep [path]buf.buf alive
across the call of add_work().

Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: move grep_source_init outside critical sectionRasmus Villemoes Fri, 23 Feb 2018 14:47:56 +0000 (15:47 +0100)

grep: move grep_source_init outside critical section

grep_source_init typically does three strdup()s, and in the threaded
case, the call from add_work() happens while holding grep_mutex.

We can thus reduce the time we hold grep_mutex by moving the
grep_source_init() call out of add_work(), and simply have add_work()
copy the initialized structure to the available slot in the todo
array.

This also simplifies the prototype of add_work(), since it no longer
needs to duplicate all the parameters of grep_source_init(). In the
callers of add_work(), we get to reduce the amount of code duplicated in
the threaded and non-threaded cases slightly (avoiding repeating the
long "GREP_SOURCE_OID, pathbuf.buf, path, oid" argument list); a
subsequent cleanup patch will make that even more so.

Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/gitsubmodules.txt: avoid non-ASCII apostr... Motoki Seki Thu, 22 Feb 2018 08:52:25 +0000 (08:52 +0000)

Documentation/gitsubmodules.txt: avoid non-ASCII apostrophes

In gitsubmodules.txt, a few non-ASCII apostrophes are used to spell
possessive, e.g. "submodule's". These unfortunately are not
rendered at https://git-scm.com/docs/gitsubmodules correctly by the
renderer used there.

Use ASCII apostrophes instead to work around the problem. It also
is good to be consistent, as there are possessives spelled with
ASCII apostrophes.

Signed-off-by: Motoki Seki <marmot.motoki@gmail.com>
Acked-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: factor out strbuf_read_file_or_whine()René Scharfe Thu, 22 Feb 2018 19:29:25 +0000 (20:29 +0100)

sequencer: factor out strbuf_read_file_or_whine()

Reduce code duplication by factoring out a function that reads an entire
file into a strbuf, or reports errors on stderr if something goes wrong.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: send verbose test-helper output to fd 4Jeff King Thu, 22 Feb 2018 06:48:37 +0000 (01:48 -0500)

t: send verbose test-helper output to fd 4

Test helper functions like test_must_fail may produce
messages to stderr when they see a problem. When the tests
are run with "--verbose", this ends up on the test script's
stderr, and the user can read it.

But there's a problem. Some tests record stderr as part of
the test, like:

test_must_fail git foo 2>output &&
test_i18ngrep expected.message output

In this case the error text goes into "output". This makes
the --verbose output less useful (it also means we might
accidentally match it in the second, though in practice we
tend to produce these messages only on error, so we'd abort
the test when the first command fails).

Let's instead send this user-facing output directly to
descriptor 4, which always points to the original stderr (or
/dev/null in non-verbose mode). And it's already forbidden
to redirect descriptor 4, since we use it for BASH_XTRACEFD,
as explained in 9be795fbce (t5615: avoid re-using descriptor
4, 2017-12-08).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

revision: drop --show-all optionJeff King Wed, 21 Feb 2018 23:27:24 +0000 (18:27 -0500)

revision: drop --show-all option

This was an undocumented debugging aid that does not seem to
have come in handy in the past decade, judging from its lack
of mentions on the mailing list.

Let's drop it in the name of simplicity. This is morally a
revert of 3131b71301 (Add "--show-all" revision walker flag
for debugging, 2008-02-09), but note that I did leave in the
mapping of UNINTERESTING to "^" in get_revision_mark(). I
don't think this would be possible to trigger with the
current code, but it's the only sensible marker.

We'll skip the usual deprecation period because this was
explicitly a debugging aid that was never documented.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: drop uses of get_cached_commit_buffer()Jeff King Wed, 21 Feb 2018 23:13:38 +0000 (18:13 -0500)

commit: drop uses of get_cached_commit_buffer()

The "--show-all" revision option shows UNINTERESTING
commits. Some of these commits may be unparsed when we try
to show them (since we may or may not need to walk their
parents to fulfill the request).

Commit 3131b71301 (Add "--show-all" revision walker flag for
debugging, 2008-02-09) resolved this by just skipping
pretty-printing for commits without their object contents
cached, saying:

Because we now end up listing commits we may not even have been parsed
at all "show_log" and "show_commit" need to protect against commits
that don't have a commit buffer entry.

That was the easy fix to avoid the pretty-printer segfaulting,
but:

1. It doesn't work for all formats. E.g., --oneline
prints the oid for each such commit but not a trailing
newline, leading to jumbled output.

2. It only affects some commits, depending on whether we
happened to parse them or not (so if they were at the
tip of an UNINTERESTING starting point, or if we
happened to traverse over them, you'd see more data).

3. It unncessarily ties the decision to show the verbose
header to whether the commit buffer was cached. That
makes it harder to change the logic around caching
(e.g., if we could traverse without actually loading
the full commit objects).

These days it's safe to feed such a commit to the
pretty-print code. Since be5c9fb904 (logmsg_reencode: lazily
load missing commit buffers, 2013-01-26), we'll load it on
demand in such a case. So let's just always show the verbose
headers.

This does change the behavior of plumbing, but:

a. The --show-all option was explicitly introduced as a
debugging aid, and was never documented (and has rarely
even been mentioned on the list by git devs).

b. Avoiding the commits was already not deterministic due
to (2) above. So the caller might have seen full
headers for these commits anyway, and would need to be
prepared for it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace: rename 'new' variablesBrandon Williams Wed, 14 Feb 2018 18:59:59 +0000 (10:59 -0800)

replace: rename 'new' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trailer: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:58 +0000 (10:59 -0800)

trailer: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tempfile: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:57 +0000 (10:59 -0800)

tempfile: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wrapper: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:56 +0000 (10:59 -0800)

wrapper: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

environment: rename 'namespace' variablesBrandon Williams Wed, 14 Feb 2018 18:59:55 +0000 (10:59 -0800)

environment: rename 'namespace' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:54 +0000 (10:59 -0800)

diff: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

environment: rename 'template' variablesBrandon Williams Wed, 14 Feb 2018 18:59:53 +0000 (10:59 -0800)

environment: rename 'template' variables

Rename C++ keyword in order to bring the codebase closer to being able
to be compiled with a C++ compiler.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>