]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
4 years agoMerge 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

4 years agoMerge 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 `

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

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

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

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

4 years agotrace2: correct typo in technical documentation
Carlo 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>
4 years agoconfig: simplify parsing of unit factors
René 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>
4 years agoconfig: 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>
4 years agoconfig: use unsigned_mult_overflows to check for overflows
René 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>
4 years agoThe third batch
Junio 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>
4 years agoMerge 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

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

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

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

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

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

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

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

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

4 years agodelta-islands: respect progress flag
Jeff 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>
4 years agorev-list: teach --no-object-names to enable piping
Emily 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>
4 years agofetch: only run 'gc' once when fetching multiple remotes
Nguyễ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>
4 years agostash: fix show referencing stash index
Thomas 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>
4 years agoref-filter: sort detached HEAD lines firstly
Matthew 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>
4 years agowrapper: avoid undefined behaviour in macOS
Carlo 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>
4 years agointerpret-trailers: load default config
Jeff 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>
4 years agoshow --continue/skip etc. consistently in synopsis
Phillip 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>
4 years agouse COPY_ARRAY for copying arrays
René 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>
4 years agococcinelle: use COPY_ARRAY for copying arrays
René 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>
4 years agofsmonitor: avoid signed integer overflow / infinite loop
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>
4 years agoThe second batch
Junio 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>
4 years agoMerge 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

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

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

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

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

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

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

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

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

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

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

4 years agoMerge branch 'vv/merge-squash-with-explicit-commit'
Junio C Hamano [Mon, 17 Jun 2019 17:15:17 +0000 (10:15 -0700)] 
Merge branch 'vv/merge-squash-with-explicit-commit'

"git merge --squash" is designed to update the working tree and the
index without creating the commit, and this cannot be countermanded
by adding the "--commit" option; the command now refuses to work
when both options are given.

* vv/merge-squash-with-explicit-commit:
  merge: refuse --commit with --squash

4 years agoMerge branch 'js/bundle-verify-require-object-store'
Junio C Hamano [Mon, 17 Jun 2019 17:15:16 +0000 (10:15 -0700)] 
Merge branch 'js/bundle-verify-require-object-store'

"git bundle verify" needs to see if prerequisite objects exist in
the receiving repository, but the command did not check if we are
in a repository upfront, which has been corrected.

* js/bundle-verify-require-object-store:
  bundle verify: error out if called without an object database

4 years agoMerge branch 'js/bisect-helper-check-get-oid-return-value'
Junio C Hamano [Mon, 17 Jun 2019 17:15:16 +0000 (10:15 -0700)] 
Merge branch 'js/bisect-helper-check-get-oid-return-value'

Code cleanup.

* js/bisect-helper-check-get-oid-return-value:
  bisect--helper: verify HEAD could be parsed before continuing

4 years agoMerge branch 'jk/am-i-resolved-fix'
Junio C Hamano [Mon, 17 Jun 2019 17:15:15 +0000 (10:15 -0700)] 
Merge branch 'jk/am-i-resolved-fix'

"git am -i --resolved" segfaulted after trying to see a commit as
if it were a tree, which has been corrected.

* jk/am-i-resolved-fix:
  am: fix --interactive HEAD tree resolution
  am: drop tty requirement for --interactive
  am: read interactive input from stdin
  am: simplify prompt response handling

4 years agoMerge branch 'jk/HEAD-symref-in-xfer-namespaces'
Junio C Hamano [Mon, 17 Jun 2019 17:15:15 +0000 (10:15 -0700)] 
Merge branch 'jk/HEAD-symref-in-xfer-namespaces'

The server side support for "git fetch" used to show incorrect
value for the HEAD symbolic ref when the namespace feature is in
use, which has been corrected.

* jk/HEAD-symref-in-xfer-namespaces:
  upload-pack: strip namespace from symref data

4 years agoMerge branch 'ew/server-info-remove-crufts'
Junio C Hamano [Mon, 17 Jun 2019 17:15:15 +0000 (10:15 -0700)] 
Merge branch 'ew/server-info-remove-crufts'

"git update-server-info" used to leave stale packfiles in its
output, which has been corrected.

* ew/server-info-remove-crufts:
  server-info: do not list unlinked packs

4 years agoMerge branch 'es/grep-require-name-when-needed'
Junio C Hamano [Mon, 17 Jun 2019 17:15:14 +0000 (10:15 -0700)] 
Merge branch 'es/grep-require-name-when-needed'

More parameter validation.

* es/grep-require-name-when-needed:
  grep: fail if call could output and name is null

4 years agoMerge branch 'es/git-debugger-doc'
Junio C Hamano [Mon, 17 Jun 2019 17:15:14 +0000 (10:15 -0700)] 
Merge branch 'es/git-debugger-doc'

Doc update.

* es/git-debugger-doc:
  doc: hint about GIT_DEBUGGER in CodingGuidelines

4 years agoMerge branch 'ds/object-info-for-prefetch-fix'
Junio C Hamano [Mon, 17 Jun 2019 17:15:14 +0000 (10:15 -0700)] 
Merge branch 'ds/object-info-for-prefetch-fix'

Code cleanup and futureproof.

* ds/object-info-for-prefetch-fix:
  sha1-file: split OBJECT_INFO_FOR_PREFETCH

4 years agot3404: fix a typo
Johannes Schindelin [Fri, 14 Jun 2019 12:16:08 +0000 (05:16 -0700)] 
t3404: fix a typo

This one slipped through the review of a9279c678588 (sequencer: do not
squash 'reword' commits when we hit conflicts, 2018-06-19).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoThe first batch after 2.22
Junio C Hamano [Thu, 13 Jun 2019 20:23:03 +0000 (13:23 -0700)] 
The first batch after 2.22

Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoMerge branch 'pw/rebase-edit-message-for-replayed-merge'
Junio C Hamano [Thu, 13 Jun 2019 20:19:43 +0000 (13:19 -0700)] 
Merge branch 'pw/rebase-edit-message-for-replayed-merge'

A "merge -c" instruction during "git rebase --rebase-merges" should
give the user a chance to edit the log message, even when there is
otherwise no need to create a new merge and replace the existing
one (i.e. fast-forward instead), but did not.  Which has been
corrected.

* pw/rebase-edit-message-for-replayed-merge:
  rebase -r: always reword merge -c

4 years agoMerge branch 'ab/deprecate-R-for-dynpath'
Junio C Hamano [Thu, 13 Jun 2019 20:19:43 +0000 (13:19 -0700)] 
Merge branch 'ab/deprecate-R-for-dynpath'

The way of specifying the path to find dynamic libraries at runtime
has been simplified.  The old default to pass -R/path/to/dir has been
replaced with the new default to pass -Wl,-rpath,/path/to/dir,
which is the more recent GCC uses.  Those who need to build with an
old GCC can still use "CC_LD_DYNPATH=-R"

* ab/deprecate-R-for-dynpath:
  Makefile: remove the NO_R_TO_GCC_LINKER flag

4 years agoMerge branch 'mh/import-transport-fd-fix'
Junio C Hamano [Thu, 13 Jun 2019 20:19:43 +0000 (13:19 -0700)] 
Merge branch 'mh/import-transport-fd-fix'

The ownership rule for the file descriptor to fast-import remote
backend was mixed up, leading to unrelated file descriptor getting
closed, which has been fixed.

* mh/import-transport-fd-fix:
  Use xmmap_gently instead of xmmap in use_pack
  dup() the input fd for fast-import used for remote helpers

4 years agoMerge branch 'ew/update-server-info'
Junio C Hamano [Thu, 13 Jun 2019 20:19:42 +0000 (13:19 -0700)] 
Merge branch 'ew/update-server-info'

"git update-server-info" learned not to rewrite the file with the
same contents.

* ew/update-server-info:
  update-server-info: avoid needless overwrites

4 years agoMerge branch 'jk/help-unknown-ref-fix'
Junio C Hamano [Thu, 13 Jun 2019 20:19:42 +0000 (13:19 -0700)] 
Merge branch 'jk/help-unknown-ref-fix'

Improve the code to show args with potential typo that cannot be
interpreted as a commit-ish.

* jk/help-unknown-ref-fix:
  help_unknown_ref(): check for refname ambiguity
  help_unknown_ref(): duplicate collected refnames

4 years agoMerge branch 'dl/format-patch-notes-config'
Junio C Hamano [Thu, 13 Jun 2019 20:19:42 +0000 (13:19 -0700)] 
Merge branch 'dl/format-patch-notes-config'

"git format-patch" learns a configuration to set the default for
its --notes=<ref> option.

* dl/format-patch-notes-config:
  format-patch: teach format.notes config option
  git-format-patch.txt: document --no-notes option

4 years agoMerge branch 'nd/merge-quit'
Junio C Hamano [Thu, 13 Jun 2019 20:19:41 +0000 (13:19 -0700)] 
Merge branch 'nd/merge-quit'

"git merge" learned "--quit" option that cleans up the in-progress
merge while leaving the working tree and the index still in a mess.

* nd/merge-quit:
  merge: add --quit
  merge: remove drop_save() in favor of remove_merge_branch_state()

4 years agoMerge branch 'ab/fail-prereqs-in-test'
Junio C Hamano [Thu, 13 Jun 2019 20:19:41 +0000 (13:19 -0700)] 
Merge branch 'ab/fail-prereqs-in-test'

Developer support to emulate unsatisfied prerequisites in tests to
ensure that the remainer of the tests still succeeds when tests
with prerequisites are skipped.

* ab/fail-prereqs-in-test:
  tests: add a special setup where prerequisites fail

4 years agoMerge branch 'nd/corrupt-worktrees'
Junio C Hamano [Thu, 13 Jun 2019 20:19:41 +0000 (13:19 -0700)] 
Merge branch 'nd/corrupt-worktrees'

"git worktree add" used to fail when another worktree connected to
the same repository was corrupt, which has been corrected.

* nd/corrupt-worktrees:
  worktree add: be tolerant of corrupt worktrees

4 years agoMerge branch 'js/rebase-cleanup'
Junio C Hamano [Thu, 13 Jun 2019 20:19:40 +0000 (13:19 -0700)] 
Merge branch 'js/rebase-cleanup'

Update supporting parts of "git rebase" to remove code that should
no longer be used.

* js/rebase-cleanup:
  rebase: fold git-rebase--common into the -p backend
  sequencer: the `am` and `rebase--interactive` scripts are gone
  .gitignore: there is no longer a built-in `git-rebase--interactive`
  t3400: stop referring to the scripted rebase
  Drop unused git-rebase--am.sh

4 years agoMerge branch 'nd/worktree-name-sanitization'
Junio C Hamano [Thu, 13 Jun 2019 20:19:40 +0000 (13:19 -0700)] 
Merge branch 'nd/worktree-name-sanitization'

In recent versions of Git, per-worktree refs are exposed in
refs/worktrees/<wtname>/ hierarchy, which means that worktree names
must be a valid refname component.  The code now sanitizes the names
given to worktrees, to make sure these refs are well-formed.

* nd/worktree-name-sanitization:
  worktree add: sanitize worktree names

4 years agoMerge branch 'en/fast-export-encoding'
Junio C Hamano [Thu, 13 Jun 2019 20:19:39 +0000 (13:19 -0700)] 
Merge branch 'en/fast-export-encoding'

The "git fast-export/import" pair has been taught to handle commits
with log messages in encoding other than UTF-8 better.

* en/fast-export-encoding:
  fast-export: do automatic reencoding of commit messages only if requested
  fast-export: differentiate between explicitly UTF-8 and implicitly UTF-8
  fast-export: avoid stripping encoding header if we cannot reencode
  fast-import: support 'encoding' commit header
  t9350: fix encoding test to actually test reencoding

4 years agoMerge branch 'jk/unused-params-final-batch'
Junio C Hamano [Thu, 13 Jun 2019 20:19:34 +0000 (13:19 -0700)] 
Merge branch 'jk/unused-params-final-batch'

* jk/unused-params-final-batch:
  verify-commit: simplify parameters to run_gpg_verify()
  show-branch: drop unused parameter from show_independent()
  rev-list: drop unused void pointer from finish_commit()
  remove_all_fetch_refspecs(): drop unused "remote" parameter
  receive-pack: drop unused "commands" from prepare_shallow_update()
  pack-objects: drop unused rev_info parameters
  name-rev: drop unused parameters from is_better_name()
  mktree: drop unused length parameter
  wt-status: drop unused status parameter
  read-cache: drop unused parameter from threaded load
  clone: drop dest parameter from copy_alternates()
  submodule: drop unused prefix parameter from some functions
  builtin: consistently pass cmd_* prefix to parse_options
  cmd_{read,write}_tree: rename "unused" variable that is used

4 years agoMerge branch 'sb/format-patch-base-patch-id-fix'
Junio C Hamano [Thu, 13 Jun 2019 20:18:46 +0000 (13:18 -0700)] 
Merge branch 'sb/format-patch-base-patch-id-fix'

The "--base" option of "format-patch" computed the patch-ids for
prerequisite patches in an unstable way, which has been updated to
compute in a way that is compatible with "git patch-id --stable".

* sb/format-patch-base-patch-id-fix:
  format-patch: make --base patch-id output stable
  format-patch: inform user that patch-id generation is unstable

4 years agoMerge branch 'nd/init-relative-template-fix'
Junio C Hamano [Thu, 13 Jun 2019 20:18:46 +0000 (13:18 -0700)] 
Merge branch 'nd/init-relative-template-fix'

A relative pathname given to "git init --template=<path> <repo>"
ought to be relative to the directory "git init" gets invoked in,
but it instead was made relative to the repository, which has been
corrected.

* nd/init-relative-template-fix:
  init: make --template path relative to $CWD

4 years agoMerge branch 'ab/send-email-transferencoding-fix'
Junio C Hamano [Thu, 13 Jun 2019 20:18:46 +0000 (13:18 -0700)] 
Merge branch 'ab/send-email-transferencoding-fix'

Since "git send-email" learned to take 'auto' as the value for the
transfer-encoding, it by mistake stopped honoring the values given
to the configuration variables sendemail.transferencoding and/or
sendemail.<ident>.transferencoding.  This has been corrected to
(finally) redoing the order of setting the default, reading the
configuration and command line options.

* ab/send-email-transferencoding-fix:
  send-email: fix regression in sendemail.identity parsing
  send-email: document --no-[to|cc|bcc]
  send-email: fix broken transferEncoding tests
  send-email: remove cargo-culted multi-patch pattern in tests
  send-email: do defaults -> config -> getopt in that order
  send-email: rename the @bcclist variable for consistency
  send-email: move the read_config() function above getopts

4 years agocleanup: fix possible overflow errors in binary search, part 2
René Scharfe [Thu, 13 Jun 2019 17:51:56 +0000 (19:51 +0200)] 
cleanup: fix possible overflow errors in binary search, part 2

Calculating the sum of two array indexes to find the midpoint between
them can overflow, i.e. code like this is unsafe for big arrays:

mid = (first + last) >> 1;

Make sure the intermediate value stays within the boundaries instead,
like this:

mid = first + ((last - first) >> 1);

The loop condition of the binary search makes sure that 'last' is
always greater than 'first', so this is safe as long as 'first' is
not negative.  And that can be verified easily using the pre-context
of each change, except for name-hash.c, so add an assertion to that
effect there.

The unsafe calculations were found with:

git grep '(.*+.*) *>> *1'

This is a continuation of 19716b21a4 (cleanup: fix possible overflow
errors in binary search, 2017-10-08).

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoadd -p: fix checkout -p with pathological context
Phillip Wood [Wed, 12 Jun 2019 09:25:27 +0000 (02:25 -0700)] 
add -p: fix checkout -p with pathological context

Commit fecc6f3a68 ("add -p: adjust offsets of subsequent hunks when one is
skipped", 2018-03-01) fixed adding hunks in the correct place when a
previous hunk has been skipped. However it did not address patches that
are applied in reverse. In that case we need to adjust the pre-image
offset so that when apply reverses the patch the post-image offset is
adjusted correctly. We subtract rather than add the delta as the patch
is reversed (the easiest way to think about it is to consider a hunk of
deletions that is skipped - in that case we want to reduce offset so we
need to subtract).

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agoconfig: avoid calling `labs()` on too-large data type
Johannes Schindelin [Thu, 13 Jun 2019 11:49:47 +0000 (04:49 -0700)] 
config: avoid calling `labs()` on too-large data type

The `labs()` function operates, as the initial `l` suggests, on `long`
parameters. However, in `config.c` we tried to use it on values of type
`intmax_t`.

This problem was found by GCC v9.x.

To fix it, let's just "unroll" the function (i.e. negate the value if it
is negative).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agowinansi: simplify loading the GetCurrentConsoleFontEx() function
Johannes Schindelin [Thu, 13 Jun 2019 11:49:46 +0000 (04:49 -0700)] 
winansi: simplify loading the GetCurrentConsoleFontEx() function

We introduced helper macros to simplify loading functions dynamically.
Might just as well use them.

This also side-steps a compiler warning when building with GCC v8.x: it
would complain about casting between incompatible function pointers.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agokwset: allow building with GCC 8
Johannes Schindelin [Thu, 13 Jun 2019 11:49:45 +0000 (04:49 -0700)] 
kwset: allow building with GCC 8

The kwset functionality makes use of the obstack code, which expects to
be handed a function that can allocate large chunks of data. It expects
that function to accept a `size` parameter of type `long`.

This upsets GCC 8 on Windows, because `long` does not have the same
bit size as `size_t` there.

Now, the proper thing to do would be to switch to `size_t`. But this
would make us deviate from the "upstream" code even further, making it
hard to synchronize with newer versions, and also it would be quite
involved because that `long` type is so invasive in that code.

Let's punt, and instead provide a super small wrapper around
`xmalloc()`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agopoll (mingw): allow compiling with GCC 8 and DEVELOPER=1
Johannes Schindelin [Thu, 13 Jun 2019 11:49:44 +0000 (04:49 -0700)] 
poll (mingw): allow compiling with GCC 8 and DEVELOPER=1

The return type of the `GetProcAddress()` function is `FARPROC` which
evaluates to `long long int (*)()`, i.e. it cannot be cast to the
correct function signature by GCC 8.

To work around that, we first cast to `void *` and go on with our merry
lives.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
4 years agomergetool: use shell variable magic instead of `awk`
Johannes Sixt [Wed, 12 Jun 2019 16:33:48 +0000 (18:33 +0200)] 
mergetool: use shell variable magic instead of `awk`

git-mergetool spawns an enormous amount of processes. For this reason,
the test script, t7610, is exceptionally slow, in particular, on
Windows. Most of the processes are invocations of git. There are
also some that can be replaced with shell builtins. Avoid repeated
calls of `git ls-files` and `awk`.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>