git/git.git
2 years agotest-lib: introduce 'test_atexit'
Johannes Schindelin [Wed, 13 Mar 2019 12:24:11 +0000 (13:24 +0100)]
test-lib: introduce 'test_atexit'

When running Apache, 'git daemon', or p4d, we want to kill them at the
end of the test script, otherwise a leftover daemon process will keep
its port open indefinitely, and thus will interfere with subsequent
executions of the same test script.

So far, we stop these daemon processes "manually", i.e.:

  - by registering functions or commands in the trap on EXIT to stop
    the daemon while preserving the last seen exit code before the
    trap (to deal with a failure when run with '--immediate' or with
    interrupts by ctrl-C),

  - and by invoking these functions/commands last thing before
    'test_done' (and sometimes restoring the test framework's default
    trap on EXIT, to prevent the daemons from being killed twice).

On one hand, we do this inconsistently, e.g. 'git p4' tests invoke
different functions in the trap on EXIT and in the last test before
'test_done', and they neither restore the test framework's default trap
on EXIT nor preserve the last seen exit code.  On the other hand, this
is error prone, because, as shown in a previous patch in this series,
any output from the cleanup commands in the trap on EXIT can prevent a
proper cleanup when a test script run with '--verbose-log' and certain
shells, notably 'dash', is interrupted.

Let's introduce 'test_atexit', which is loosely modeled after
'test_when_finished', but has a broader scope: rather than running the
commands after the current test case, run them when the test script
finishes, and also run them when the test is interrupted, or exits
early in case of a failure while the '--immediate' option is in
effect.

When running the cleanup commands at the end of a successful test,
then they will be run in 'test_done' before it removes the trash
directory, i.e. the cleanup commands will still be able to access any
pidfiles or socket files in there.  When running the cleanup commands
after an interrupt or failure with '--immediate', then they will be
run in the trap on EXIT.  In both cases they will be run in
'test_eval_', i.e. both standard error and output of all cleanup
commands will go where they should according to the '-v' or
'--verbose-log' options, and thus won't cause any troubles when
interrupting a test script run with '--verbose-log'.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agot/lib-git-daemon: make sure to kill the 'git-daemon' process
SZEDER Gábor [Wed, 13 Mar 2019 12:24:10 +0000 (13:24 +0100)]
t/lib-git-daemon: make sure to kill the 'git-daemon' process

After 'start_git_daemon' starts 'git daemon' (note the space in the
middle) in the background, it saves the background process' PID, so
the daemon can be stopped at the end of the test script.  However,
'git-daemon' is not a builtin but a dashed external command, which
means that the dashless 'git daemon' executes the dashed 'git-daemon'
command, and, consequently, the PID recorded is not the PID of the
"real" daemon process, but that of the main 'git' wrapper.  Now, if a
test script involving 'git daemon' is interrupted by ctrl-C, then only
the main 'git' process is stopped, but the real daemon process tends
to survive somehow, and keeps on running in the background
indefinitely, keeping the daemon's port to itself, and thus preventing
subsequent runs of the same test script.

Work this around by running 'git daemon' with the '--pidfile=...'
option to save the PID of the real daemon process, and kill that
process in 'stop_git_daemon' as well.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotest-lib: fix interrupt handling with 'dash' and '--verbose-log -x'
SZEDER Gábor [Wed, 13 Mar 2019 12:24:09 +0000 (13:24 +0100)]
test-lib: fix interrupt handling with 'dash' and '--verbose-log -x'

When a test script run with 'dash' and '--verbose-log -x' is
interrupted by ctrl-C, SIGTERM, or closing the terminal window, then
most of the time the registered EXIT trap actions are not executed.
This is an annoying issue with tests involving daemons, because they
should run cleanup commands to kill those daemon processes in the trap
on EXIT, but since these cleanup commands are not executed, the
daemons are left alive and keep their port open, thus interfering with
subsequent execution of the same test script.

The cause of this issue is the subtle combination of several factors
(bear with me, or skip over the indented part):

  - Even when the test script is interrupted, the cleanup commands are
    not run in the trap on INT, TERM, or HUP, but in the trap on EXIT
    after the trap on the signals invokes 'exit' [1].

  - According to POSIX [2]:

      "The environment in which the shell executes a trap on EXIT
      shall be identical to the environment immediately after the last
      command executed before the trap on EXIT was taken."

    Pertinent to the issue at hand is that all open file descriptors
    and the state of '-x' tracing should be preserved.  All shells
    I've tried [3] preserve '-x'.  Unfortunately, however:

      - 'dash' doesn't conform to this when it comes to open file
        descriptors: even when standard output and/or error are
        redirected somewhere when 'exit' is invoked, anything written
        to them in the trap on EXIT goes to the script's original
        stdout and stderr [4].

        We can't dismiss this with a simple "it doesn't conform to
        POSIX, so we don't care", because 'dash' is the default
        /bin/sh in some of the more popular Linux distros.

      - As far as I can tell, POSIX doesn't explicitly say anything
        about the environment of trap actions for various signals.

        In practice it seems that most shells behave sensibly and
        preserve both open file descriptors and the state of '-x'
        tracing for the traps on INT, TERM, and HUP, including even
        'dash'.  The exceptions are 'mksh' and 'lksh': they do
        preserve '-x', but not the open file descriptors.

  - When a test script run with '-x' tracing enabled is interrupted,
    then it's very likely that the signal arrives mid-test, i.e.:

      - while '-x' tracing is enabled, and, consequently, our trap
        actions on INT, TERM, HUP, and EXIT will produce trace output
        as well.

      - while standard output and error are redirected to a log file,
        to the test script's original standard output and error, or to
        /dev/null, depending on whether the test script was run with
        '--verbose-log', '-v', or neither.  According to the above, we
        can't rely on these redirections still be in effect when
        running the traps on INT, TERM, HUP, and/or EXIT.

  - When a test script is run with '--verbose-log', then the test
    script is re-executed with its standard output and error piped
    into 'tee', in order to send the "regular" non-verbose test's
    output both to the terminal and to the log file.  When the test is
    interrupted, then the signal interrupts the downstream 'tee' as
    well.

Putting these together, when a test script run with 'dash' and
'--verbose-log -x' is interrupted, then 'dash' tries to write the
trace output from the EXIT trap to the script's original standard
error, but it very likely can't, because the 'tee' downstream of the
pipe is interrupted as well.  This causes the shell running the test
script to die because of SIGPIPE, without running any of the commands
in the EXIT trap.

Disable '-x' tracing in the trap on INT, TERM, and HUP to avoid this
issue, as it disables tracing in the chained trap on EXIT as well.
Wrap it in a '{ ... } 2>/dev/null' block, so the trace of the command
disabling the tracing doesn't go to standard error either [5].

Note that it's not only '-x' tracing that can be problematic, but any
shell builtin, e.g. 'echo', that writes to standard output or error in
the trap on EXIT, while a test running with 'dash' and '--verbose-log'
(even without '-x') is interrupted.  As far as I can tell, this is not
an issue at the moment:

 - The cleanup commands to stop the credential-helper, Apache, or
   'p4d' don't use any such shell builtins.

 - stop_git_daemon() does use 'say' and 'error', both wrappers around
   'echo', but it redirects 'say' to fd 3, i.e. to the log file, and
   while 'error' does write to standard output, it comes only after
   the daemon was killed.

 - The non-builtin commands that actually stop the daemons ('kill',
   'apache2 -k stop', 'git credential-cache exit') are silent, so they
   won't get SIGPIPE before finishing their job.

[1] The trap on EXIT must run cleanup commands, because we want to
    stop any daemons when a test script run with '--immediate' fails
    and exits early with error.  By chaining up the trap on signals to
    the trap on EXIT we can deal with cleanup commands a bit simpler,
    because the tests involving daemons only have to set a single
    trap.

[2] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#trap

[3] The shells I tried: dash, Bash, ksh, ksh93, mksh, lksh, yash,
    BusyBox sh, FreeBSD /bin/sh, NetBSD /bin/sh.

[4] $ cat trap-output.sh
    #!/bin/sh
    trap "echo output; echo error >&2" EXIT
    { exit; } >OUT 2>ERR
    $ dash ./trap-output.sh
    output
    error
    $ wc -c OUT ERR
    0 OUT
    0 ERR

    On a related note, 'ksh', 'ksh93', and BusyBox sh don't conform to
    the specs in this respect, either.

[5] This '{ set +x; } 2>/dev/null' trick won't help those shells that
    show trace output for any redirections and don't preserve open
    file descriptors for the trap on INT, TERM and HUP.  The only such
    shells I'm aware of are 'mksh' and 'lksh'.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoThe second batch
Junio C Hamano [Mon, 11 Mar 2019 07:18:22 +0000 (16:18 +0900)]
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoSync with maint
Junio C Hamano [Mon, 11 Mar 2019 07:16:34 +0000 (16:16 +0900)]
Sync with maint

* maint:
  mingw: allow building with an MSYS2 runtime v3.x

2 years agoMerge branch 'js/rebase-recreate-merge'
Junio C Hamano [Mon, 11 Mar 2019 07:16:26 +0000 (16:16 +0900)]
Merge branch 'js/rebase-recreate-merge'

Docfix.

* js/rebase-recreate-merge:
  rebase docs: fix "gitlink" typo

2 years agoMerge branch 'js/untravis-windows'
Junio C Hamano [Mon, 11 Mar 2019 07:16:26 +0000 (16:16 +0900)]
Merge branch 'js/untravis-windows'

Dev support.

* js/untravis-windows:
  travis: remove the hack to build the Windows job on Azure Pipelines

2 years agoMerge branch 'rd/gc-prune-doc-fix'
Junio C Hamano [Mon, 11 Mar 2019 07:16:26 +0000 (16:16 +0900)]
Merge branch 'rd/gc-prune-doc-fix'

Doxfix.

* rd/gc-prune-doc-fix:
  docs/git-gc: fix typo "--prune=all" to "--prune=now"

2 years agoMerge branch 'js/find-lib-h-with-ls-files-when-possible'
Junio C Hamano [Mon, 11 Mar 2019 07:16:25 +0000 (16:16 +0900)]
Merge branch 'js/find-lib-h-with-ls-files-when-possible'

The Makefile uses 'find' utility to enumerate all the *.h header
files, which is expensive on platforms with slow filesystems; it
now optionally uses "ls-files" if working within a repository,
which is a trick similar to how all sources are enumerated to run
ETAGS on.

* js/find-lib-h-with-ls-files-when-possible:
  Makefile: use `git ls-files` to list header files, if possible

2 years agoMerge branch 'rj/hdr-check-gcrypt-fix'
Junio C Hamano [Mon, 11 Mar 2019 07:16:25 +0000 (16:16 +0900)]
Merge branch 'rj/hdr-check-gcrypt-fix'

The set of header files used by "make hdr-check" unconditionally
included sha256/gcrypt.h, even when it is not used, causing the
make target to fail.  We now skip it when GCRYPT_SHA256 is not in
use.

* rj/hdr-check-gcrypt-fix:
  Makefile: fix 'hdr-check' when GCRYPT not installed

2 years agoMerge branch 'jk/guard-bswap-header'
Junio C Hamano [Mon, 11 Mar 2019 07:16:25 +0000 (16:16 +0900)]
Merge branch 'jk/guard-bswap-header'

The include file compat/bswap.h has been updated so that it is safe
to (accidentally) include it more than once.

* jk/guard-bswap-header:
  compat/bswap: add include header guards

2 years agoMerge branch 'rd/attr.c-comment-typofix'
Junio C Hamano [Mon, 11 Mar 2019 07:16:24 +0000 (16:16 +0900)]
Merge branch 'rd/attr.c-comment-typofix'

In-code comment typofix.

* rd/attr.c-comment-typofix:
  attr.c: ".gitattribute" -> ".gitattributes" (comments)

2 years agoMerge branch 'yb/utf-16le-bom-spellfix'
Junio C Hamano [Mon, 11 Mar 2019 07:16:24 +0000 (16:16 +0900)]
Merge branch 'yb/utf-16le-bom-spellfix'

Doc update.

* yb/utf-16le-bom-spellfix:
  gitattributes.txt: fix typo

2 years agomingw: allow building with an MSYS2 runtime v3.x
Johannes Schindelin [Fri, 8 Mar 2019 15:51:19 +0000 (07:51 -0800)]
mingw: allow building with an MSYS2 runtime v3.x

Recently the Git for Windows project started the upgrade process to
a MSYS2 runtime version based on Cygwin v3.x.

This has the very notable consequence that `$(uname -r)` no longer
reports a version starting with "2", but a version with "3".

That breaks our build, as df5218b4c30b (config.mak.uname: support MSys2,
2016-01-13) simply did not expect the version reported by `uname -r` to
depend on the underlying Cygwin version: it expected the reported
version to match the "2" in "MSYS2".

So let's invert that test case to test for *anything else* than a
version starting with "1" (for MSys). That should safeguard us for the
future, even if Cygwin ends up releasing versionsl like 314.272.65536.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agomingw: drop MakeMaker reference
Johannes Schindelin [Mon, 25 Feb 2019 19:27:11 +0000 (11:27 -0800)]
mingw: drop MakeMaker reference

In 20d2a30f8ffe (Makefile: replace perl/Makefile.PL with simple make
rules, 2017-12-10), Git stopped using MakeMaker. Therefore, that
definition in the MINGW-specific section became useless.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoStart 2.22 cycle 529/head
Junio C Hamano [Thu, 7 Mar 2019 02:59:54 +0000 (11:59 +0900)]
Start 2.22 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'jt/http-auth-proto-v2-fix'
Junio C Hamano [Thu, 7 Mar 2019 00:59:59 +0000 (09:59 +0900)]
Merge branch 'jt/http-auth-proto-v2-fix'

Unify RPC code for smart http in protocol v0/v1 and v2, which fixes
a bug in the latter (lack of authentication retry) and generally
improves the code base.

* jt/http-auth-proto-v2-fix:
  remote-curl: use post_rpc() for protocol v2 also
  remote-curl: refactor reading into rpc_state's buf
  remote-curl: reduce scope of rpc_state.result
  remote-curl: reduce scope of rpc_state.stdin_preamble
  remote-curl: reduce scope of rpc_state.argv

2 years agoMerge branch 'jk/diff-no-index-initialize'
Junio C Hamano [Thu, 7 Mar 2019 00:59:59 +0000 (09:59 +0900)]
Merge branch 'jk/diff-no-index-initialize'

"git diff --no-index" may still want to access Git goodies like
--ext-diff and --textconv, but so far these have been ignored,
which has been corrected.

* jk/diff-no-index-initialize:
  diff: reuse diff setup for --no-index case

2 years agoMerge branch 'nd/no-more-check-racy'
Junio C Hamano [Thu, 7 Mar 2019 00:59:59 +0000 (09:59 +0900)]
Merge branch 'nd/no-more-check-racy'

Unused code removal.

* nd/no-more-check-racy:
  Delete check-racy.c

2 years agoMerge branch 'rd/doc-hook-used-in-sample'
Junio C Hamano [Thu, 7 Mar 2019 00:59:59 +0000 (09:59 +0900)]
Merge branch 'rd/doc-hook-used-in-sample'

Doc update.

* rd/doc-hook-used-in-sample:
  mention use of "hooks.allownonascii" in "man githooks"

2 years agoMerge branch 'nd/diff-parseopt-2'
Junio C Hamano [Thu, 7 Mar 2019 00:59:58 +0000 (09:59 +0900)]
Merge branch 'nd/diff-parseopt-2'

Second batch to teach the diff machinery to use the parse-options
API.

* nd/diff-parseopt-2: (21 commits)
  diff-parseopt: convert --ignore-some-changes
  diff-parseopt: convert --[no-]minimal
  diff-parseopt: convert --relative
  diff-parseopt: convert --no-renames|--[no--rename-empty
  diff-parseopt: convert --find-copies-harder
  diff-parseopt: convert -C|--find-copies
  diff-parseopt: convert -D|--irreversible-delete
  diff-parseopt: convert -M|--find-renames
  diff-parseopt: convert -B|--break-rewrites
  diff-parseopt: convert --output-*
  diff-parseopt: convert --[no-]compact-summary
  diff-parseopt: convert --stat*
  diff-parseopt: convert -s|--no-patch
  diff-parseopt: convert --name-status
  diff-parseopt: convert --name-only
  diff-parseopt: convert --patch-with-stat
  diff-parseopt: convert --summary
  diff-parseopt: convert --check
  diff-parseopt: convert --dirstat and friends
  diff-parseopt: convert --numstat and --shortstat
  ...

2 years agoMerge branch 'en/merge-options-doc'
Junio C Hamano [Thu, 7 Mar 2019 00:59:58 +0000 (09:59 +0900)]
Merge branch 'en/merge-options-doc'

Doc update.

* en/merge-options-doc:
  merge-options.txt: correct wording of --no-commit option

2 years agoMerge branch 'nd/completion-more-parameters'
Junio C Hamano [Thu, 7 Mar 2019 00:59:57 +0000 (09:59 +0900)]
Merge branch 'nd/completion-more-parameters'

The command line completion (in contrib/) has been taught to
complete more subcommand parameters.

* nd/completion-more-parameters:
  completion: add more parameter value completion

2 years agoMerge branch 'ab/receive-pack-use-after-free-fix'
Junio C Hamano [Thu, 7 Mar 2019 00:59:57 +0000 (09:59 +0900)]
Merge branch 'ab/receive-pack-use-after-free-fix'

Memfix.

* ab/receive-pack-use-after-free-fix:
  receive-pack: fix use-after-free bug

2 years agoMerge branch 'dl/doc-submodule-wo-subcommand'
Junio C Hamano [Thu, 7 Mar 2019 00:59:57 +0000 (09:59 +0900)]
Merge branch 'dl/doc-submodule-wo-subcommand'

Doc update.

* dl/doc-submodule-wo-subcommand:
  submodule: document default behavior

2 years agoMerge branch 'jk/unused-params'
Junio C Hamano [Thu, 7 Mar 2019 00:59:56 +0000 (09:59 +0900)]
Merge branch 'jk/unused-params'

Code clean-up.

* jk/unused-params:
  ref-filter: drop unused "sz" parameters
  ref-filter: drop unused "obj" parameters
  ref-filter: drop unused buf/sz pairs
  files-backend: drop refs parameter from split_symref_update()
  pack-objects: drop unused parameter from oe_map_new_pack()
  merge-recursive: drop several unused parameters
  diff: drop complete_rewrite parameter from run_external_diff()
  diff: drop unused emit data parameter from sane_truncate_line()
  diff: drop unused color reset parameters
  diff: drop options parameter from diffcore_fix_diff_index()

2 years agoMerge branch 'jk/prune-optim'
Junio C Hamano [Thu, 7 Mar 2019 00:59:56 +0000 (09:59 +0900)]
Merge branch 'jk/prune-optim'

"git prune" has been taught to take advantage of reachability
bitmap when able.

* jk/prune-optim:
  t5304: rename "sha1" variables to "oid"
  prune: check SEEN flag for reachability
  prune: use bitmaps for reachability traversal
  prune: lazily perform reachability traversal

2 years agoMerge branch 'jh/trace2'
Junio C Hamano [Thu, 7 Mar 2019 00:59:56 +0000 (09:59 +0900)]
Merge branch 'jh/trace2'

A more structured way to obtain execution trace has been added.

* jh/trace2:
  trace2: add for_each macros to clang-format
  trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.sh
  trace2:data: add subverb for rebase
  trace2:data: add subverb to reset command
  trace2:data: add subverb to checkout command
  trace2:data: pack-objects: add trace2 regions
  trace2:data: add trace2 instrumentation to index read/write
  trace2:data: add trace2 hook classification
  trace2:data: add trace2 transport child classification
  trace2:data: add trace2 sub-process classification
  trace2:data: add editor/pager child classification
  trace2:data: add trace2 regions to wt-status
  trace2: collect Windows-specific process information
  trace2: create new combined trace facility
  trace2: Documentation/technical/api-trace2.txt

2 years agoMerge branch 'js/doc-symref-in-proto-v1'
Junio C Hamano [Thu, 7 Mar 2019 00:59:56 +0000 (09:59 +0900)]
Merge branch 'js/doc-symref-in-proto-v1'

Doc update.

* js/doc-symref-in-proto-v1:
  protocol-capabilities.txt: document symref

2 years agoMerge branch 'nd/split-index-null-base-fix'
Junio C Hamano [Thu, 7 Mar 2019 00:59:56 +0000 (09:59 +0900)]
Merge branch 'nd/split-index-null-base-fix'

Split-index fix.

* nd/split-index-null-base-fix:
  read-cache.c: fix writing "link" index ext with null base oid

2 years agoMerge branch 'rj/prune-packed-excess-args'
Junio C Hamano [Thu, 7 Mar 2019 00:59:55 +0000 (09:59 +0900)]
Merge branch 'rj/prune-packed-excess-args'

"git prune-packed" did not notice and complain against excess
arguments given from the command line, which now it does.

* rj/prune-packed-excess-args:
  prune-packed: check for too many arguments

2 years agoMerge branch 'jc/test-yes-doc'
Junio C Hamano [Thu, 7 Mar 2019 00:59:54 +0000 (09:59 +0900)]
Merge branch 'jc/test-yes-doc'

Test doc update.

* jc/test-yes-doc:
  test: caution on our version of 'yes'

2 years agoMerge branch 'en/combined-all-paths'
Junio C Hamano [Thu, 7 Mar 2019 00:59:54 +0000 (09:59 +0900)]
Merge branch 'en/combined-all-paths'

Output from "diff --cc" did not show the original paths when the
merge involved renames.  A new option adds the paths in the
original trees to the output.

* en/combined-all-paths:
  log,diff-tree: add --combined-all-paths option

2 years agoMerge branch 'sc/pack-redundant'
Junio C Hamano [Thu, 7 Mar 2019 00:59:54 +0000 (09:59 +0900)]
Merge branch 'sc/pack-redundant'

Update the implementation of pack-redundant for performance in a
repository with many packfiles.

* sc/pack-redundant:
  pack-redundant: consistent sort method
  pack-redundant: rename pack_list.all_objects
  pack-redundant: new algorithm to find min packs
  pack-redundant: delete redundant code
  pack-redundant: delay creation of unique_objects
  t5323: test cases for git-pack-redundant

2 years agoMerge branch 'du/branch-show-current'
Junio C Hamano [Thu, 7 Mar 2019 00:59:53 +0000 (09:59 +0900)]
Merge branch 'du/branch-show-current'

"git branch" learned a new subcommand "--show-current".

* du/branch-show-current:
  branch: introduce --show-current display option

2 years agoMerge branch 'dl/complete-submodule-absorbgitdirs'
Junio C Hamano [Thu, 7 Mar 2019 00:59:53 +0000 (09:59 +0900)]
Merge branch 'dl/complete-submodule-absorbgitdirs'

Command-line completion (in contrib/) learned to tab-complete the
"git submodule absorbgitdirs" subcommand.

* dl/complete-submodule-absorbgitdirs:
  completion: complete git submodule absorbgitdirs

2 years agoMerge branch 'wh/author-committer-ident-config'
Junio C Hamano [Thu, 7 Mar 2019 00:59:53 +0000 (09:59 +0900)]
Merge branch 'wh/author-committer-ident-config'

Four new configuration variables {author,committer}.{name,email}
have been introduced to override user.{name,email} in more specific
cases.

* wh/author-committer-ident-config:
  config: allow giving separate author and committer idents

2 years agoMerge branch 'aw/pretty-trailers'
Junio C Hamano [Thu, 7 Mar 2019 00:59:52 +0000 (09:59 +0900)]
Merge branch 'aw/pretty-trailers'

The %(trailers) formatter in "git log --format=..."  now allows to
optionally pick trailers selectively by keyword, show only values,
etc.

* aw/pretty-trailers:
  pretty: add support for separator option in %(trailers)
  strbuf: separate callback for strbuf_expand:ing literals
  pretty: add support for "valueonly" option in %(trailers)
  pretty: allow showing specific trailers
  pretty: single return path in %(trailers) handling
  pretty: allow %(trailers) options with explicit value
  doc: group pretty-format.txt placeholders descriptions

2 years agoMerge branch 'nd/diff-parseopt'
Junio C Hamano [Thu, 7 Mar 2019 00:59:52 +0000 (09:59 +0900)]
Merge branch 'nd/diff-parseopt'

The diff machinery, one of the oldest parts of the system, which
long predates the parse-options API, uses fairly long and complex
handcrafted option parser.  This is being rewritten to use the
parse-options API.

* nd/diff-parseopt:
  diff.c: convert --raw
  diff.c: convert -W|--[no-]function-context
  diff.c: convert -U|--unified
  diff.c: convert -u|-p|--patch
  diff.c: prepare to use parse_options() for parsing
  diff.h: avoid bit fields in struct diff_flags
  diff.h: keep forward struct declarations sorted
  parse-options: allow ll_callback with OPTION_CALLBACK
  parse-options: avoid magic return codes
  parse-options: stop abusing 'callback' for lowlevel callbacks
  parse-options: add OPT_BITOP()
  parse-options: disable option abbreviation with PARSE_OPT_KEEP_UNKNOWN
  parse-options: add one-shot mode
  parse-options.h: remove extern on function prototypes

2 years agoMerge branch 'tg/checkout-no-overlay'
Junio C Hamano [Thu, 7 Mar 2019 00:59:51 +0000 (09:59 +0900)]
Merge branch 'tg/checkout-no-overlay'

"git checkout --no-overlay" can be used to trigger a new mode of
checking out paths out of the tree-ish, that allows paths that
match the pathspec that are in the current index and working tree
and are not in the tree-ish.

* tg/checkout-no-overlay:
  revert "checkout: introduce checkout.overlayMode config"
  checkout: introduce checkout.overlayMode config
  checkout: introduce --{,no-}overlay option
  checkout: factor out mark_cache_entry_for_checkout function
  checkout: clarify comment
  read-cache: add invalidate parameter to remove_marked_cache_entries
  entry: support CE_WT_REMOVE flag in checkout_entry
  entry: factor out unlink_entry function
  move worktree tests to t24*

2 years agoattr.c: ".gitattribute" -> ".gitattributes" (comments)
Robert P. J. Day [Wed, 6 Mar 2019 09:14:44 +0000 (04:14 -0500)]
attr.c: ".gitattribute" -> ".gitattributes" (comments)

Correct misspelled ".gitattribute" in comments only, so no functional
change.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agogitattributes.txt: fix typo
Yash Bhatambare [Wed, 6 Mar 2019 05:23:10 +0000 (05:23 +0000)]
gitattributes.txt: fix typo

`UTF-16-LE-BOM` to `UTF-16LE-BOM`.

this closes https://github.com/git-for-windows/git/issues/2095

Signed-off-by: Yash Bhatambare <ybhatambare@gmail.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocompat/bswap: add include header guards
Jeff King [Wed, 6 Mar 2019 19:05:10 +0000 (14:05 -0500)]
compat/bswap: add include header guards

Our compat/bswap.h lacks the usual preprocessor guards against multiple
inclusion. This usually isn't an issue since it only gets included from
git-compat-util.h, which has its own guards. But it would produce
redeclaration errors if any file included it separately.

Our hdr-check target would complain about this, except that it currently
skips items in compat/ entirely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: fix 'hdr-check' when GCRYPT not installed
Ramsay Jones [Wed, 6 Mar 2019 00:11:13 +0000 (00:11 +0000)]
Makefile: fix 'hdr-check' when GCRYPT not installed

If the GCRYPT_SHA256 build variable is not set, then the 'hdr-check'
target complains about the missing <gcrypt.h> header file. Add the
'sha256/gcrypt.h' header file to the exception list, if the build
variable is not defined. While here, replace the 'xdiff%' filter
pattern with 'xdiff/%' (and similarly for the compat pattern) since
the original pattern inadvertently excluded the 'xdiff-interface.h'
header.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMakefile: use `git ls-files` to list header files, if possible
Johannes Schindelin [Mon, 4 Mar 2019 13:47:06 +0000 (05:47 -0800)]
Makefile: use `git ls-files` to list header files, if possible

In d85b0dff72 (Makefile: use `find` to determine static header
dependencies, 2014-08-25), we switched from a static list of header
files to a dynamically-generated one, asking `find` to enumerate them.

Back in those days, we did not use `$(LIB_H)` by default, and many a
`make` implementation seems smart enough not to run that `find` command
in that case, so it was deemed okay to run `find` for special targets
requiring this macro.

However, as of ebb7baf02f (Makefile: add a hdr-check target,
2018-09-19), $(LIB_H) is part of a global rule and therefore must be
expanded. Meaning: this `find` command has to be run upon every
`make` invocation. In the presence of many a worktree, this can tax the
developers' patience quite a bit.

Even in the absence of worktrees or other untracked files and
directories, the cost of I/O to generate that list of header files is
simply a lot larger than a simple `git ls-files` call.

Therefore, just like in 335339758c (Makefile: ask "ls-files" to list
source files if available, 2011-10-18), we now prefer to use `git
ls-files` to enumerate the header files to enumerating them via `find`,
falling back to the latter if the former failed (which would be the case
e.g. in a worktree that was extracted from a source .tar file rather
than from a clone of Git's sources).

This has one notable consequence: we no longer include `command-list.h`
in `LIB_H`, as it is a generated file, not a tracked one, but that is
easily worked around. Of the three sites that use `LIB_H`, two
(`LOCALIZED_C` and `CHK_HDRS`) already handle generated headers
separately. In the third, the computed-dependency fallback, we can just
add in a reference to $(GENERATED_H).

Likewise, we no longer include not-yet-tracked header files in `LIB_H`.

Given the speed improvements, these consequences seem a comparably small
price to pay.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge tag 'l10n-2.21.0-rnd2.1' of git://github.com/git-l10n/git-po
Junio C Hamano [Tue, 5 Mar 2019 12:53:10 +0000 (21:53 +0900)]
Merge tag 'l10n-2.21.0-rnd2.1' of git://github.com/git-l10n/git-po

L10n for Git 2.21.0 round 2.1

* tag 'l10n-2.21.0-rnd2.1' of git://github.com/git-l10n/git-po:
  l10n: Fixes to Catalan translation
  l10n: Updated Vietnamese translation for v2.21 rd2
  l10n: fr.po remove obsolete entries

2 years agoremote-curl: use post_rpc() for protocol v2 also
Jonathan Tan [Thu, 21 Feb 2019 20:24:41 +0000 (12:24 -0800)]
remote-curl: use post_rpc() for protocol v2 also

When transmitting and receiving POSTs for protocol v0 and v1,
remote-curl uses post_rpc() (and associated functions), but when doing
the same for protocol v2, it uses a separate set of functions
(proxy_rpc() and others). Besides duplication of code, this has caused
at least one bug: the auth retry mechanism that was implemented in v0/v1
was not implemented in v2.

To fix this issue and avoid it in the future, make remote-curl also use
post_rpc() when handling protocol v2. Because line lengths are written
to the HTTP request in protocol v2 (unlike in protocol v0/v1), this
necessitates changes in post_rpc() and some of the functions it uses;
perform these changes too.

A test has been included to ensure that the code for both the unchunked
and chunked variants of the HTTP request is exercised.

Note: stateless_connect() has been updated to use the lower-level packet
reading functions instead of struct packet_reader. The low-level control
is necessary here because we cannot change the destination buffer of
struct packet_reader while it is being used; struct packet_buffer has a
peeking mechanism which relies on the destination buffer being present
in between a peek and a read.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodocs/git-gc: fix typo "--prune=all" to "--prune=now"
Robert P. J. Day [Sat, 2 Mar 2019 08:51:52 +0000 (03:51 -0500)]
docs/git-gc: fix typo "--prune=all" to "--prune=now"

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: Fixes to Catalan translation
Jordi Mas [Sat, 2 Mar 2019 18:12:58 +0000 (19:12 +0100)]
l10n: Fixes to Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
2 years agol10n: Updated Vietnamese translation for v2.21 rd2
Tran Ngoc Quan [Tue, 26 Feb 2019 07:50:59 +0000 (14:50 +0700)]
l10n: Updated Vietnamese translation for v2.21 rd2

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2 years agotravis: remove the hack to build the Windows job on Azure Pipelines
Johannes Schindelin [Thu, 28 Feb 2019 19:33:52 +0000 (11:33 -0800)]
travis: remove the hack to build the Windows job on Azure Pipelines

Since Travis did not support Windows (and now only supports very limited
Windows jobs, too limited for our use, the test suite would time out
*all* the time), we added a hack where a Travis job would trigger an
Azure Pipeline (which back then was still called VSTS Build), wait for
it to finish (or time out), and download the log (if available).

Needless to say that it was a horrible hack, necessitated by a bad
situation.

Nowadays, however, we have Azure Pipelines support, and do not need that
hack anymore. So let's retire it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agorebase docs: fix "gitlink" typo
Kyle Meyer [Thu, 28 Feb 2019 02:43:15 +0000 (21:43 -0500)]
rebase docs: fix "gitlink" typo

Change it to "linkgit" so that the reference is properly rendered.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: fr.po remove obsolete entries
Jean-Noël Avila [Mon, 25 Feb 2019 21:11:15 +0000 (22:11 +0100)]
l10n: fr.po remove obsolete entries

On NetBSD, the version of msgfmt is still 0.14.4. There's no hope for
an upgrade due to some GPLv3 allergy of NetBSD's. This version chokes
on heavily decorated commented entries in po files. It's safer to get
rid of all these obsolete entries.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2 years agoGit 2.21 v2.21.0
Junio C Hamano [Sun, 24 Feb 2019 15:55:19 +0000 (07:55 -0800)]
Git 2.21

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'yn/checkout-doc-fix'
Junio C Hamano [Sun, 24 Feb 2019 15:18:00 +0000 (07:18 -0800)]
Merge branch 'yn/checkout-doc-fix'

Doc fix.

* yn/checkout-doc-fix:
  checkout doc: fix an unmatched double-quote pair

2 years agodiff: reuse diff setup for --no-index case
Jeff King [Sat, 16 Feb 2019 06:57:56 +0000 (01:57 -0500)]
diff: reuse diff setup for --no-index case

When "--no-index" is in effect (or implied by the arguments), git-diff
jumps early to a special code path to perform that diff. This means we
miss out on some settings like enabling --ext-diff and --textconv by
default.

Let's jump to the no-index path _after_ we've done more setup on
rev.diffopt. Since some of the options don't affect us (e.g., items
related to the index), let's re-order the setup into two blocks (see the
in-code comments).

Note that we also need to stop re-initializing the diffopt struct in
diff_no_index(). This should not be necessary, as it will already have
been initialized by cmd_diff() (and there are no other callers). That in
turn lets us drop the "repository" argument from diff_no_index (which
never made much sense, since the whole point is that you don't need a
repository).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge tag 'l10n-2.21.0-rnd2' of git://github.com/git-l10n/git-po
Junio C Hamano [Sun, 24 Feb 2019 15:03:39 +0000 (07:03 -0800)]
Merge tag 'l10n-2.21.0-rnd2' of git://github.com/git-l10n/git-po

l10n-2.21.0-rnd2

* tag 'l10n-2.21.0-rnd2' of git://github.com/git-l10n/git-po:
  l10n: bg.po: Updated Bulgarian translation (4363t)
  l10n: update German translation
  l10n: zh_CN: Revision for git v2.21.0 l10n
  l10n: zh_CN: for git v2.21.0 l10n round 1~2
  l10n: bg.po: correct typo
  l10n: Update Swedish translation (4363t0f0u)
  l10n: de.po: fix grammar in message for tag.c
  l10n: de.po: fix a message for index-pack.c
  l10n: de.po: consistent translation of 'root commit'
  l10n: it: update the Italian translation
  l10n: es: 2.21.0 round 2
  l10n: el: add Greek l10n team and essential translations
  l10n: fr.po v2.21.0 rnd 2
  l10n: fr.po Fix some typos from round3
  l10n: fr.po Fix some typos
  l10n: Fixes to Catalan translation
  l10n: git.pot: v2.21.0 round 2 (3 new, 3 removed)
  l10n: git.pot: v2.21.0 round 1 (214 new, 38 removed)
  l10n: zh_CN: fix typo of submodule init message
  l10n: Update Catalan translation

2 years agoREADME: adjust for final Azure Pipeline ID
Johannes Schindelin [Sat, 23 Feb 2019 14:49:23 +0000 (06:49 -0800)]
README: adjust for final Azure Pipeline ID

During the six months of development of the Azure Pipelines support, the
patches went through quite a few iterations of changes, and to test
those iterations, a temporary build definition was used.

In the meantime, Azure Pipelines support made it to `master`, and we now
have a regular Azure Pipeline, installed via the common GitHub App
workflow. This new pipeline has a different name (git.git instead of
test-git.git), and a new ID (11 instead of 2).

Let's adjust the badge in our README to reflect that final shape of the
Azure Pipeline.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocheckout doc: fix an unmatched double-quote pair
Yoichi Nakayama [Sat, 23 Feb 2019 06:33:40 +0000 (15:33 +0900)]
checkout doc: fix an unmatched double-quote pair

Signed-off-by: Yoichi Nakayama <yoichi.nakayama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agol10n: bg.po: Updated Bulgarian translation (4363t)
Alexander Shopov [Sat, 23 Feb 2019 16:39:07 +0000 (18:39 +0200)]
l10n: bg.po: Updated Bulgarian translation (4363t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2 years agoMerge branch 'ab/bsd-fixes'
Junio C Hamano [Sat, 23 Feb 2019 05:20:19 +0000 (21:20 -0800)]
Merge branch 'ab/bsd-fixes'

Test portability fix.

* ab/bsd-fixes:
  commit-graph tests: fix unportable "dd" invocation
  tests: fix unportable "\?" and "\+" regex syntax

2 years agoMerge branch 'ab/workaround-dash-bug-in-test'
Junio C Hamano [Sat, 23 Feb 2019 05:20:19 +0000 (21:20 -0800)]
Merge branch 'ab/workaround-dash-bug-in-test'

* ab/workaround-dash-bug-in-test:
  tests: avoid syntax triggering old dash bug

2 years agotrace2: add for_each macros to clang-format
Jeff Hostetler [Fri, 22 Feb 2019 22:25:11 +0000 (14:25 -0800)]
trace2: add for_each macros to clang-format

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.sh
Jeff Hostetler [Fri, 22 Feb 2019 22:25:10 +0000 (14:25 -0800)]
trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.sh

Create unit tests for Trace2.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2:data: add subverb for rebase
Jeff Hostetler [Fri, 22 Feb 2019 22:25:10 +0000 (14:25 -0800)]
trace2:data: add subverb for rebase

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2:data: add subverb to reset command
Jeff Hostetler [Fri, 22 Feb 2019 22:25:09 +0000 (14:25 -0800)]
trace2:data: add subverb to reset command

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2:data: add subverb to checkout command
Jeff Hostetler [Fri, 22 Feb 2019 22:25:08 +0000 (14:25 -0800)]
trace2:data: add subverb to checkout command

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2:data: pack-objects: add trace2 regions
Derrick Stolee [Fri, 22 Feb 2019 22:25:07 +0000 (14:25 -0800)]
trace2:data: pack-objects: add trace2 regions

When studying the performance of 'git push' we would like to know
how much time is spent at various parts of the command. One area
that could cause performance trouble is 'git pack-objects'.

Add trace2 regions around the three main actions taken in this
command:

1. Enumerate objects.
2. Prepare pack.
3. Write pack-file.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2:data: add trace2 instrumentation to index read/write
Jeff Hostetler [Fri, 22 Feb 2019 22:25:07 +0000 (14:25 -0800)]
trace2:data: add trace2 instrumentation to index read/write

Add trace2 events to measure reading and writing the index.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2:data: add trace2 hook classification
Jeff Hostetler [Fri, 22 Feb 2019 22:25:06 +0000 (14:25 -0800)]
trace2:data: add trace2 hook classification

Classify certain child processes as hooks.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2:data: add trace2 transport child classification
Jeff Hostetler [Fri, 22 Feb 2019 22:25:05 +0000 (14:25 -0800)]
trace2:data: add trace2 transport child classification

Add trace2 child classification for transport processes.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2:data: add trace2 sub-process classification
Jeff Hostetler [Fri, 22 Feb 2019 22:25:05 +0000 (14:25 -0800)]
trace2:data: add trace2 sub-process classification

Add trace2 classification for long-running processes
started in sub-process.c

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2:data: add editor/pager child classification
Jeff Hostetler [Fri, 22 Feb 2019 22:25:04 +0000 (14:25 -0800)]
trace2:data: add editor/pager child classification

Add trace2 process classification for editor and pager
child processes.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2:data: add trace2 regions to wt-status
Jeff Hostetler [Fri, 22 Feb 2019 22:25:03 +0000 (14:25 -0800)]
trace2:data: add trace2 regions to wt-status

Add trace2_region_enter() and trace2_region_leave() calls around the
various phases of a status scan.  This gives elapsed time for each
phase in the GIT_TR2_PERF and GIT_TR2_EVENT trace target.

Also, these Trace2 calls now use s->repo rather than the_repository.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2: collect Windows-specific process information
Jeff Hostetler [Fri, 22 Feb 2019 22:25:02 +0000 (14:25 -0800)]
trace2: collect Windows-specific process information

Add platform-specific interface to log information about the current
process.

On Windows, this interface is used to indicate whether the git process
is running under a debugger and list names of the process ancestors.

Information for other platforms is left for a future effort.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2: create new combined trace facility
Jeff Hostetler [Fri, 22 Feb 2019 22:25:01 +0000 (14:25 -0800)]
trace2: create new combined trace facility

Create a new unified tracing facility for git.  The eventual intent is to
replace the current trace_printf* and trace_performance* routines with a
unified set of git_trace2* routines.

In addition to the usual printf-style API, trace2 provides higer-level
event verbs with fixed-fields allowing structured data to be written.
This makes post-processing and analysis easier for external tools.

Trace2 defines 3 output targets.  These are set using the environment
variables "GIT_TR2", "GIT_TR2_PERF", and "GIT_TR2_EVENT".  These may be
set to "1" or to an absolute pathname (just like the current GIT_TRACE).

* GIT_TR2 is intended to be a replacement for GIT_TRACE and logs command
  summary data.

* GIT_TR2_PERF is intended as a replacement for GIT_TRACE_PERFORMANCE.
  It extends the output with columns for the command process, thread,
  repo, absolute and relative elapsed times.  It reports events for
  child process start/stop, thread start/stop, and per-thread function
  nesting.

* GIT_TR2_EVENT is a new structured format. It writes event data as a
  series of JSON records.

Calls to trace2 functions log to any of the 3 output targets enabled
without the need to call different trace_printf* or trace_performance*
routines.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agotrace2: Documentation/technical/api-trace2.txt
Jeff Hostetler [Fri, 22 Feb 2019 22:25:00 +0000 (14:25 -0800)]
trace2: Documentation/technical/api-trace2.txt

Created design document for Trace2 feature.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoDelete check-racy.c
Nguyễn Thái Ngọc Duy [Fri, 22 Feb 2019 11:27:57 +0000 (18:27 +0700)]
Delete check-racy.c

This is git-checy-racy command, added a long time ago [1] and was never
part of the default build. Naturally after some makefile changes [2],
git-check-racy was no longer recognized as a build target. Even if it
compiles to day, it will not link after the introduction of
common-main.c [3].

Racy index has not been a problem for a long time [4].  It's time to let
this code go. I briefly consider if check-racy should be part of
test-tool.  But I don't think it's worth the effort.

[1] 42f774063d (Add check program "git-check-racy" - 2006-08-15)
[2] c373991375 (Makefile: list generated object files in OBJECTS -
    2010-01-26)
[3] 3f2e2297b9 (add an extra level of indirection to main() -
    2016-07-01)
[4] I pretend I don't remember anything about the recent split-index's
    racy problem

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoremote-curl: refactor reading into rpc_state's buf
Jonathan Tan [Thu, 21 Feb 2019 20:24:40 +0000 (12:24 -0800)]
remote-curl: refactor reading into rpc_state's buf

Currently, whenever remote-curl reads pkt-lines from its response file
descriptor, only the payload is written to its buf, not the 4 characters
denoting the length. A future patch will require the ability to also
write those 4 characters, so in preparation for that, refactor this read
into its own function.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agocommit-graph tests: fix unportable "dd" invocation
Ævar Arnfjörð Bjarmason [Thu, 21 Feb 2019 19:28:49 +0000 (20:28 +0100)]
commit-graph tests: fix unportable "dd" invocation

Change an unportable invocation of "dd" with count=0, that wanted to
truncate the commit-graph file.  In POSIX it is unspecified what
happens when count=0 is provided[1]. The NetBSD "dd" behavior
differs from GNU (and seemingly other BSDs), which has left this test
broken since d2b86fbaa1 ("commit-graph: fix buffer read-overflow",
2019-01-15).

Copying from /dev/null would seek/truncate to seek=$zero_pos and
stop immediately after that (without being able to copy anything),
which is the right way to truncate the file.

1. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/dd.html

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agoMerge branch 'master' of https://github.com/ralfth/git-po-de
Jiang Xin [Fri, 22 Feb 2019 14:18:12 +0000 (22:18 +0800)]
Merge branch 'master' of https://github.com/ralfth/git-po-de

2 years agol10n: update German translation
Ralf Thielow [Fri, 22 Feb 2019 07:45:40 +0000 (08:45 +0100)]
l10n: update German translation

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Reviewed-by: Matthias Rüster <matthias.ruester@gmail.com>
2 years agotests: fix unportable "\?" and "\+" regex syntax
Ævar Arnfjörð Bjarmason [Thu, 21 Feb 2019 19:28:48 +0000 (20:28 +0100)]
tests: fix unportable "\?" and "\+" regex syntax

Fix widely supported but non-POSIX basic regex syntax introduced in
[1] and [2]. On GNU, NetBSD and FreeBSD the following works:

    $ echo xy >f
    $ grep 'xy\?' f; echo $?
    xy
    0

The same goes for "\+". The "?" and "+" syntax is not in the BRE
syntax, just in ERE, but on some implementations it can be invoked by
prefixing the meta-operator with "\", but not on OpenBSD:

    $ uname -a
    OpenBSD obsd.my.domain 6.2 GENERIC#132 amd64
    $ grep --version
    grep version 0.9
    $ grep 'xy\?' f; echo $?
    1

Let's fix this by moving to ERE syntax instead, where "?" and "+" are
universally supported:

    $ grep -E 'xy?' f; echo $?
    xy
    0

1. 2ed5c8e174 ("describe: setup working tree for --dirty", 2019-02-03)
2. c801170b0c ("t6120: test for describe with a bare repository",
   2019-02-03)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --ignore-some-changes
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:21 +0000 (18:16 +0700)]
diff-parseopt: convert --ignore-some-changes

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --[no-]minimal
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:20 +0000 (18:16 +0700)]
diff-parseopt: convert --[no-]minimal

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --relative
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:19 +0000 (18:16 +0700)]
diff-parseopt: convert --relative

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --no-renames|--[no--rename-empty
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:18 +0000 (18:16 +0700)]
diff-parseopt: convert --no-renames|--[no--rename-empty

For --rename-empty, see 90d43b0768 (teach diffcore-rename to
optionally ignore empty content - 2012-03-22) for more information.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --find-copies-harder
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:17 +0000 (18:16 +0700)]
diff-parseopt: convert --find-copies-harder

--no-find-copies-harder is also added on purpose (because I don't see
why we should not have the --no- version for this)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert -C|--find-copies
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:16 +0000 (18:16 +0700)]
diff-parseopt: convert -C|--find-copies

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert -D|--irreversible-delete
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:15 +0000 (18:16 +0700)]
diff-parseopt: convert -D|--irreversible-delete

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert -M|--find-renames
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:14 +0000 (18:16 +0700)]
diff-parseopt: convert -M|--find-renames

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert -B|--break-rewrites
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:13 +0000 (18:16 +0700)]
diff-parseopt: convert -B|--break-rewrites

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --output-*
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:12 +0000 (18:16 +0700)]
diff-parseopt: convert --output-*

This also validates that the user specifies a single character in
--output-indicator-*, not a string.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --[no-]compact-summary
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:11 +0000 (18:16 +0700)]
diff-parseopt: convert --[no-]compact-summary

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --stat*
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:10 +0000 (18:16 +0700)]
diff-parseopt: convert --stat*

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert -s|--no-patch
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:09 +0000 (18:16 +0700)]
diff-parseopt: convert -s|--no-patch

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --name-status
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:08 +0000 (18:16 +0700)]
diff-parseopt: convert --name-status

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --name-only
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:07 +0000 (18:16 +0700)]
diff-parseopt: convert --name-only

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --patch-with-stat
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:06 +0000 (18:16 +0700)]
diff-parseopt: convert --patch-with-stat

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 years agodiff-parseopt: convert --summary
Nguyễn Thái Ngọc Duy [Thu, 21 Feb 2019 11:16:05 +0000 (18:16 +0700)]
diff-parseopt: convert --summary

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