git/git.git
23 months agorefspec: make hash size independent
brian m. carlson [Tue, 19 Feb 2019 00:05:21 +0000 (00:05 +0000)]
refspec: make hash size independent

Switch a use of GIT_SHA1_HEXSZ to use the_hash_algo.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoarchive: convert struct archiver_args to object_id
brian m. carlson [Tue, 19 Feb 2019 00:05:20 +0000 (00:05 +0000)]
archive: convert struct archiver_args to object_id

Change the commit_sha1 member to be called "commit_oid" and change it to
be a pointer to struct object_id.  Additionally, update some uses of
GIT_SHA1_HEXSZ and hard-coded values to use the_hash_algo instead.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobuiltin/get-tar-commit-id: make hash size independent
brian m. carlson [Tue, 19 Feb 2019 00:05:19 +0000 (00:05 +0000)]
builtin/get-tar-commit-id: make hash size independent

To make this code independent of the hash size, verify that the length
of the comment is equal to that of any supported hash algorithm.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoget-tar-commit-id: parse comment record
Rene Scharfe [Tue, 19 Feb 2019 00:05:18 +0000 (00:05 +0000)]
get-tar-commit-id: parse comment record

Parse pax comment records properly and get rid of magic numbers for
acceptable comment length.  This simplifies a later change to handle
longer hashes.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agohash: add a function to lookup hash algorithm by length
brian m. carlson [Tue, 19 Feb 2019 00:05:17 +0000 (00:05 +0000)]
hash: add a function to lookup hash algorithm by length

There are some cases, such as the dumb HTTP transport and bundles, where
we can only determine the hash algorithm in use by the length of the
object IDs. Provide a function that looks up the algorithm by length.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoremote-curl: make hash size independent
brian m. carlson [Tue, 19 Feb 2019 00:05:16 +0000 (00:05 +0000)]
remote-curl: make hash size independent

Change one hard-coded use of the constant 40 to a reference to
the_hash_algo.  In addition, switch a use of get_oid_hex to
parse_oid_hex to avoid the need to use a constant.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agohttp: replace sha1_to_hex
brian m. carlson [Tue, 19 Feb 2019 00:05:15 +0000 (00:05 +0000)]
http: replace sha1_to_hex

Since sha1_to_hex is limited to SHA-1, replace it with hash_to_hex.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agohttp: compute hash of downloaded objects using the_hash_algo
brian m. carlson [Tue, 19 Feb 2019 00:05:14 +0000 (00:05 +0000)]
http: compute hash of downloaded objects using the_hash_algo

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agohttp: replace hard-coded constant with the_hash_algo
brian m. carlson [Tue, 19 Feb 2019 00:05:13 +0000 (00:05 +0000)]
http: replace hard-coded constant with the_hash_algo

Replace a hard-coded 40 with a reference to the_hash_algo.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agohttp-walker: replace sha1_to_hex
brian m. carlson [Tue, 19 Feb 2019 00:05:12 +0000 (00:05 +0000)]
http-walker: replace sha1_to_hex

Since sha1_to_hex is limited to SHA-1, replace the uses of it in this
file with hash_to_hex.  Rename several variables accordingly to reflect
that they are no longer limited to SHA-1.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agohttp-push: remove remaining uses of sha1_to_hex
brian m. carlson [Tue, 19 Feb 2019 00:05:11 +0000 (00:05 +0000)]
http-push: remove remaining uses of sha1_to_hex

Since sha1_to_hex is limited to SHA-1, switch all remaining uses of it
in this file to hash_to_hex or oid_to_hex.  Modify update_remote to take
a pointer to struct object_id, and since we don't modify that parameter
in the function, set it to be const as well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agohttp-backend: allow 64-character hex names
brian m. carlson [Tue, 19 Feb 2019 00:05:10 +0000 (00:05 +0000)]
http-backend: allow 64-character hex names

In an SHA-256-backed repository using the http-backend handler for dumb
protocol clients, it may be necessary to access the raw packs using
their full SHA-256-specified names.  Allow packs and loose objects to be
accessed using their full SHA-256-specified 64-character hex names.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agohttp-push: convert to use the_hash_algo
brian m. carlson [Tue, 19 Feb 2019 00:05:09 +0000 (00:05 +0000)]
http-push: convert to use the_hash_algo

Switch the lock token code to use the_hash_algo and increase its buffers
to be allocated using GIT_MAX_* constants.  Update the parsing of object
paths to use the_hash_algo as well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobuiltin/pull: make hash-size independent
brian m. carlson [Tue, 19 Feb 2019 00:05:08 +0000 (00:05 +0000)]
builtin/pull: make hash-size independent

Instead of using get_oid_hex and GIT_SHA1_HEXSZ, use parse_oid_hex to
avoid the need for a constant and simplify the code.

Additionally, fix some comments to refer to object IDs instead of SHA-1
and update a constant used to provide an allocation hint.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobuiltin/am: make hash size independent
brian m. carlson [Tue, 19 Feb 2019 00:05:07 +0000 (00:05 +0000)]
builtin/am: make hash size independent

Instead of using GIT_SHA1_HEXSZ, switch to using the_hash_algo and
parse_oid_hex to parse the lines involved in rebasing notes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agofast-import: replace sha1_to_hex
brian m. carlson [Tue, 19 Feb 2019 00:05:06 +0000 (00:05 +0000)]
fast-import: replace sha1_to_hex

Replace the uses of sha1_to_hex in this function with hash_to_hex to
allow the use of SHA-256 as well.  Rename a variable since it is no
longer limited to SHA-1.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agofast-import: make hash-size independent
brian m. carlson [Tue, 19 Feb 2019 00:05:05 +0000 (00:05 +0000)]
fast-import: make hash-size independent

Replace several uses of GIT_SHA1_HEXSZ and 40-based constants with
references to the_hash_algo.  Update the note handling code here to
compute path sizes based on GIT_MAX_RAWSZ as well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobuiltin/name-rev: make hash-size independent
brian m. carlson [Tue, 19 Feb 2019 00:05:04 +0000 (00:05 +0000)]
builtin/name-rev: make hash-size independent

Use the_hash_algo when parsing instead of GIT_SHA1_HEXSZ so that this
function works with any size hash.  Rename the variable forty to
counter, as this is a better name and is independent of the hash size.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoobject-store: rename and expand packed_git's sha1 member
brian m. carlson [Tue, 19 Feb 2019 00:05:03 +0000 (00:05 +0000)]
object-store: rename and expand packed_git's sha1 member

This member is used to represent the pack checksum of the pack in
question.  Expand this member to be GIT_MAX_RAWSZ bytes in length so it
works with longer hashes and rename it to be "hash" instead of "sha1".
This transformation was made with a change to the definition and the
following semantic patch:

@@
struct packed_git *E1;
@@
- E1->sha1
+ E1->hash

@@
struct packed_git E1;
@@
- E1.sha1
+ E1.hash

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agonotes: replace sha1_to_hex
brian m. carlson [Tue, 19 Feb 2019 00:05:02 +0000 (00:05 +0000)]
notes: replace sha1_to_hex

Replace the uses of sha1_to_hex in this function with hash_to_hex to
allow the use of SHA-256 as well.  Rename some variables since this code
is no longer limited to SHA-1.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agonotes: make hash size independent
brian m. carlson [Tue, 19 Feb 2019 00:05:01 +0000 (00:05 +0000)]
notes: make hash size independent

Switch out various uses of the GIT_SHA1_* constants with GIT_MAX_*
constants for allocations and the_hash_algo for general parsing.  Update
a comment to no longer be SHA-1 specific.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agonotes-merge: switch to use the_hash_algo
brian m. carlson [Tue, 19 Feb 2019 00:05:00 +0000 (00:05 +0000)]
notes-merge: switch to use the_hash_algo

Switch from using GIT_SHA1_HEXSZ to GIT_MAX_HEXSZ and the_hash_algo so
that the code works with any hash algorithm.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agosubmodule: avoid hard-coded constants
brian m. carlson [Tue, 19 Feb 2019 00:04:59 +0000 (00:04 +0000)]
submodule: avoid hard-coded constants

Instead of using hard-coded 40-based constants, express these values in
terms of the_hash_algo and GIT_MAX_HEXSZ.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agopack-bitmap: switch hash tables to use struct object_id
brian m. carlson [Tue, 19 Feb 2019 00:04:58 +0000 (00:04 +0000)]
pack-bitmap: switch hash tables to use struct object_id

Instead of storing unsigned char pointers in the hash tables, switch to
storing instances of struct object_id. Update several internal functions
and one external function to take pointers to struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agopack-bitmap: switch hard-coded constants to the_hash_algo
brian m. carlson [Tue, 19 Feb 2019 00:04:57 +0000 (00:04 +0000)]
pack-bitmap: switch hard-coded constants to the_hash_algo

Switch two hard-coded uses of 20 to references to the_hash_algo.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agopack-bitmap: replace sha1_to_hex
brian m. carlson [Tue, 19 Feb 2019 00:04:56 +0000 (00:04 +0000)]
pack-bitmap: replace sha1_to_hex

Replace the uses of sha1_to_hex in the pack bitmap code with hash_to_hex
to allow the use of SHA-256 as well.  Rename a few variables since they
are no longer limited to SHA-1.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agopack-bitmap: convert struct stored_bitmap to object_id
brian m. carlson [Tue, 19 Feb 2019 00:04:55 +0000 (00:04 +0000)]
pack-bitmap: convert struct stored_bitmap to object_id

Convert struct stored_bitmap to use struct object_id.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agopack-bitmap: make bitmap header handling hash agnostic
brian m. carlson [Tue, 19 Feb 2019 00:04:54 +0000 (00:04 +0000)]
pack-bitmap: make bitmap header handling hash agnostic

Increase the checksum field in struct bitmap_disk_header to be
GIT_MAX_RAWSZ bytes in length and ensure that we hash the proper number
of bytes out when computing the bitmap checksum.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agokhash: move oid hash table definition
brian m. carlson [Tue, 19 Feb 2019 00:04:53 +0000 (00:04 +0000)]
khash: move oid hash table definition

Move the oid khash table definition to khash.h and define a typedef for
it, similar to the one we have for unsigned char pointers. Define
variants that are maps as well.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agot/lib-submodule-update: use appropriate length constant
brian m. carlson [Tue, 19 Feb 2019 00:04:52 +0000 (00:04 +0000)]
t/lib-submodule-update: use appropriate length constant

Instead of using a specific invalid hard-coded object ID, produce one
of the appropriate length by using test_oid.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoThe third batch
Junio C Hamano [Wed, 20 Mar 2019 06:19:48 +0000 (15:19 +0900)]
The third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoMerge branch 'br/commit-tree-parseopt'
Junio C Hamano [Wed, 20 Mar 2019 06:16:08 +0000 (15:16 +0900)]
Merge branch 'br/commit-tree-parseopt'

The command line parser of "git commit-tree" has been rewritten to
use the parse-options API.

* br/commit-tree-parseopt:
  commit-tree: utilize parse-options api

23 months agoMerge branch 'jk/config-type-color-ends-with-lf'
Junio C Hamano [Wed, 20 Mar 2019 06:16:07 +0000 (15:16 +0900)]
Merge branch 'jk/config-type-color-ends-with-lf'

"git config --type=color ..." is meant to replace "git config --get-color"
but there is a slight difference that wasn't documented, which is
now fixed.

* jk/config-type-color-ends-with-lf:
  config: document --type=color output is a complete line

23 months agoMerge branch 'ma/clear-repository-format'
Junio C Hamano [Wed, 20 Mar 2019 06:16:07 +0000 (15:16 +0900)]
Merge branch 'ma/clear-repository-format'

The setup code has been cleaned up to avoid leaks around the
repository_format structure.

* ma/clear-repository-format:
  setup: fix memory leaks with `struct repository_format`
  setup: free old value before setting `work_tree`

23 months agoMerge branch 'jk/virtual-objects-do-exist'
Junio C Hamano [Wed, 20 Mar 2019 06:16:07 +0000 (15:16 +0900)]
Merge branch 'jk/virtual-objects-do-exist'

A recent update broke "is this object available to us?" check for
well-known objects like an empty tree (which should yield "yes",
even when there is no on-disk object for an empty tree), which has
been corrected.

* jk/virtual-objects-do-exist:
  rev-list: allow cached objects in existence check

23 months agoMerge branch 'jk/no-sigpipe-during-network-transport'
Junio C Hamano [Wed, 20 Mar 2019 06:16:06 +0000 (15:16 +0900)]
Merge branch 'jk/no-sigpipe-during-network-transport'

On platforms where "git fetch" is killed with SIGPIPE (e.g. OSX),
the upload-pack that runs on the other end that hangs up after
detecting an error could cause "git fetch" to die with a signal,
which led to a flakey test.  "git fetch" now ignores SIGPIPE during
the network portion of its operation (this is not a problem as we
check the return status from our write(2)s).

* jk/no-sigpipe-during-network-transport:
  fetch: ignore SIGPIPE during network operation
  fetch: avoid calling write_or_die()

23 months agoMerge branch 'jk/fsck-doc'
Junio C Hamano [Wed, 20 Mar 2019 06:16:05 +0000 (15:16 +0900)]
Merge branch 'jk/fsck-doc'

"git fsck --connectivity-only" omits computation necessary to sift
the objects that are not reachable from any of the refs into
unreachable and dangling.  This is now enabled when dangling
objects are requested (which is done by default, but can be
overridden with the "--no-dangling" option).

* jk/fsck-doc:
  fsck: always compute USED flags for unreachable objects
  doc/fsck: clarify --connectivity-only behavior

23 months agoMerge branch 'js/stress-test-ui-tweak'
Junio C Hamano [Wed, 20 Mar 2019 06:16:05 +0000 (15:16 +0900)]
Merge branch 'js/stress-test-ui-tweak'

Dev support.

* js/stress-test-ui-tweak:
  tests: introduce --stress-jobs=<N>
  tests: let --stress-limit=<N> imply --stress

23 months agoMerge branch 'js/rebase-orig-head-fix'
Junio C Hamano [Wed, 20 Mar 2019 06:16:05 +0000 (15:16 +0900)]
Merge branch 'js/rebase-orig-head-fix'

"git rebase" that was reimplemented in C did not set ORIG_HEAD
correctly, which has been corrected.

* js/rebase-orig-head-fix:
  built-in rebase: set ORIG_HEAD just once, before the rebase
  built-in rebase: demonstrate that ORIG_HEAD is not set correctly
  built-in rebase: use the correct reflog when switching branches
  built-in rebase: no need to check out `onto` twice

23 months agoMerge branch 'jk/bisect-final-output'
Junio C Hamano [Wed, 20 Mar 2019 06:16:04 +0000 (15:16 +0900)]
Merge branch 'jk/bisect-final-output'

The final report from "git bisect" used to show the suspected
culprit using a raw "diff-tree", with which there is no output for
a merge commit.  This has been updated to use a more modern and
human readable output that still is concise enough.

* jk/bisect-final-output:
  bisect: make diff-tree output prettier
  bisect: fix internal diff-tree config loading
  bisect: use string arguments to feed internal diff-tree

23 months agoMerge branch 'ab/makefile-help-devs-more'
Junio C Hamano [Wed, 20 Mar 2019 06:16:04 +0000 (15:16 +0900)]
Merge branch 'ab/makefile-help-devs-more'

CFLAGS now can be tweaked when invoking Make while using
DEVELOPER=YesPlease; this did not work well before.

* ab/makefile-help-devs-more:
  Makefile: allow for combining DEVELOPER=1 and CFLAGS="..."
  Makefile: move the setting of *FLAGS closer to "include"
  Makefile: Move *_LIBS assignment into its own section
  Makefile: add/remove comments at top and tweak whitespace
  Makefile: move "strip" assignment down from flags
  Makefile: remove an out-of-date comment

23 months agoMerge git://ozlabs.org/~paulus/gitk
Junio C Hamano [Mon, 18 Mar 2019 02:18:49 +0000 (11:18 +0900)]
Merge git://ozlabs.org/~paulus/gitk

* git://ozlabs.org/~paulus/gitk:
  gitk: Update Bulgarian translation (317t)

23 months agogitk: Update Bulgarian translation (317t)
Alexander Shopov [Wed, 13 Mar 2019 12:06:33 +0000 (13:06 +0100)]
gitk: Update Bulgarian translation (317t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
23 months 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>
23 months 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

23 months 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

23 months 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

23 months 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"

23 months 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

23 months 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

23 months 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

23 months 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)

23 months 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

23 months 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>
23 months 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>
23 months agocommit-tree: utilize parse-options api
Brandon Richardson [Thu, 7 Mar 2019 15:44:09 +0000 (11:44 -0400)]
commit-tree: utilize parse-options api

Rather than parse options manually, which is both difficult to
read and error prone, parse options supplied to commit-tree
using the parse-options api.

It was discovered that the --no-gpg-sign option was documented
but not implemented in commit 70ddbd7767 (commit-tree: add missing
--gpg-sign flag, 2019-01-19), and the existing implementation
would attempt to translate the option as a tree oid. It was also
suggested earlier in commit 55ca3f99ae (commit-tree: add and document
--no-gpg-sign, 2013-12-13) that commit-tree should be migrated to
utilize the parse-options api, which could help prevent mistakes
like this in the future. Hence this change.

Also update the documentation to better describe that mixing
`-m` and `-F` options will correctly compose commit log messages in the
order in which the options are given.

In the process, mark various strings for translation.

Signed-off-by: Brandon Richardson <brandon1024.br@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agoconfig: document --type=color output is a complete line
Jeff King [Tue, 5 Mar 2019 04:20:51 +0000 (23:20 -0500)]
config: document --type=color output is a complete line

Even though the newer "--type=color" option to "git config" is meant
to be upward compatible with the traditional "--get-color" option,
unlike the latter, its output is not an incomplete line that lack
the LF at the end.  That makes it consistent with output of other
types like "git config --type=bool".

Document it, as it sometimes surprises unsuspecting users.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months 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>
23 months 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

23 months 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

23 months 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

23 months 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"

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

23 months 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

23 months 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

23 months 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

23 months 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

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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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'

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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

23 months 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*

23 months 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>
23 months 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>
23 months 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>
23 months 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>
23 months agofsck: always compute USED flags for unreachable objects
Jeff King [Tue, 5 Mar 2019 04:47:39 +0000 (23:47 -0500)]
fsck: always compute USED flags for unreachable objects

The --connectivity-only option avoids opening every object, and instead
just marks reachable objects with a flag and compares this to the set
of all objects. This strategy is discussed in more detail in 3e3f8bd608
(fsck: prepare dummy objects for --connectivity-check, 2017-01-17).

This means that we report _every_ unreachable object as dangling.
Whereas in a full fsck, we'd have actually opened and parsed each of
those unreachable objects, marking their child objects with the USED
flag, to mean "this was mentioned by another object". And thus we can
report only the tip of an unreachable segment of the object graph as
dangling.

You can see this difference with a trivial example:

  tree=$(git hash-object -t tree -w /dev/null)
  one=$(echo one | git commit-tree $tree)
  two=$(echo two | git commit-tree -p $one $tree)

Running `git fsck` will report only $two as dangling, but with
--connectivity-only, both commits (and the tree) are reported. Likewise,
using --lost-found would write all three objects.

We can make --connectivity-only work like the normal case by taking a
separate pass over the unreachable objects, parsing them and marking
objects they refer to as USED. That still avoids parsing any blobs,
though we do pay the cost to access any unreachable commits and trees
(which may or may not be noticeable, depending on how many you have).

If neither --dangling nor --lost-found is in effect, then we can skip
this step entirely, just like we do now. That makes "--connectivity-only
--no-dangling" just as fast as the current "--connectivity-only". I.e.,
we do the correct thing always, but you can still tweak the options to
make it faster if you don't care about dangling objects.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agodoc/fsck: clarify --connectivity-only behavior
Jeff King [Tue, 5 Mar 2019 04:46:38 +0000 (23:46 -0500)]
doc/fsck: clarify --connectivity-only behavior

On reading this again, there are two things that were not immediately
clear to me:

  - we do still check links to blobs, even though we don't open the
    blobs themselves

  - we do not do the normal fsck checks, even for non-blob objects we do
    open

Let's reword it to make these points a little more clear.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agorev-list: allow cached objects in existence check
Jeff King [Mon, 4 Mar 2019 17:40:54 +0000 (12:40 -0500)]
rev-list: allow cached objects in existence check

This fixes a regression in 7c0fe330d5 (rev-list: handle missing tree
objects properly, 2018-10-05) where rev-list will now complain about the
empty tree when it doesn't physically exist on disk.

Before that commit, we relied on the traversal code in list-objects.c to
walk through the trees. Since it uses parse_tree(), we'd do a normal
object lookup that includes looking in the set of "cached" objects
(which is where our magic internal empty-tree kicks in).

After that commit, we instead tell list-objects.c not to die on any
missing trees, and we check them ourselves using has_object_file(). But
that function uses OBJECT_INFO_SKIP_CACHED, which means we won't use our
internal empty tree.

This normally wouldn't come up. For most operations, Git will try to
write out the empty tree object as it would any other object. And
pack-objects in a push or fetch will send the empty tree (even if it's
virtual on the sending side). However, there are cases where this can
matter. One I found in the wild:

  1. The root tree of a commit became empty by deleting all files,
     without using an index. In this case it was done using libgit2's
     tree builder API, but as the included test shows, it can easily be
     done with regular git using hash-object.

     The resulting repo works OK, as we'd avoid walking over our own
     reachable commits for a connectivity check.

  2. Cloning with --reference pointing to the repository from (1) can
     trigger the problem, because we tell the other side we already have
     that commit (and hence the empty tree), but then walk over it
     during the connectivity check (where we complain about it missing).

Arguably the workflow in step (1) should be more careful about writing
the empty tree object if we're referencing it. But this workflow did
work prior to 7c0fe330d5, so let's restore it.

This patch makes the minimal fix, which is to swap out a direct call to
oid_object_info_extended(), minus the SKIP_CACHED flag, instead of
calling has_object_file(). This is all that has_object_file() is doing
under the hood. And there's little danger of unrelated fallout from
other unexpected "cached" objects, since there's only one call site that
ends such a cached object, and it's in git-blame.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months 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>
23 months 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

23 months agofetch: ignore SIGPIPE during network operation
Jeff King [Sun, 3 Mar 2019 16:58:43 +0000 (11:58 -0500)]
fetch: ignore SIGPIPE during network operation

The default SIGPIPE behavior can be useful for a command that generates
a lot of output: if the receiver of our output goes away, we'll be
notified asynchronously to stop generating it (typically by killing the
program).

But for a command like fetch, which is primarily concerned with
receiving data and writing it to disk, an unexpected SIGPIPE can be
awkward. We're already checking the return value of all of our write()
calls, and dying due to the signal takes away our chance to gracefully
handle the error.

On Linux, we wouldn't generally see SIGPIPE at all during fetch. If the
other side of the network connection hangs up, we'll see ECONNRESET. But
on OS X, we get a SIGPIPE, and the process is killed. This causes t5570
to racily fail, as we sometimes die by signal (instead of the expected
die() call) when the server side hangs up.

Let's ignore SIGPIPE during the network portion of the fetch, which will
cause our write() to return EPIPE, giving us consistent behavior across
platforms.

This fixes the test flakiness, but note that it stops short of fixing
the larger problem. The server side hit a fatal error, sent us an "ERR"
packet, and then hung up. We notice the failure because we're trying to
write to a closed socket. But by dying immediately, we never actually
read the ERR packet and report its content to the user. This is a (racy)
problem on all platforms. So this patch lays the groundwork from which
that problem might be fixed consistently, but it doesn't actually fix
it.

Note the placement of the SIGPIPE handling. The absolute minimal change
would be to ignore SIGPIPE only when we're writing. But twiddling the
signal handler for each write call is inefficient and maintenance
burden. On the opposite end of the spectrum, we could simply declare
that fetch does not need SIGPIPE handling, since it doesn't generate a
lot of output, and we could just ignore it at the start of cmd_fetch().

This patch takes a middle ground. It ignores SIGPIPE during the network
operation (which is admittedly most of the program, since the actual
network operations are all done under the hood by the transport code).
So it's still pretty coarse.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agofetch: avoid calling write_or_die()
Jeff King [Tue, 5 Mar 2019 04:11:39 +0000 (23:11 -0500)]
fetch: avoid calling write_or_die()

The write_or_die() function has one quirk that a caller might not
expect: when it sees EPIPE from the write() call, it translates that
into a death by SIGPIPE. This doesn't change the overall behavior (the
program exits either way), but it does potentially confuse test scripts
looking for a non-signal exit code.

Let's switch away from using write_or_die() in a few code paths, which
will give us more consistent exit codes. It also gives us the
opportunity to write more descriptive error messages, since we have
context that write_or_die() does not.

Note that this won't do much by itself, since we'd typically be killed
by SIGPIPE before write_or_die() even gets a chance to do its thing.
That will be addressed in the next patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobuilt-in rebase: set ORIG_HEAD just once, before the rebase
Johannes Schindelin [Sun, 3 Mar 2019 17:11:55 +0000 (09:11 -0800)]
built-in rebase: set ORIG_HEAD just once, before the rebase

Technically, the scripted version set ORIG_HEAD only in two spots (which
really could have been one, because it called `git checkout $onto^0` to
start the rebase and also if it could take a shortcut, and in both cases
it called `git update-ref $orig_head`).

Practically, it *implicitly* reset ORIG_HEAD whenever `git reset --hard`
was called.

However, what we really want is that it is set exactly once, at the
beginning of the rebase.

So let's do that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobuilt-in rebase: demonstrate that ORIG_HEAD is not set correctly
Johannes Schindelin [Sun, 3 Mar 2019 17:11:54 +0000 (09:11 -0800)]
built-in rebase: demonstrate that ORIG_HEAD is not set correctly

The ORIG_HEAD pseudo ref is supposed to refer to the original,
pre-rebase state after a successful rebase. Let's add a regression test
to prove that this regressed: With GIT_TEST_REBASE_USE_BUILTIN=false,
this test case passes, with GIT_TEST_REBASE_USE_BUILTIN=true (or unset),
it fails.

Reported by Nazri Ramliy.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobuilt-in rebase: use the correct reflog when switching branches
Johannes Schindelin [Sun, 3 Mar 2019 17:11:54 +0000 (09:11 -0800)]
built-in rebase: use the correct reflog when switching branches

By mistake, we used the reflog intended for ORIG_HEAD.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agobuilt-in rebase: no need to check out `onto` twice
Johannes Schindelin [Sun, 3 Mar 2019 17:11:53 +0000 (09:11 -0800)]
built-in rebase: no need to check out `onto` twice

In the case that the rebase boils down to a fast-forward, the built-in
rebase reset the working tree twice: once to start the rebase at `onto`,
then realizing that the original (pre-rebase) HEAD was an ancestor and
we basically already fast-forwarded to the post-rebase HEAD,
`reset_head()` was called to update the original ref and to point HEAD
back to it.

That second `reset_head()` call does not need to touch the working tree,
though, as it does not change the actual tip commit (and therefore the
working tree should stay unchanged anyway): only the ref needs to be
updated (because the rebase detached the HEAD, and we want to go back to
the branch on which the rebase was started).

But that second `reset_head()` was called without the flag to leave the
working tree alone (the reason: when that call was introduced, that flag
was not yet even thought of). Let's avoid that unnecessary work by
passing that flag.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agotests: introduce --stress-jobs=<N>
Johannes Schindelin [Sun, 3 Mar 2019 14:44:55 +0000 (06:44 -0800)]
tests: introduce --stress-jobs=<N>

The --stress option currently accepts an argument, but it is confusing
to at least this user that the argument does not define the maximal
number of stress iterations, but instead the number of jobs to run in
parallel per stress iteration.

Let's introduce a separate option for that, whose name makes it more
obvious what it is about, and let --stress=<N> error out with a helpful
suggestion about the two options tha could possibly have been meant.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months agotests: let --stress-limit=<N> imply --stress
Johannes Schindelin [Sun, 3 Mar 2019 14:44:54 +0000 (06:44 -0800)]
tests: let --stress-limit=<N> imply --stress

It does not make much sense that running a test with
--stress-limit=<N> seemingly ignores that option because it does not
stress test at all.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
23 months 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>