git/git.git
2 years agosha1_file: convert check_sha1_signature to struct object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:39 +0000 (02:27 +0000)]
sha1_file: convert check_sha1_signature to struct object_id

Convert this function to take a pointer to struct object_id and rename
it check_object_signature.  Introduce temporaries to convert the return
values of lookup_replace_object and lookup_replace_object_extended into
struct object_id.

The temporaries are needed because in order to convert
lookup_replace_object, open_istream needs to be converted, and
open_istream needs check_sha1_signature to be converted, causing a loop
of dependencies.  The temporaries will be removed in a future patch.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosha1_file: convert read_loose_object to use struct object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:38 +0000 (02:27 +0000)]
sha1_file: convert read_loose_object to use struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobuiltin/index-pack: convert struct ref_delta_entry to object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:37 +0000 (02:27 +0000)]
builtin/index-pack: convert struct ref_delta_entry to object_id

Convert this struct to use a member of type object_id.  Convert various
static functions as well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoarchive: convert sha1_file_to_archive to struct object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:36 +0000 (02:27 +0000)]
archive: convert sha1_file_to_archive to struct object_id

Convert this function to take a pointer to struct object_id and rename
it object_file_to_archive.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoarchive: convert write_archive_entry_fn_t to object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:35 +0000 (02:27 +0000)]
archive: convert write_archive_entry_fn_t to object_id

Convert the write_archive_entry_fn_t type to use a pointer to struct
object_id.  Convert various static functions in the tar and zip
archivers also.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agobuiltin/mktag: convert to struct object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:34 +0000 (02:27 +0000)]
builtin/mktag: convert to struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoreplace_object: convert struct replace_object to object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:33 +0000 (02:27 +0000)]
replace_object: convert struct replace_object to object_id

Convert the two members of this struct to be instances of struct
object_id.  Adjust the various functions in this file accordingly.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agosend-pack: convert remaining functions to struct object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:32 +0000 (02:27 +0000)]
send-pack: convert remaining functions to struct object_id

Convert the remaining function, feed_object, to use struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agohttp-walker: convert struct object_request to use struct object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:31 +0000 (02:27 +0000)]
http-walker: convert struct object_request to use struct object_id

Convert struct object_request to use struct object_id by updating the
definition and applying the following semantic patch, plus the standard
object_id transforms:

@@
struct object_request E1;
@@
- E1.sha1
+ E1.oid.hash

@@
struct object_request *E1;
@@
- E1->sha1
+ E1->oid.hash

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoConvert find_unique_abbrev* to struct object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:30 +0000 (02:27 +0000)]
Convert find_unique_abbrev* to struct object_id

Convert find_unique_abbrev and find_unique_abbrev_r to each 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>
2 years agowt-status: convert struct wt_status_state to object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:29 +0000 (02:27 +0000)]
wt-status: convert struct wt_status_state to object_id

Convert the various *_sha1 members to use struct object_id instead.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agostrbuf: convert strbuf_add_unique_abbrev to use struct object_id
brian m. carlson [Mon, 12 Mar 2018 02:27:28 +0000 (02:27 +0000)]
strbuf: convert strbuf_add_unique_abbrev to use struct object_id

Convert the declaration and definition of strbuf_add_unique_abbrev to
make it take a pointer to struct object_id.  Predeclare the struct in
strbuf.h, as cache.h includes strbuf.h before it declares the struct,
and otherwise the struct declaration would have the wrong scope.

Apply the following semantic patch, along with the standard object_id
transforms, to adjust the callers:

@@
expression E1, E2, E3;
@@
- strbuf_add_unique_abbrev(E1, E2.hash, E3);
+ strbuf_add_unique_abbrev(E1, &E2, E3);

@@
expression E1, E2, E3;
@@
- strbuf_add_unique_abbrev(E1, E2->hash, E3);
+ strbuf_add_unique_abbrev(E1, E2, E3);

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoref-filter: convert grab_objectname to struct object_id
brian 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>
2 years agotree: convert read_tree_recursive to struct object_id
brian 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>
2 years agoresolve-undo: convert struct resolve_undo_info to object_id
brian 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>
2 years agocache-tree: convert remnants to struct object_id
brian 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>
2 years agocache-tree: convert write_*_as_tree to object_id
brian 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>
2 years agobuiltin/write-tree: convert to struct object_id
brian 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>
2 years agobulk-checkin: convert index_bulk_checkin to struct object_id
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>
2 years agoEighth batch for 2.17 460/head
Junio 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>
2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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>)'

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoSeventh batch for 2.17
Junio 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>
2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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
  ...

2 years agoMerge 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()

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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()

2 years agoMerge branch 'bw/doc-submodule-recurse-config-with-clone'
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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

2 years agoMerge 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

3 years agouserdiff: add built-in pattern for golang
Alban 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>
3 years agocommit: run git gc --auto just before the post-commit hook
Æ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>
3 years agoSixth batch for 2.17
Junio 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>
3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agountracked cache: use git_env_bool() not getenv() for customization
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>
3 years agorevision.c: reduce object database queries
Derrick 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>
3 years agoperf: use GIT_PERF_REPEAT_COUNT=3 by default even without config file
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>
3 years agosha1_name: fix uninitialized memory errors
Derrick 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>
3 years agodocs/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>
3 years agotest_must_be_empty: make sure the file exists, not just empty
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>
3 years agoFifth batch for 2.17
Junio 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>
3 years agoSync with maint
Junio C Hamano [Tue, 27 Feb 2018 18:53:19 +0000 (10:53 -0800)]
Sync with maint

3 years agoMerge branch 'ys/bisect-object-id-missing-conversion-fix' into maint
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

3 years agoMerge branch 'sb/submodule-update-reset-fix' into maint
Junio 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

3 years agoMerge branch 'ab/commit-m-with-fixup' into maint
Junio 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

3 years agoMerge branch 'nd/ita-wt-renames-in-status' into maint
Junio 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

3 years agoMerge 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

3 years agoMerge 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"

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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>'

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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()

3 years agoMerge 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`.

3 years agoMerge 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

3 years agoMerge 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"

3 years agoMerge 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()

3 years agoMerge 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

3 years agoMerge 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

3 years agoMerge 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

3 years agoperl: call timegm and timelocal with 4-digit year
Bernhard 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>
3 years agosubtree: fix add and pull for GPG-signed commits
Stephen 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>
3 years agostrbuf_read_file(): preserve errno across close() call
Jeff 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>
3 years agogrep: simplify grep_oid and grep_file
Rasmus 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>
3 years agogrep: move grep_source_init outside critical section
Rasmus 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>