gitweb.git
Merge branch 'jw/gitweb-sample-update'Junio C Hamano Tue, 9 Jul 2019 22:25:45 +0000 (15:25 -0700)

Merge branch 'jw/gitweb-sample-update'

Doc update.

* jw/gitweb-sample-update:
doc: don't use git.kernel.org as example gitweb URL

Merge branch 'js/t0001-case-insensitive'Junio C Hamano Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)

Merge branch 'js/t0001-case-insensitive'

Test update.

* js/t0001-case-insensitive:
t0001: fix on case-insensitive filesystems

Merge branch 'cc/first-contrib-tutorial'Junio C Hamano Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)

Merge branch 'cc/first-contrib-tutorial'

Update docs used in a tutorial.

* cc/first-contrib-tutorial:
doc: improve usage string in MyFirstContribution

Merge branch 'ab/fail-prereqs-in-test'Junio C Hamano Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)

Merge branch 'ab/fail-prereqs-in-test'

Test updates.

* ab/fail-prereqs-in-test:
tests: mark two failing tests under FAIL_PREREQS

Merge branch 'nd/switch-and-restore'Junio C Hamano Tue, 9 Jul 2019 22:25:44 +0000 (15:25 -0700)

Merge branch 'nd/switch-and-restore'

Two new commands "git switch" and "git restore" are introduced to
split "checking out a branch to work on advancing its history" and
"checking out paths out of the index and/or a tree-ish to work on
advancing the current history" out of the single "git checkout"
command.

* nd/switch-and-restore: (46 commits)
completion: disable dwim on "git switch -d"
switch: allow to switch in the middle of bisect
t2027: use test_must_be_empty
Declare both git-switch and git-restore experimental
help: move git-diff and git-reset to different groups
doc: promote "git restore"
user-manual.txt: prefer 'merge --abort' over 'reset --hard'
completion: support restore
t: add tests for restore
restore: support --patch
restore: replace --force with --ignore-unmerged
restore: default to --source=HEAD when only --staged is specified
restore: reject invalid combinations with --staged
restore: add --worktree and --staged
checkout: factor out worktree checkout code
restore: disable overlay mode by default
restore: make pathspec mandatory
restore: take tree-ish from --source option instead
checkout: split part of it to new command 'restore'
doc: promote "git switch"
...

Merge branch 'nd/fetch-capability-tweak'Junio C Hamano Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)

Merge branch 'nd/fetch-capability-tweak'

Protocol capabilities that go over wire should never be translated,
but it was incorrectly marked for translation, which has been
corrected. The output of protocol capabilities for debugging has
been tweaked a bit.

* nd/fetch-capability-tweak:
fetch-pack: print server version at the top in -v -v
fetch-pack: print all relevant supported capabilities with -v -v
fetch-pack: move capability names out of i18n strings

Merge branch 'jk/oidhash'Junio C Hamano Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)

Merge branch 'jk/oidhash'

Code clean-up to remove hardcoded SHA-1 hash from many places.

* jk/oidhash:
hashmap: convert sha1hash() to oidhash()
hash.h: move object_id definition from cache.h
khash: rename oid helper functions
khash: drop sha1-specific map types
pack-bitmap: convert khash_sha1 maps into kh_oid_map
delta-islands: convert island_marks khash to use oids
khash: rename kh_oid_t to kh_oid_set
khash: drop broken oid_map typedef
object: convert create_object() to use object_id
object: convert internal hash_obj() to object_id
object: convert lookup_object() to use object_id
object: convert lookup_unknown_object() to use object_id
pack-objects: convert locate_object_entry_hash() to object_id
pack-objects: convert packlist_find() to use object_id
pack-bitmap-write: convert some helpers to use object_id
upload-pack: rename a "sha1" variable to "oid"
describe: fix accidental oid/hash type-punning

Merge branch 'jk/delta-islands-progress-fix'Junio C Hamano Tue, 9 Jul 2019 22:25:43 +0000 (15:25 -0700)

Merge branch 'jk/delta-islands-progress-fix'

The codepath to compute delta islands used to spew progress output
without giving the callers any way to squelch it, which has been
fixed.

* jk/delta-islands-progress-fix:
delta-islands: respect progress flag

Merge branch 'md/sort-detached-head-first'Junio C Hamano Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)

Merge branch 'md/sort-detached-head-first'

"git branch --list" learned to always output the detached HEAD as
the first item (when the HEAD is detached, of course), regardless
of the locale.

* md/sort-detached-head-first:
ref-filter: sort detached HEAD lines firstly

Merge branch 'nd/fetch-multi-gc-once'Junio C Hamano Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)

Merge branch 'nd/fetch-multi-gc-once'

"git fetch" that grabs from a group of remotes learned to run the
auto-gc only once at the very end.

* nd/fetch-multi-gc-once:
fetch: only run 'gc' once when fetching multiple remotes

Merge branch 'es/rev-list-no-object-names'Junio C Hamano Tue, 9 Jul 2019 22:25:42 +0000 (15:25 -0700)

Merge branch 'es/rev-list-no-object-names'

"git rev-list --objects" learned with "--no-object-names" option to
squelch the path to the object that is used as a grouping hint for
pack-objects.

* es/rev-list-no-object-names:
rev-list: teach --no-object-names to enable piping

Merge branch 'rs/config-unit-parsing'Junio C Hamano Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)

Merge branch 'rs/config-unit-parsing'

The code to parse scaled numbers out of configuration files has
been made more robust and also easier to follow.

* rs/config-unit-parsing:
config: simplify parsing of unit factors
config: don't multiply in parse_unit_factor()
config: use unsigned_mult_overflows to check for overflows

Merge branch 'js/gcc-8-and-9'Junio C Hamano Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)

Merge branch 'js/gcc-8-and-9'

Code clean-up for new compilers.

* js/gcc-8-and-9:
config: avoid calling `labs()` on too-large data type
winansi: simplify loading the GetCurrentConsoleFontEx() function
kwset: allow building with GCC 8
poll (mingw): allow compiling with GCC 8 and DEVELOPER=1

Merge branch 'dl/includeif-onbranch'Junio C Hamano Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)

Merge branch 'dl/includeif-onbranch'

The conditional inclusion mechanism learned to base the choice on
the branch the HEAD currently is on.

* dl/includeif-onbranch:
config: learn the "onbranch:" includeIf condition

Merge branch 'pw/rebase-abort-clean-rewritten'Junio C Hamano Tue, 9 Jul 2019 22:25:41 +0000 (15:25 -0700)

Merge branch 'pw/rebase-abort-clean-rewritten'

"git rebase --abort" used to leave refs/rewritten/ when concluding
"git rebase -r", which has been corrected.

* pw/rebase-abort-clean-rewritten:
rebase --abort/--quit: cleanup refs/rewritten
sequencer: return errors from sequencer_remove_state()
rebase: warn if state directory cannot be removed
rebase: fix a memory leak

Merge branch 'am/p4-branches-excludes'Junio C Hamano Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)

Merge branch 'am/p4-branches-excludes'

"git p4" update.

* am/p4-branches-excludes:
git-p4: respect excluded paths when detecting branches
git-p4: add failing test for "git-p4: respect excluded paths when detecting branches"
git-p4: don't exclude other files with same prefix
git-p4: add failing test for "don't exclude other files with same prefix"
git-p4: don't groom exclude path list on every commit
git-p4: match branches case insensitively if configured
git-p4: add failing test for "git-p4: match branches case insensitively if configured"
git-p4: detect/prevent infinite loop in gitCommitByP4Change()

Merge branch 'tg/stash-ref-by-index-fix'Junio C Hamano Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)

Merge branch 'tg/stash-ref-by-index-fix'

"git stash show 23" used to work, but no more after getting
rewritten in C; this regression has been corrected.

* tg/stash-ref-by-index-fix:
stash: fix show referencing stash index

Merge branch 'cb/mkstemps-uint-type-fix'Junio C Hamano Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)

Merge branch 'cb/mkstemps-uint-type-fix'

Variable type fix.

* cb/mkstemps-uint-type-fix:
wrapper: avoid undefined behaviour in macOS

Merge branch 'jk/trailers-use-config'Junio C Hamano Tue, 9 Jul 2019 22:25:40 +0000 (15:25 -0700)

Merge branch 'jk/trailers-use-config'

"git interpret-trailers" always treated '#' as the comment
character, regardless of core.commentChar setting, which has been
corrected.

* jk/trailers-use-config:
interpret-trailers: load default config

Merge branch 'js/t3404-typofix'Junio C Hamano Tue, 9 Jul 2019 22:25:39 +0000 (15:25 -0700)

Merge branch 'js/t3404-typofix'

Typofix.

* js/t3404-typofix:
t3404: fix a typo

Merge branch 'pw/doc-synopsis-markup-opmode-options'Junio C Hamano Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)

Merge branch 'pw/doc-synopsis-markup-opmode-options'

Docfix.

* pw/doc-synopsis-markup-opmode-options:
show --continue/skip etc. consistently in synopsis

Merge branch 'rs/copy-array'Junio C Hamano Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)

Merge branch 'rs/copy-array'

Code clean-up.

* rs/copy-array:
use COPY_ARRAY for copying arrays
coccinelle: use COPY_ARRAY for copying arrays

Merge branch 'cb/fsmonitor-intfix'Junio C Hamano Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)

Merge branch 'cb/fsmonitor-intfix'

Variable type fix.

* cb/fsmonitor-intfix:
fsmonitor: avoid signed integer overflow / infinite loop

Merge branch 'rs/avoid-overflow-in-midpoint-computation'Junio C Hamano Tue, 9 Jul 2019 22:25:37 +0000 (15:25 -0700)

Merge branch 'rs/avoid-overflow-in-midpoint-computation'

Code clean-up to avoid signed integer overlaps during binary search.

* rs/avoid-overflow-in-midpoint-computation:
cleanup: fix possible overflow errors in binary search, part 2

Merge branch 'pw/add-p-recount'Junio C Hamano Tue, 9 Jul 2019 22:25:37 +0000 (15:25 -0700)

Merge branch 'pw/add-p-recount'

"git checkout -p" needs to selectively apply a patch in reverse,
which did not work well.

* pw/add-p-recount:
add -p: fix checkout -p with pathological context

Merge branch 'ds/close-object-store'Junio C Hamano Tue, 9 Jul 2019 22:25:37 +0000 (15:25 -0700)

Merge branch 'ds/close-object-store'

The commit-graph file is now part of the "files that the runtime
may keep open file descriptors on, all of which would need to be
closed when done with the object store", and the file descriptor to
an existing commit-graph file now is closed before "gc" finalizes a
new instance to replace it.

* ds/close-object-store:
packfile: rename close_all_packs to close_object_store
packfile: close commit-graph in close_all_packs
commit-graph: use raw_object_store when closing

Merge branch 'ds/commit-graph-write-refactor'Junio C Hamano Tue, 9 Jul 2019 22:25:36 +0000 (15:25 -0700)

Merge branch 'ds/commit-graph-write-refactor'

Renamed from commit-graph-format-v2 and changed scope.

* ds/commit-graph-write-refactor:
commit-graph: extract write_commit_graph_file()
commit-graph: extract copy_oids_to_commits()
commit-graph: extract count_distinct_commits()
commit-graph: extract fill_oids_from_all_packs()
commit-graph: extract fill_oids_from_commit_hex()
commit-graph: extract fill_oids_from_packs()
commit-graph: create write_commit_graph_context
commit-graph: remove Future Work section
commit-graph: collapse parameters into flags
commit-graph: return with errors during write
commit-graph: fix the_repository reference

Merge branch 'sg/trace2-rename'Junio C Hamano Tue, 9 Jul 2019 22:25:36 +0000 (15:25 -0700)

Merge branch 'sg/trace2-rename'

Dev support update to help tracing out tests.

* sg/trace2-rename:
trace2: correct typo in technical documentation
Revert "test-lib: whitelist GIT_TR2_* in the environment"

Merge branch 'nd/completion-no-cache-failure'Junio C Hamano Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)

Merge branch 'nd/completion-no-cache-failure'

An incorrect list of options was cached after command line
completion failed (e.g. trying to complete a command that requires
a repository outside one), which has been corrected.

* nd/completion-no-cache-failure:
completion: do not cache if --git-completion-helper fails

Merge branch 'js/mergetool-optim'Junio C Hamano Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)

Merge branch 'js/mergetool-optim'

"git mergetool" and its tests now spawn fewer subprocesses.

* js/mergetool-optim:
mergetool: use shell variable magic instead of `awk`
mergetool: dissect strings with shell variable magic instead of `expr`
t7610-mergetool: use test_cmp instead of test $(cat file) = $txt
t7610-mergetool: do not place pipelines headed by `yes` in subshells

Merge branch 'mo/hpux-dynpath'Junio C Hamano Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)

Merge branch 'mo/hpux-dynpath'

Auto-detect how to tell HP-UX aCC where to use dynamically linked
libraries from at runtime.

* mo/hpux-dynpath:
configure: Detect linking style for HP aCC on HP-UX

Merge branch 'dl/config-alias-doc'Junio C Hamano Tue, 9 Jul 2019 22:25:35 +0000 (15:25 -0700)

Merge branch 'dl/config-alias-doc'

Doc update.

* dl/config-alias-doc:
config/alias.txt: document alias accepting non-command first word
config/alias.txt: change " and ' to `

Merge branch 'tm/tag-gpgsign-config'Junio C Hamano Tue, 9 Jul 2019 22:25:34 +0000 (15:25 -0700)

Merge branch 'tm/tag-gpgsign-config'

A new tag.gpgSign configuration variable turns "git tag -a" into
"git tag -s".

* tm/tag-gpgsign-config:
tag: add tag.gpgSign config option to force all tags be GPG-signed

Merge branch 'fc/fetch-with-import-fix'Junio C Hamano Tue, 9 Jul 2019 22:25:34 +0000 (15:25 -0700)

Merge branch 'fc/fetch-with-import-fix'

Code restructuring during 2.20 period broke fetching tags via
"import" based transports.

* fc/fetch-with-import-fix:
fetch: fix regression with transport helpers
fetch: make the code more understandable
fetch: trivial cleanup
t5801 (remote-helpers): add test to fetch tags
t5801 (remote-helpers): cleanup refspec stuff

Merge branch 'po/doc-branch'Junio C Hamano Tue, 9 Jul 2019 22:25:34 +0000 (15:25 -0700)

Merge branch 'po/doc-branch'

Doc update.

* po/doc-branch:
doc branch: provide examples for listing remote tracking branches

Merge branch 'nb/branch-show-other-worktrees-head'Junio C Hamano Tue, 9 Jul 2019 22:25:33 +0000 (15:25 -0700)

Merge branch 'nb/branch-show-other-worktrees-head'

"git branch --list" learned to show branches that are checked out
in other worktrees connected to the same repository prefixed with
'+', similar to the way the currently checked out branch is shown
with '*' in front.

* nb/branch-show-other-worktrees-head:
branch: add worktree info on verbose output
branch: update output to include worktree info
ref-filter: add worktreepath atom

trace2: correct typo in technical documentationCarlo Marcelo Arenas Belón Wed, 26 Jun 2019 20:03:03 +0000 (13:03 -0700)

trace2: correct typo in technical documentation

an apparent typo for the environment variable was included with 81567caf87
("trace2: update docs to describe system/global config settings",
2019-04-15), and was missed when renamed variables by e4b75d6a1d
("trace2: rename environment variables to GIT_TRACE2*", 2019-05-19)

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: don't use git. as example gitweb URLJakub Wilk Sat, 22 Jun 2019 16:48:57 +0000 (18:48 +0200)

doc: don't use git. as example gitweb URL

git.kernel.org uses cgit, not gitweb, these days:

$ w3m -dump 'http://git.kernel.org/?p=git/git.git;a=tree;f=gitweb' | grep -w generated
generated by cgit 1.2-0.3.lf.el7 (git 2.18.0) at 2019-06-22 16:14:38 +0000

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: simplify parsing of unit factorsRené Scharfe Sat, 22 Jun 2019 10:03:40 +0000 (12:03 +0200)

config: simplify parsing of unit factors

Just return the value of the factor or zero for unrecognized strings
instead of using an output reference and a separate return value to
indicate success. This is shorter and simpler.

It basically reverts that function to before c8deb5a146 ("Improve error
messages when int/long cannot be parsed from config", 2007-12-25), while
keeping the better messages, so restore its old name, get_unit_factor(),
as well.

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

config: don't multiply in parse_unit_factor()René Scharfe Sat, 22 Jun 2019 10:03:36 +0000 (12:03 +0200)

config: don't multiply in parse_unit_factor()

parse_unit_factor() multiplies the number that is passed to it with the
value of a recognized unit factor (K, M or G for 2^10, 2^20 and 2^30,
respectively). All callers pass in 1 as a number, though, which allows
them to check the actual multiplication for overflow before they are
doing it themselves.

Ignore the passed in number and don't multiply, as this feature of
parse_unit_factor() is not used anymore. Rename the output parameter to
reflect that it's not about the end result anymore, but just about the
unit factor.

Suggested-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: use unsigned_mult_overflows to check for overflowsRené Scharfe Sat, 22 Jun 2019 10:03:30 +0000 (12:03 +0200)

config: use unsigned_mult_overflows to check for overflows

parse_unit_factor() checks if a K, M or G is present after a number and
multiplies it by 2^10, 2^20 or 2^30, respectively. One of its callers
checks if the result is smaller than the number alone to detect
overflows. The other one passes 1 as the number and does multiplication
and overflow check itself in a similar manner.

This works, but is inconsistent, and it would break if we added support
for a bigger unit factor. E.g. 16777217T is 2^64 + 2^40, i.e. too big
for a 64-bit number. Modulo 2^64 we get 2^40 == 1TB, which is bigger
than the raw number 16777217 == 2^24 + 1, so the overflow would go
undetected by that method.

Let both callers pass 1 and handle overflow check and multiplication
themselves. Do the check before the multiplication, using
unsigned_mult_overflows, which is simpler and can deal with larger unit
factors.

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

t0001: fix on case-insensitive filesystemsJohannes Schindelin Mon, 24 Jun 2019 17:40:05 +0000 (19:40 +0200)

t0001: fix on case-insensitive filesystems

On a case-insensitive filesystem, such as HFS+ or NTFS, it is possible
that the idea Bash has of the current directory differs in case from
what Git thinks it is. That's totally okay, though, and we should not
expect otherwise.

On Windows, for example, when you call

cd C:\GIT-SDK-64

in a PowerShell and there exists a directory called `C:\git-sdk-64`, the
current directory will be reported in all upper-case. Even in a Bash
that you might call from that PowerShell. Git, however, will have
normalized this via `GetFinalPathByHandle()`, and the expectation in
t0001 that the recorded gitdir will match what `pwd` says will be
violated.

Let's address this by comparing these paths in a case-insensitive
manner when `core.ignoreCase` is `true`.

Reported by Jameson Miller.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: improve usage string in MyFirstContributionChristian Couder Sat, 22 Jun 2019 06:10:35 +0000 (08:10 +0200)

doc: improve usage string in MyFirstContribution

We implement a command called git-psuh which accept arguments, so let's
show that it accepts arguments in the doc and the usage string.

While at it, we need to prepare "a NULL-terminated array of usage strings",
not just "a NULL-terminated usage string".

Helped-by: Emily Shaffer <emilyshaffer@google.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: mark two failing tests under FAIL_PREREQSÆvar Arnfjörð Bjarmason Thu, 20 Jun 2019 20:42:27 +0000 (22:42 +0200)

tests: mark two failing tests under FAIL_PREREQS

Fix a couple of tests that would potentially fail under
GIT_TEST_FAIL_PREREQS=true.

I missed these when annotating other tests in dfe1a17df9 ("tests: add
a special setup where prerequisites fail", 2019-05-13) because on my
system I can only reproduce this failure when I run the tests as
"root", since the tests happen to depend on whether we can fall back
on GECOS info or not. I.e. they'd usually fail to look up the ident
info anyway, but not always.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

The third batchJunio C Hamano Fri, 21 Jun 2019 18:26:11 +0000 (11:26 -0700)

The third batch

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

Merge branch 'mo/clang-format-for-each-update'Junio C Hamano Fri, 21 Jun 2019 18:24:12 +0000 (11:24 -0700)

Merge branch 'mo/clang-format-for-each-update'

The list of for-each like macros used by clang-format has been
updated.

* mo/clang-format-for-each-update:
clang-format: use git grep to generate the ForEachMacros list

Merge branch 'md/url-parse-harden'Junio C Hamano Fri, 21 Jun 2019 18:24:12 +0000 (11:24 -0700)

Merge branch 'md/url-parse-harden'

The URL decoding code has been updated to avoid going past the end
of the string while parsing %-<hex>-<hex> sequence.

* md/url-parse-harden:
url: do not allow %00 to represent NUL in URLs
url: do not read past end of buffer

Merge branch 'an/ignore-doc-update'Junio C Hamano Fri, 21 Jun 2019 18:24:11 +0000 (11:24 -0700)

Merge branch 'an/ignore-doc-update'

The description about slashes in gitignore patterns (used to
indicate things like "anchored to this level only" and "only
matches directories") has been revamped.

* an/ignore-doc-update:
gitignore.txt: make slash-rules more readable

Merge branch 'ab/hash-object-doc'Junio C Hamano Fri, 21 Jun 2019 18:24:11 +0000 (11:24 -0700)

Merge branch 'ab/hash-object-doc'

Doc update.

* ab/hash-object-doc:
hash-object doc: stop mentioning git-cvsimport

Merge branch 'cm/send-email-document-req-modules'Junio C Hamano Fri, 21 Jun 2019 18:24:10 +0000 (11:24 -0700)

Merge branch 'cm/send-email-document-req-modules'

A doc update.

* cm/send-email-document-req-modules:
send-email: update documentation of required Perl modules

Merge branch 'md/list-objects-filter-parse-msgfix'Junio C Hamano Fri, 21 Jun 2019 18:24:10 +0000 (11:24 -0700)

Merge branch 'md/list-objects-filter-parse-msgfix'

Make an end-user facing message localizable.

* md/list-objects-filter-parse-msgfix:
list-objects-filter-options: error is localizeable

Merge branch 'md/list-objects-filter-memfix'Junio C Hamano Fri, 21 Jun 2019 18:24:09 +0000 (11:24 -0700)

Merge branch 'md/list-objects-filter-memfix'

The filter_data used in the list-objects-filter (which manages a
lazily sparse clone repository) did not use the dynamic array API
correctly---'nr' is supposed to point at one past the last element
of the array in use. This has been corrected.

* md/list-objects-filter-memfix:
list-objects-filter: correct usage of ALLOC_GROW

Merge branch 'jt/partial-clone-missing-ref-delta-base'Junio C Hamano Fri, 21 Jun 2019 18:24:09 +0000 (11:24 -0700)

Merge branch 'jt/partial-clone-missing-ref-delta-base'

"git fetch" into a lazy clone forgot to fetch base objects that are
necessary to complete delta in a thin packfile, which has been
corrected.

* jt/partial-clone-missing-ref-delta-base:
t5616: cover case of client having delta base
t5616: use correct flag to check object is missing
index-pack: prefetch missing REF_DELTA bases
t5616: refactor packfile replacement

Merge branch 'ml/userdiff-rust'Junio C Hamano Fri, 21 Jun 2019 18:24:08 +0000 (11:24 -0700)

Merge branch 'ml/userdiff-rust'

The pattern "git diff/grep" use to extract funcname and words
boundary for Rust has been added.

* ml/userdiff-rust:
userdiff: two simplifications of patterns for rust
userdiff: add built-in pattern for rust

fetch-pack: print server version at the top in -v -vNguyễn Thái Ngọc Duy Thu, 20 Jun 2019 11:59:51 +0000 (18:59 +0700)

fetch-pack: print server version at the top in -v -v

Before the previous patch, the server version is printed after all the
"Server supports" lines. The previous one puts the version in the middle
of "Server supports" group.

Instead of moving it to the bottom, I move it to the top. Version may
stand out more at the top as we will have even more debug out after
capabilities.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch-pack: print all relevant supported capabilities... Nguyễn Thái Ngọc Duy Thu, 20 Jun 2019 11:59:50 +0000 (18:59 +0700)

fetch-pack: print all relevant supported capabilities with -v -v

When we check if some capability is supported, we do print something in
verbose mode. Some capabilities are not printed though (and it made me
think it's not supported; I was more used to GIT_TRACE_PACKET) so let's
print them all.

It's a bit more code. And one could argue for printing all supported
capabilities the server sends us. But I think it's still valuable this
way because we see the capabilities that the client cares about.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch-pack: move capability names out of i18n stringsNguyễn Thái Ngọc Duy Thu, 20 Jun 2019 11:59:49 +0000 (18:59 +0700)

fetch-pack: move capability names out of i18n strings

This reduces the work on translators since they only have one string to
translate (and I think it's still enough context to translate). It also
makes sure no capability name is translated by accident.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: disable dwim on "git switch -d"Nguyễn Thái Ngọc Duy Thu, 20 Jun 2019 09:55:22 +0000 (16:55 +0700)

completion: disable dwim on "git switch -d"

Even though dwim is enabled by default, it will never be done when
--detached is specified. If you force "-d --guess" you will get an error
because --guess then implies -c which cannot be used with -d. So we can
disable dwim in "switch -d". It makes the completion list in this case a
bit shorter.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

switch: allow to switch in the middle of bisectNguyễn Thái Ngọc Duy Thu, 20 Jun 2019 09:55:21 +0000 (16:55 +0700)

switch: allow to switch in the middle of bisect

In c45f0f525d (switch: reject if some operation is in progress,
2019-03-29), a check is added to prevent switching when some operation
is in progress. The reason is it's often not safe to do so.

This is true for merge, am, rebase, cherry-pick and revert, but not so
much for bisect because bisecting is basically jumping/switching between
a bunch of commits to pin point the first bad one. git-bisect suggests
the next commit to test, but it's not wrong for the user to test a
different commit because git-bisect cannot have the knowledge to know
better.

For this reason, allow to switch when bisecting (*). I considered if we
should still prevent switching by default and allow it with
--ignore-in-progress. But I don't think the prevention really adds
anything much.

If the user switches away by mistake, since we print the previous HEAD
value, even if they don't know about the "-" shortcut, switching back is
still possible.

The warning will be printed on every switch while bisect is still
ongoing, not the first time you switch away from bisect's suggested
commit, so it could become a bit annoying.

(*) of course when it's safe to do so, i.e. no loss of local changes and
stuff.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t2027: use test_must_be_emptyNguyễn Thái Ngọc Duy Thu, 20 Jun 2019 09:55:20 +0000 (16:55 +0700)

t2027: use test_must_be_empty

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

delta-islands: respect progress flagJeff King Thu, 20 Jun 2019 08:58:32 +0000 (04:58 -0400)

delta-islands: respect progress flag

The delta island code always prints "Marked %d islands", even if
progress has been suppressed with --no-progress or by sending stderr to
a non-tty.

Let's pass a progress boolean to load_delta_islands(). We already do
the same thing for the progress meter in resolve_tree_islands().

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

rev-list: teach --no-object-names to enable pipingEmily Shaffer Wed, 19 Jun 2019 20:56:56 +0000 (13:56 -0700)

rev-list: teach --no-object-names to enable piping

Allow easier parsing by cat-file by giving rev-list an option to print
only the OID of a non-commit object without any additional information.
This is a short-term shim; later on, rev-list should be taught how to
print the types of objects it finds in a format similar to cat-file's.

Before this commit, the output from rev-list needed to be massaged
before being piped to cat-file, like so:

git rev-list --objects HEAD | cut -f 1 -d ' ' |
git cat-file --batch-check

This was especially unexpected when dealing with root trees, as an
invisible whitespace exists at the end of the OID:

git rev-list --objects --filter=tree:1 --max-count=1 HEAD |
xargs -I% echo "AA%AA"

Now, it can be piped directly, as in the added test case:

git rev-list --objects --no-object-names HEAD | git cat-file --batch-check

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Change-Id: I489bdf0a8215532e540175188883ff7541d70e1b
Signed-off-by: Junio C Hamano <gitster@pobox.com>

hashmap: convert sha1hash() to oidhash()Jeff King Thu, 20 Jun 2019 07:41:49 +0000 (03:41 -0400)

hashmap: convert sha1hash() to oidhash()

There are no callers left of sha1hash() that do not simply pass the
"hash" member of a "struct object_id". Let's get rid of the outdated
sha1-specific function and provide one that operates on the whole struct
(even though the technique, taking the first few bytes of the hash, will
remain the same).

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

hash.h: move object_id definition from cache.hJeff King Thu, 20 Jun 2019 07:41:45 +0000 (03:41 -0400)

hash.h: move object_id definition from cache.h

Our hashmap.h helpfully defines a sha1hash() function. But it cannot
define a similar oidhash() without including all of cache.h, which
itself wants to include hashmap.h! Let's break this circular dependency
by moving the definition to hash.h, along with the remaining RAWSZ
macros, etc. That will put them with the existing git_hash_algo
definition.

One alternative would be to move oidhash() into cache.h, but it's
already quite bloated. We're better off moving things out than in.

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

khash: rename oid helper functionsJeff King Thu, 20 Jun 2019 07:41:42 +0000 (03:41 -0400)

khash: rename oid helper functions

For use in object_id hash tables, we have oid_hash() and oid_equal().
But these are confusingly similar to the existing oideq() and the
oidhash() we plan to add to replace sha1hash().

The big difference from those functions is that rather than accepting a
const pointer to the "struct object_id", we take the arguments by value
(which is a khash internal convention). So let's make that obvious by
calling them oidhash_by_value() and oideq_by_value().

Those names are fairly horrendous to type, but we rarely need to do so;
they are passed to the khash implementation macro and then only used
internally. Callers get to use the nice kh_put_oid_map(), etc.

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

khash: drop sha1-specific map typesJeff King Thu, 20 Jun 2019 07:41:38 +0000 (03:41 -0400)

khash: drop sha1-specific map types

All of the callers of khash_sha1 and khash_sha1_pos have been removed,
in favor of using maps that use "struct object_id" as their keys. Let's
drop these now-obsolete types.

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

pack-bitmap: convert khash_sha1 maps into kh_oid_mapJeff King Thu, 20 Jun 2019 07:41:35 +0000 (03:41 -0400)

pack-bitmap: convert khash_sha1 maps into kh_oid_map

All of the users of our khash_sha1 maps actually have a "struct
object_id". Let's use the more descriptive type.

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

delta-islands: convert island_marks khash to use oidsJeff King Thu, 20 Jun 2019 07:41:32 +0000 (03:41 -0400)

delta-islands: convert island_marks khash to use oids

All of the users of this map have an actual "struct object_id" rather
than a bare sha1. Let's use the more descriptive type (and get one step
closer to dropping khash_sha1 entirely).

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

khash: rename kh_oid_t to kh_oid_setJeff King Thu, 20 Jun 2019 07:41:28 +0000 (03:41 -0400)

khash: rename kh_oid_t to kh_oid_set

khash lets us define a hash as either a map or a set (i.e., with no
"value" type). For the oid maps we define, "oid" is the set and
"oid_map" is the map. As the bug in the previous commit shows, it's easy
to pick the wrong one.

So let's make the names more distinct: "oid_set" and "oid_map".

An alternative naming scheme would be to actually name the type after
the key/value types. So e.g., "oid" _would_ be the set, since it has no
value type. And "oid_map" would become "oid_void" or similar (and
"oid_pos" becomes "oid_int"). That's better in some ways: it's more
regular, and a given map type can be more reasily reused in multiple
contexts (e.g., something storing an "int" that isn't a "pos"). But it's
also slightly less descriptive.

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

khash: drop broken oid_map typedefJeff King Thu, 20 Jun 2019 07:41:25 +0000 (03:41 -0400)

khash: drop broken oid_map typedef

Commit 5a8643eff1 (khash: move oid hash table definition, 2019-02-19)
added a khash "oid_map" type to match the existing "oid" type, which is
a simple set (i.e., just keys, no values). But in setting up the
khash_oid_map typedef, it accidentally referred to "kh_oid_t", which is
the set type.

Nobody noticed the breakage because there are not yet any callers; the
type was added just as a match to the existing sha1 types (whose map
type confusingly _is_ called khash_sha1, and it has no matching set
type).

We could easily fix this with s/oid/oid_map/ in the typedef. But let's
take this a step further, and just drop the typedef entirely. These
typedefs were added by 5a8643eff1 to match the khash_sha1 typedefs. But
the actual khash-derived type names are descriptive enough; this is just
adding an extra layer of indirection. The khash names do not quite
follow our usual style (e.g., they end in "_t"), but since we end up
using other khash names (e.g., khiter_t, kh_get_oid()) anyway, just
typedef-ing the struct name is not really helping much.

And there are already many cases where we use the raw khash type names
anyway (e.g., the "set" variant defined just above us does not have such
a typedef!).

So let's drop this typedef, and the matching oid_pos one (which actually
_does_ have a user, but we can easily convert it).

We'll leave the khash_sha1 typedef around. The ultimate fate of its
callers should be conversion to kh_oid_map_t, so there's no point in
going through the noise of changing the names now.

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

object: convert create_object() to use object_idJeff King Thu, 20 Jun 2019 07:41:21 +0000 (03:41 -0400)

object: convert create_object() to use object_id

There are no callers left of create_object() that aren't just passing us
the "hash" member of a "struct object_id". Let's take the whole struct,
which gets us closer to removing all raw sha1 variables.

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

object: convert internal hash_obj() to object_idJeff King Thu, 20 Jun 2019 07:41:17 +0000 (03:41 -0400)

object: convert internal hash_obj() to object_id

Now that lookup_object() has an object_id, we can consistently pass that
around instead of a raw sha1. We still convert to a hash to pass to
sha1hash(), but the goal is for that to go away shortly.

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

object: convert lookup_object() to use object_idJeff King Thu, 20 Jun 2019 07:41:14 +0000 (03:41 -0400)

object: convert lookup_object() to use object_id

There are no callers left of lookup_object() that aren't just passing us
the "hash" member of a "struct object_id". Let's take the whole struct,
which gets us closer to removing all raw sha1 variables. It also
matches the existing conversions of lookup_blob(), etc.

The conversions of callers were done by hand, but they're all mechanical
one-liners.

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

object: convert lookup_unknown_object() to use object_idJeff King Thu, 20 Jun 2019 07:41:10 +0000 (03:41 -0400)

object: convert lookup_unknown_object() to use object_id

There are no callers left of lookup_unknown_object() that aren't just
passing us the "hash" member of a "struct object_id". Let's take the
whole struct, which gets us closer to removing all raw sha1 variables.
It also matches the existing conversions of lookup_blob(), etc.

The conversions of callers were done by hand, but they're all mechanical
one-liners.

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

pack-objects: convert locate_object_entry_hash() to... Jeff King Thu, 20 Jun 2019 07:41:07 +0000 (03:41 -0400)

pack-objects: convert locate_object_entry_hash() to object_id

There are no callers of locate_object_entry_hash() that aren't just
passing us the "hash" member of a "struct object_id". Let's take the
whole struct, which gets us closer to removing all raw sha1 variables.

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

pack-objects: convert packlist_find() to use object_idJeff King Thu, 20 Jun 2019 07:41:03 +0000 (03:41 -0400)

pack-objects: convert packlist_find() to use object_id

We take a raw hash pointer, but most of our callers have a "struct
object_id" already. Let's switch to taking the full struct, which will
let us continue removing uses of raw sha1 buffers.

There are two callers that do need special attention:

- in rebuild_existing_bitmaps(), we need to switch to
nth_packed_object_oid(). This incurs an extra hash copy over
pointing straight to the mmap'd sha1, but it shouldn't be measurable
compared to the rest of the operation.

- in can_reuse_delta() we already spent the effort to copy the sha1
into a "struct object_id", but now we just have to do so a little
earlier in the function (we can't easily convert that function's
callers because they may be pointing at mmap'd REF_DELTA blocks).

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

pack-bitmap-write: convert some helpers to use object_idJeff King Thu, 20 Jun 2019 07:40:59 +0000 (03:40 -0400)

pack-bitmap-write: convert some helpers to use object_id

A few functions take raw hash pointers, but all of their callers
actually have a "struct object_id". Let's retain that extra type as long
as possible (which will let future patches extend that further, and so
on).

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

upload-pack: rename a "sha1" variable to "oid"Jeff King Thu, 20 Jun 2019 07:40:54 +0000 (03:40 -0400)

upload-pack: rename a "sha1" variable to "oid"

This variable is a "struct object_id", but uses the old-style name
"sha1". Let's call it oid to match more modern code (and make it clear
that it can handle any algorithm, since it uses parse_oid_hex()
properly).

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

describe: fix accidental oid/hash type-punningJeff King Thu, 20 Jun 2019 07:40:50 +0000 (03:40 -0400)

describe: fix accidental oid/hash type-punning

The find_commit_name() function passes an object_id.hash as the key of a
hashmap. That ends up in commit_name_neq(), which then feeds it to
oideq(). Which means we should actually be the whole "struct object_id".

It works anyway because pointers to the two are interchangeable. And
because we're going through a layer of void pointers, the compiler
doesn't notice the type mismatch.

But it's worth cleaning up (especially since once we switch away from
sha1hash() on the same line, accessing the hash member will look doubly
out of place).

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

fetch: only run 'gc' once when fetching multiple remotesNguyễn Thái Ngọc Duy Wed, 19 Jun 2019 09:46:30 +0000 (16:46 +0700)

fetch: only run 'gc' once when fetching multiple remotes

In multiple remotes mode, git-fetch is launched for n-1 remotes and the
last remote is handled by the current process. Each of these processes
will in turn run 'gc' at the end.

This is not really a problem because even if multiple 'gc --auto' is run
at the same time we still handle it correctly. It does show multiple
"auto packing in the background" messages though. And we may waste some
resources when gc actually runs because we still do some stuff before
checking the lock and moving it to background.

So let's try to avoid that. We should only need one 'gc' run after all
objects and references are added anyway. Add a new option --no-auto-gc
that will be used by those n-1 processes. 'gc --auto' will always run on
the main fetch process (*).

(*) even if we fetch remotes in parallel at some point in future, this
should still be fine because we should "join" all those processes
before this step.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: fix show referencing stash indexThomas Gummerer Sat, 15 Jun 2019 11:26:18 +0000 (12:26 +0100)

stash: fix show referencing stash index

In the conversion of 'stash show' to C in dc7bd382b1 ("stash: convert
show to builtin", 2019-02-25), 'git stash show <n>', where n is the
index of a stash got broken, if n is not a file or a valid revision by
itself.

'stash show' accepts any flag 'git diff' accepts for changing the
output format. Internally we use 'setup_revisions()' to parse these
command line flags. Currently we pass the whole argv through to
'setup_revisions()', which includes the stash index.

As the stash index is not a valid revision or a file in the working
tree in most cases however, this 'setup_revisions()' call (and thus
the whole command) ends up failing if we use this form of 'git stash
show'.

Instead of passing the whole argv to 'setup_revisions()', only pass
the flags (and the command name) through, while excluding the stash
reference. The stash reference is parsed (and validated) in
'get_stash_info()' already.

This separate parsing also means that we currently do produce the
correct output if the command succeeds.

Reported-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: sort detached HEAD lines firstlyMatthew DeVore Tue, 18 Jun 2019 22:29:15 +0000 (15:29 -0700)

ref-filter: sort detached HEAD lines firstly

Before this patch, "git branch" would put "(HEAD detached...)" and "(no
branch, rebasing...)" lines before all the other branches *in most
cases* except for when using Chinese-language messages. zh_CN generally
uses a full-width "(" symbol (codepoint FF08) to match the full-width
proportions of Chinese characters, and the translated strings we had did
use them. This meant that the detached HEAD line would appear after all
local refs and even after the remote refs if there were any.

AFAIK, it is sometimes not jarring to see the half-width parenthesis in
"full-width" text as in the CJK languages, for instance when there are
no characters preceding or following the parenthesized text fragment. By
removing the parenthesis from the localizable text, we can share strings
with wt-status.c and remove a cautionary comment to translators.

Remove the ( from the localizable portion of messages so the sorting
happens properly regardless of locale.

Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Matthew DeVore <matvore@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wrapper: avoid undefined behaviour in macOSCarlo Marcelo Arenas Belón Sun, 16 Jun 2019 18:40:03 +0000 (11:40 -0700)

wrapper: avoid undefined behaviour in macOS

0620b39b3b ("compat: add a mkstemps() compatibility function", 2009-05-31)
included a function based on code from libiberty which would result in
undefined behaviour in platforms where timeval's tv_usec is a 32-bit signed
type as shown by:

wrapper.c:505:31: runtime error: left shift of 594546 by 16 places cannot be represented in type '__darwin_suseconds_t' (aka 'int')

interestingly the version of this code from gcc never had this bug and the
code had a cast that would had prevented the issue (at least in 64-bit
platforms) but was misapplied.

change the cast to uint64_t so it also works in 32-bit platforms.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

interpret-trailers: load default configJeff King Wed, 19 Jun 2019 03:37:28 +0000 (23:37 -0400)

interpret-trailers: load default config

The interpret-trailers program does not do the usual loading of config
via git_default_config(), and thus does not respect many of the usual
options. In particular, we will not load core.commentChar, even though
the underlying trailer code uses its value.

This can be seen in the accompanying test, where setting
core.commentChar to anything besides "#" results in a failure to treat
the comments correctly.

Reported-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

show --continue/skip etc. consistently in synopsisPhillip Wood Mon, 17 Jun 2019 09:17:09 +0000 (10:17 +0100)

show --continue/skip etc. consistently in synopsis

Command mode options that the user can choose one among many are
listed like this in the documentation:

git am (--continue | --skip | --abort | --quit)

They are listed on a single line and in parenthesis, because they
are not optional.

But documentation pages for some commands deviate from this norm.
Fix the merge and rebase docs to match this style.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

use COPY_ARRAY for copying arraysRené Scharfe Sat, 15 Jun 2019 18:36:35 +0000 (20:36 +0200)

use COPY_ARRAY for copying arrays

Convert calls of memcpy(3) to use COPY_ARRAY, which shortens and
simplifies the code a bit.

Patch generated by Coccinelle and contrib/coccinelle/array.cocci.

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

coccinelle: use COPY_ARRAY for copying arraysRené Scharfe Sat, 15 Jun 2019 18:32:58 +0000 (20:32 +0200)

coccinelle: use COPY_ARRAY for copying arrays

The current semantic patch for COPY_ARRAY transforms memcpy(3) calls on
pointers, but Coccinelle distinguishes them from arrays. It already
contains three rules to handle the options for sizeof (i.e. source,
destination and type), and handling arrays as source and destination
would require four times as many rules if we enumerated all cases.

We also don't handle array subscripts, and supporting that would
increase the number of rules by another factor of four. (An isomorphism
telling Coccinelle that "sizeof x[...]" is equivalent to "sizeof *x"
would be nice..)

Support arrays and array subscripts, but keep the number of rules down
by adding normalization steps: First turn array subscripts into
derefences, then determine the types of expressions used with sizeof and
replace them with these types, and then convert the different possible
combinations of arrays and pointers with memcpy(3) to COPY_ARRAY.

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

fsmonitor: avoid signed integer overflow / infinite... Carlo Marcelo Arenas Belón Sat, 15 Jun 2019 16:11:35 +0000 (09:11 -0700)

fsmonitor: avoid signed integer overflow / infinite loop

883e248b8a ("fsmonitor: teach git to optionally utilize a file system
monitor to speed up detecting new or changed files.", 2017-09-22) uses
an int in a loop that would wrap if index_state->cache_nr (unsigned)
is bigger than INT_MAX

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

The second batchJunio C Hamano Mon, 17 Jun 2019 17:16:10 +0000 (10:16 -0700)

The second batch

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

Merge branch 'xl/record-partial-clone-origin'Junio C Hamano Mon, 17 Jun 2019 17:15:20 +0000 (10:15 -0700)

Merge branch 'xl/record-partial-clone-origin'

When creating a partial clone, the object filtering criteria is
recorded for the origin of the clone, but this incorrectly used a
hardcoded name "origin" to name that remote; it has been corrected
to honor the "--origin <name>" option.

* xl/record-partial-clone-origin:
clone: respect user supplied origin name when setting up partial clone

Merge branch 'pb/request-pull-verify-remote-ref'Junio C Hamano Mon, 17 Jun 2019 17:15:20 +0000 (10:15 -0700)

Merge branch 'pb/request-pull-verify-remote-ref'

"git request-pull" learned to warn when the ref we ask them to pull
from in the local repository and in the published repository are
different.

* pb/request-pull-verify-remote-ref:
request-pull: warn if the remote object is not the same as the local one
request-pull: quote regex metacharacters in local ref

Merge branch 'mm/p4-unshelve-windows-fix'Junio C Hamano Mon, 17 Jun 2019 17:15:19 +0000 (10:15 -0700)

Merge branch 'mm/p4-unshelve-windows-fix'

The command line to invoke a "git cat-file" command from inside
"git p4" was not properly quoted to protect a caret and running a
broken command on Windows, which has been corrected.

* mm/p4-unshelve-windows-fix:
p4 unshelve: fix "Not a valid object name HEAD0" on Windows

Merge branch 'po/git-help-on-git-itself'Junio C Hamano Mon, 17 Jun 2019 17:15:19 +0000 (10:15 -0700)

Merge branch 'po/git-help-on-git-itself'

"git help git" was hard to discover (well, at least for some
people).

* po/git-help-on-git-itself:
Doc: git.txt: remove backticks from link and add git-scm.com/docs
git.c: show usage for accessing the git(1) help page

Merge branch 'es/first-contrib-tutorial'Junio C Hamano Mon, 17 Jun 2019 17:15:18 +0000 (10:15 -0700)

Merge branch 'es/first-contrib-tutorial'

A new tutorial targetting specifically aspiring git-core
developers.

* es/first-contrib-tutorial:
doc: add some nit fixes to MyFirstContribution
documentation: add anchors to MyFirstContribution
documentation: add tutorial for first contribution

Merge branch 'bb/unicode-12.1-reiwa'Junio C Hamano Mon, 17 Jun 2019 17:15:18 +0000 (10:15 -0700)

Merge branch 'bb/unicode-12.1-reiwa'

Update to Unicode 12.1 width table.

* bb/unicode-12.1-reiwa:
unicode: update the width tables to Unicode 12.1

Merge branch 'sw/git-p4-unshelve-branched-files'Junio C Hamano Mon, 17 Jun 2019 17:15:18 +0000 (10:15 -0700)

Merge branch 'sw/git-p4-unshelve-branched-files'

"git p4" update.

* sw/git-p4-unshelve-branched-files:
git-p4: allow unshelving of branched files

Merge branch 'js/fsmonitor-unflake'Junio C Hamano Mon, 17 Jun 2019 17:15:17 +0000 (10:15 -0700)

Merge branch 'js/fsmonitor-unflake'

The data collected by fsmonitor was not properly written back to
the on-disk index file, breaking t7519 tests occasionally, which
has been corrected.

* js/fsmonitor-unflake:
mark_fsmonitor_valid(): mark the index as changed if needed
fill_stat_cache_info(): prepare for an fsmonitor fix

Merge branch 'ds/topo-traversal-using-commit-graph'Junio C Hamano Mon, 17 Jun 2019 17:15:17 +0000 (10:15 -0700)

Merge branch 'ds/topo-traversal-using-commit-graph'

Prepare use of reachability index in topological walker that works
on a range (A..B).

* ds/topo-traversal-using-commit-graph:
revision: keep topo-walk free of unintersting commits
revision: use generation for A..B --topo-order queries

Merge branch 'bl/userdiff-octave'Junio C Hamano Mon, 17 Jun 2019 17:15:17 +0000 (10:15 -0700)

Merge branch 'bl/userdiff-octave'

The pattern "git diff/grep" use to extract funcname and words
boundary for Matlab has been extend to cover Octave, which is more
or less equivalent.

* bl/userdiff-octave:
userdiff: fix grammar and style issues
userdiff: add Octave

Merge branch 'ba/clone-remote-submodules'Junio C Hamano Mon, 17 Jun 2019 17:15:17 +0000 (10:15 -0700)

Merge branch 'ba/clone-remote-submodules'

"git clone --recurse-submodules" learned to set up the submodules
to ignore commit object names recorded in the superproject gitlink
and instead use the commits that happen to be at the tip of the
remote-tracking branches from the get-go, by passing the new
"--remote-submodules" option.

* ba/clone-remote-submodules:
clone: add `--remote-submodules` flag