gitweb.git
gpg-interface: find the last gpg signature lineJeff King Fri, 13 Apr 2018 21:18:35 +0000 (15:18 -0600)

gpg-interface: find the last gpg signature line

A signed tag has a detached signature like this:

object ...
[...more header...]

This is the tag body.

-----BEGIN PGP SIGNATURE-----
[opaque gpg data]
-----END PGP SIGNATURE-----

Our parser finds the _first_ line that appears to start a
PGP signature block, meaning we may be confused by a
signature (or a signature-like line) in the actual body.
Let's keep parsing and always find the final block, which
should be the detached signature over all of the preceding
content.

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

gpg-interface: extract gpg line matching helperJeff King Fri, 13 Apr 2018 21:18:34 +0000 (15:18 -0600)

gpg-interface: extract gpg line matching helper

Let's separate the actual line-by-line parsing of signatures
from the notion of "is this a gpg signature line". That will
make it easier to do more refactoring of this loop in future
patches.

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

gpg-interface: fix const-correctness of "eol" pointerJeff King Fri, 13 Apr 2018 21:18:33 +0000 (15:18 -0600)

gpg-interface: fix const-correctness of "eol" pointer

We accidentally shed the "const" of our buffer by passing it
through memchr. Let's fix that, and while we're at it, move
our variable declaration inside the loop, which is the only
place that uses it.

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

gpg-interface: use size_t for signature buffer sizeJeff King Fri, 13 Apr 2018 21:18:32 +0000 (15:18 -0600)

gpg-interface: use size_t for signature buffer size

Even though our object sizes (from which these buffers would
come) are typically "unsigned long", this is something we'd
like to eventually fix (since it's only 32-bits even on
64-bit Windows). It makes more sense to use size_t when
taking an in-memory buffer.

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

gpg-interface: modernize function declarationsJeff King Fri, 13 Apr 2018 21:18:31 +0000 (15:18 -0600)

gpg-interface: modernize function declarations

Let's drop "extern" from our declarations, which brings us
in line with our modern style guidelines. While we're
here, let's wrap some of the overly long lines, and move
docstrings for public functions to their declarations, since
they document the interface.

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

gpg-interface: handle bool user.signingkeyJeff King Fri, 13 Apr 2018 21:18:30 +0000 (15:18 -0600)

gpg-interface: handle bool user.signingkey

The config handler for user.signingkey does not check for a
boolean value, and thus:

git -c user.signingkey tag

will segfault. We could fix this and even shorten the code
by using git_config_string(). But our set_signing_key()
helper is used by other code outside of gpg-interface.c, so
we must keep it (and we may as well use it, because unlike
git_config_string() it does not leak when we overwrite an
old value).

Ironically, the handler for gpg.program just below _could_
use git_config_string() but doesn't. But since we're going
to touch that in a future patch, we'll leave it alone for
now. We will add some whitespace and returns in preparation
for adding more config keys, though.

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

t7004: fix mistaken tag nameJeff King Fri, 13 Apr 2018 21:18:29 +0000 (15:18 -0600)

t7004: fix mistaken tag name

We have a series of tests which create signed tags with
various properties, but one test accidentally verifies a tag
from much earlier in the series.

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

Makefile: add a DEVOPTS to get all of -WextraÆvar Arnfjörð Bjarmason Sat, 14 Apr 2018 19:19:46 +0000 (19:19 +0000)

Makefile: add a DEVOPTS to get all of -Wextra

Change DEVOPTS to understand a "extra-all" option. When the DEVELOPER
flag is enabled we turn on -Wextra, but manually switch some of the
warnings it turns on off.

This is because we have many existing occurrences of them in the code
base. This mode will stop the suppression, let the developer see and
decide whether to fix them.

This change is a slight alteration of Nguyễn Thái Ngọc Duy
EAGER_DEVELOPER mode patch[1]

1. "[PATCH v3 3/3] Makefile: add EAGER_DEVELOPER
mode" (<20180329150322.10722-4-pclouds@gmail.com>;
https://public-inbox.org/git/20180329150322.10722-4-pclouds@gmail.com/)

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

Makefile: add a DEVOPTS to suppress -Werror under DEVELOPERÆvar Arnfjörð Bjarmason Sat, 14 Apr 2018 19:19:45 +0000 (19:19 +0000)

Makefile: add a DEVOPTS to suppress -Werror under DEVELOPER

Add a DEVOPTS variable that'll be used to tweak the behavior of
DEVELOPER.

I've long wanted to use DEVELOPER=1 in my production builds, but on
some old systems I still get warnings, and thus the build would
fail. However if the build/tests fail for some other reason, it would
still be useful to scroll up and see what the relevant code is warning
about.

This change allows for that. Now setting DEVELOPER will set -Werror as
before, but if DEVOPTS=no-error is provided is set you'll get the same
warnings, but without -Werror.

Helped-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: detect compiler and enable more warnings... Nguyễn Thái Ngọc Duy Sat, 14 Apr 2018 19:19:44 +0000 (19:19 +0000)

Makefile: detect compiler and enable more warnings in DEVELOPER=1

The set of extra warnings we enable when DEVELOPER has to be
conservative because we can't assume any compiler version the
developer may use. Detect the compiler version so we know when it's
safe to enable -Wextra and maybe more.

These warning settings are mostly from my custom config.mak a long
time ago when I tried to enable as many warnings as possible that can
still build without showing warnings. Some of those warnings are
probably worth fixing instead of just suppressing in future.

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

connect.c: mark die_initial_contact() NORETURNNguyễn Thái Ngọc Duy Sat, 14 Apr 2018 19:19:43 +0000 (19:19 +0000)

connect.c: mark die_initial_contact() NORETURN

There is a series running in parallel with this one that adds code
like this

switch (...) {
case ...:
die_initial_contact();
case ...:

There is nothing wrong with this. There is no actual falling
through. But since gcc is not that smart and gcc 7.x introduces
-Wimplicit-fallthrough, it raises a false alarm in this case.

This class of warnings may be useful elsewhere, so instead of
suppressing the whole class, let's try to fix just this code. gcc is
smart enough to realize that no execution can continue after a
NORETURN function call and no longer raises the warning.

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

convert: add round trip check based on 'core.checkRound... Lars Schneider Sun, 15 Apr 2018 18:16:10 +0000 (20:16 +0200)

convert: add round trip check based on 'core.checkRoundtripEncoding'

UTF supports lossless conversion round tripping and conversions between
UTF and other encodings are mostly round trip safe as Unicode aims to be
a superset of all other character encodings. However, certain encodings
(e.g. SHIFT-JIS) are known to have round trip issues [1].

Add 'core.checkRoundtripEncoding', which contains a comma separated
list of encodings, to define for what encodings Git should check the
conversion round trip if they are used in the 'working-tree-encoding'
attribute.

Set SHIFT-JIS as default value for 'core.checkRoundtripEncoding'.

[1] https://support.microsoft.com/en-us/help/170559/prb-conversion-problem-between-shift-jis-and-unicode

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

convert: add tracing for 'working-tree-encoding' attributeLars Schneider Sun, 15 Apr 2018 18:16:09 +0000 (20:16 +0200)

convert: add tracing for 'working-tree-encoding' attribute

Add the GIT_TRACE_WORKING_TREE_ENCODING environment variable to enable
tracing for content that is reencoded with the 'working-tree-encoding'
attribute. This is useful to debug encoding issues.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

convert: check for detectable errors in UTF encodingsLars Schneider Sun, 15 Apr 2018 18:16:08 +0000 (20:16 +0200)

convert: check for detectable errors in UTF encodings

Check that new content is valid with respect to the user defined
'working-tree-encoding' attribute.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

convert: add 'working-tree-encoding' attributeLars Schneider Sun, 15 Apr 2018 18:16:07 +0000 (20:16 +0200)

convert: add 'working-tree-encoding' attribute

Git recognizes files encoded with ASCII or one of its supersets (e.g.
UTF-8 or ISO-8859-1) as text files. All other encodings are usually
interpreted as binary and consequently built-in Git text processing
tools (e.g. 'git diff') as well as most Git web front ends do not
visualize the content.

Add an attribute to tell Git what encoding the user has defined for a
given file. If the content is added to the index, then Git reencodes
the content to a canonical UTF-8 representation. On checkout Git will
reverse this operation.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

utf8: add function to detect a missing UTF-16/32 BOMLars Schneider Sun, 15 Apr 2018 18:16:06 +0000 (20:16 +0200)

utf8: add function to detect a missing UTF-16/32 BOM

If the endianness is not defined in the encoding name, then let's
be strict and require a BOM to avoid any encoding confusion. The
is_missing_required_utf_bom() function returns true if a required BOM
is missing.

The Unicode standard instructs to assume big-endian if there in no BOM
for UTF-16/32 [1][2]. However, the W3C/WHATWG encoding standard used
in HTML5 recommends to assume little-endian to "deal with deployed
content" [3]. Strictly requiring a BOM seems to be the safest option
for content in Git.

This function is used in a subsequent commit.

[1] http://unicode.org/faq/utf_bom.html#gen6
[2] http://www.unicode.org/versions/Unicode10.0.0/ch03.pdf
Section 3.10, D98, page 132
[3] https://encoding.spec.whatwg.org/#utf-16le

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

utf8: add function to detect prohibited UTF-16/32 BOMLars Schneider Sun, 15 Apr 2018 18:16:05 +0000 (20:16 +0200)

utf8: add function to detect prohibited UTF-16/32 BOM

Whenever a data stream is declared to be UTF-16BE, UTF-16LE, UTF-32BE
or UTF-32LE a BOM must not be used [1]. The function returns true if
this is the case.

This function is used in a subsequent commit.

[1] http://unicode.org/faq/utf_bom.html#bom10

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

utf8: teach same_encoding() alternative UTF encoding... Lars Schneider Sun, 15 Apr 2018 18:16:04 +0000 (20:16 +0200)

utf8: teach same_encoding() alternative UTF encoding names

The function same_encoding() could only recognize alternative names for
UTF-8 encodings. Teach it to recognize all kinds of alternative UTF
encoding names (e.g. utf16).

While we are at it, fix a crash that would occur if same_encoding() was
called with a NULL argument and a non-NULL argument.

This function is used in a subsequent commit.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mem-pool: move reusable parts of memory pool into its... Jameson Miller Wed, 11 Apr 2018 18:37:55 +0000 (18:37 +0000)

mem-pool: move reusable parts of memory pool into its own file

This moves the reusable parts of the memory pool logic used by
fast-import.c into its own file for use by other components.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace-object: allow lookup_replace_object to handle... Stefan Beller Thu, 12 Apr 2018 00:21:18 +0000 (17:21 -0700)

replace-object: allow lookup_replace_object to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace-object: allow do_lookup_replace_object to handl... Stefan Beller Thu, 12 Apr 2018 00:21:17 +0000 (17:21 -0700)

replace-object: allow do_lookup_replace_object to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace-object: allow prepare_replace_object to handle... Stefan Beller Thu, 12 Apr 2018 00:21:16 +0000 (17:21 -0700)

replace-object: allow prepare_replace_object to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: allow for_each_replace_ref to handle arbitrary... Stefan Beller Thu, 12 Apr 2018 00:21:15 +0000 (17:21 -0700)

refs: allow for_each_replace_ref to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: store the main ref store inside the repository... Stefan Beller Thu, 12 Apr 2018 00:21:14 +0000 (17:21 -0700)

refs: store the main ref store inside the repository struct

This moves the 'main_ref_store', which was a global variable in refs.c
into the repository struct.

This patch does not deal with the parts in the refs subsystem which deal
with the submodules there. A later patch needs to get rid of the submodule
exposure in the refs API, such as 'get_submodule_ref_store(path)'.

Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace-object: add repository argument to lookup_repla... Stefan Beller Thu, 12 Apr 2018 00:21:13 +0000 (17:21 -0700)

replace-object: add repository argument to lookup_replace_object

Add a repository argument to allow callers of lookup_replace_object
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace-object: add repository argument to do_lookup_re... Stefan Beller Thu, 12 Apr 2018 00:21:12 +0000 (17:21 -0700)

replace-object: add repository argument to do_lookup_replace_object

Add a repository argument to allow the do_lookup_replace_object caller
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace-object: add repository argument to prepare_repl... Stefan Beller Thu, 12 Apr 2018 00:21:11 +0000 (17:21 -0700)

replace-object: add repository argument to prepare_replace_object

Add a repository argument to allow the prepare_replace_object caller
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: add repository argument to for_each_replace_refStefan Beller Thu, 12 Apr 2018 00:21:10 +0000 (17:21 -0700)

refs: add repository argument to for_each_replace_ref

Add a repository argument to allow for_each_replace_ref callers to be
more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: add repository argument to get_main_ref_storeStefan Beller Thu, 12 Apr 2018 00:21:09 +0000 (17:21 -0700)

refs: add repository argument to get_main_ref_store

Add a repository argument to allow the get_main_ref_store caller
to be more specific about which repository to handle. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace-object: check_replace_refs is safe in multi... Stefan Beller Thu, 12 Apr 2018 00:21:08 +0000 (17:21 -0700)

replace-object: check_replace_refs is safe in multi repo environment

In e1111cef23 (inline lookup_replace_object() calls, 2011-05-15) a shortcut
for checking the object replacement was added by setting check_replace_refs
to 0 once the replacements were evaluated to not exist. This works fine in
with the assumption of only one repository in existence.

The assumption won't hold true any more when we work on multiple instances
of a repository structs (e.g. one struct per submodule), as the first
repository to be inspected may have no replacements and would set the
global variable. Other repositories would then completely omit their
evaluation of replacements.

This reverts back the meaning of the flag `check_replace_refs` of
"Do we need to check with the lookup table?" to "Do we need to read
the replacement definition?", adding the bypassing logic to
lookup_replace_object after the replacement definition was read.
As with the original patch, delay the renaming of the global variable

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace-object: eliminate replace objects prepared... Stefan Beller Thu, 12 Apr 2018 00:21:07 +0000 (17:21 -0700)

replace-object: eliminate replace objects prepared flag

Make the oidmap a pointer.

That way we eliminate the need for the global boolean
variable 'replace_object_prepared' as we can put this information
into the pointer being NULL or not.

Another advantage of this is that we would more quickly catch
code that tries to access replace-map without initializing it.

This also allows the '#include "oidmap.h"' introduced in a previous
patch to be replaced by the forward declaration of 'struct oidmap;'.
Keeping the type opaque discourages circumventing accessor functions;
not dragging in other headers avoids some compile time overhead.

One disadvantage of this is change is performance as we need to
pay the overhead for a malloc. The alternative of moving the
global variable into the object store is less modular code.

Helped-by: René Scharfe <l.s.r@web.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

object-store: move lookup_replace_object to replace... Stefan Beller Thu, 12 Apr 2018 00:21:06 +0000 (17:21 -0700)

object-store: move lookup_replace_object to replace-object.h

lookup_replace_object is a low-level function that most users of the
object store do not need to use directly.

Move it to replace-object.h to avoid a dependency loop in an upcoming
change to its inline definition that will make use of repository.h.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace-object: move replace_map to object storeStefan Beller Thu, 12 Apr 2018 00:21:05 +0000 (17:21 -0700)

replace-object: move replace_map to object store

The relationship between an object X and another object Y that
replaces the object X is defined only within the scope of a
single repository.

The exception in reachability rule around these replacement objects
is also local to a repository (i.e. if traversal from refs reaches
X, then both X and Y are reachable and need to be kept from gc).

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

replace_object: use oidmapRené Scharfe Thu, 12 Apr 2018 00:21:04 +0000 (17:21 -0700)

replace_object: use oidmap

Load the replace objects into an oidmap to allow for easy lookups in
constant time.

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

SubmittingPatches: mention the git contacts commandThomas Gummerer Wed, 11 Apr 2018 20:20:00 +0000 (21:20 +0100)

SubmittingPatches: mention the git contacts command

Instead of just mentioning 'git blame' and 'git shortlog', which make it
quite hard for new contributors to pick out the appropriate list of
people to cc on their patch series, mention the 'git contacts' utility,
which makes it much easier to get a reasonable list of contacts for a
change.

This should help new contributors pick out a reasonable cc list by
simply using a single command.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-import: introduce mem_pool typeJameson Miller Wed, 11 Apr 2018 18:37:54 +0000 (18:37 +0000)

fast-import: introduce mem_pool type

Introduce the mem_pool type which encapsulates all the information necessary to
manage a pool of memory. This change moves the existing variables in
fast-import used to support the global memory pool to use this structure. It
also renames variables that are no longer used by memory pools to reflect their
more scoped usage.

These changes allow for the multiple instances of a memory pool to
exist and be reused outside of fast-import. In a future commit the
mem_pool type will be moved to its own file.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-import: rename mem_pool type to mp_blockJameson Miller Wed, 11 Apr 2018 18:37:53 +0000 (18:37 +0000)

fast-import: rename mem_pool type to mp_block

This is part of a patch series to extract the memory pool logic in
fast-import into a more generalized version. The existing mem_pool type
maps more closely to a "block of memory" (mp_block) in the more
generalized memory pool. This commit renames the mem_pool to mp_block to
reduce churn in future patches.

Signed-off-by: Jameson Miller <jamill@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'svn/authors-prog-2' of git://bogomips... Junio C Hamano Wed, 11 Apr 2018 23:05:28 +0000 (08:05 +0900)

Merge branch 'svn/authors-prog-2' of git://bogomips.org/git-svn

* 'svn/authors-prog-2' of git://bogomips.org/git-svn:
git-svn: allow empty email-address using authors-prog and authors-file
git-svn: search --authors-prog in PATH too

replace_object.c: rename to use dash in file nameStefan Beller Tue, 10 Apr 2018 21:26:21 +0000 (14:26 -0700)

replace_object.c: rename to use dash in file name

This is more consistent with the project style. The majority of
Git's source files use dashes in preference to underscores in their file
names.

Noticed while adding a header corresponding to this file.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>

sha1_file.c: rename to use dash in file nameStefan Beller Tue, 10 Apr 2018 21:26:20 +0000 (14:26 -0700)

sha1_file.c: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>

sha1_name.c: rename to use dash in file nameStefan Beller Tue, 10 Apr 2018 21:26:19 +0000 (14:26 -0700)

sha1_name.c: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>

exec_cmd: rename to use dash in file nameStefan Beller Tue, 10 Apr 2018 21:26:18 +0000 (14:26 -0700)

exec_cmd: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>

unicode_width.h: rename to use dash in file nameStefan Beller Tue, 10 Apr 2018 21:26:17 +0000 (14:26 -0700)

unicode_width.h: rename to use dash in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Also adjust contrib/update-unicode as well.

Signed-off-by: Stefan Beller <sbeller@google.com>

write_or_die.c: rename to use dashes in file nameStefan Beller Tue, 10 Apr 2018 21:26:16 +0000 (14:26 -0700)

write_or_die.c: rename to use dashes in file name

This is more consistent with the project style. The majority of Git's
source files use dashes in preference to underscores in their file names.

Signed-off-by: Stefan Beller <sbeller@google.com>

mingw/msvc: use the new-style RUNTIME_PREFIX helperJohannes Schindelin Tue, 10 Apr 2018 15:05:46 +0000 (11:05 -0400)

mingw/msvc: use the new-style RUNTIME_PREFIX helper

This change also allows us to stop overriding argv[0] with the absolute
path of the executable, allowing us to preserve e.g. the case of the
executable's file name.

This fixes https://github.com/git-for-windows/git/issues/1496 partially.

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

exec_cmd: provide a new-style RUNTIME_PREFIX helper... Johannes Schindelin Tue, 10 Apr 2018 15:05:45 +0000 (11:05 -0400)

exec_cmd: provide a new-style RUNTIME_PREFIX helper for Windows

The RUNTIME_PREFIX feature comes from Git for Windows, but it was
enhanced to allow support for other platforms. While changing the
original idea, the concept was also improved by not forcing argv[0] to
be adjusted.

Let's allow the same for Windows by implementing a helper just as for
the other platforms.

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

exec_cmd: RUNTIME_PREFIX on some POSIX systemsDan Jacques Tue, 10 Apr 2018 15:05:44 +0000 (11:05 -0400)

exec_cmd: RUNTIME_PREFIX on some POSIX systems

Enable Git to resolve its own binary location using a variety of
OS-specific and generic methods, including:

- procfs via "/proc/self/exe" (Linux)
- _NSGetExecutablePath (Darwin)
- KERN_PROC_PATHNAME sysctl on BSDs.
- argv0, if absolute (all, including Windows).

This is used to enable RUNTIME_PREFIX support for non-Windows systems,
notably Linux and Darwin. When configured with RUNTIME_PREFIX, Git will
do a best-effort resolution of its executable path and automatically use
this as its "exec_path" for relative helper and data lookups, unless
explicitly overridden.

Small incidental formatting cleanup of "exec_cmd.c".

Signed-off-by: Dan Jacques <dnj@google.com>
Thanks-to: Robbie Iannucci <iannucci@google.com>
Thanks-to: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: add Perl runtime prefix supportDan Jacques Tue, 10 Apr 2018 15:05:43 +0000 (11:05 -0400)

Makefile: add Perl runtime prefix support

Broaden the RUNTIME_PREFIX flag to configure Git's Perl scripts to
locate the Git installation's Perl support libraries by resolving
against the script's path, rather than hard-coding that path at
build-time. Hard-coding at build time worked on previous
RUNTIME_PREFIX configurations (i.e., Windows) because the Perl
scripts were run within a virtual filesystem whose paths were
consistent regardless of the location of the actual installation.
This will no longer be the case for non-Windows RUNTIME_PREFIX users.

When enabled, RUNTIME_PREFIX now requires Perl's system paths to be
expressed relative to a common installation directory in the Makefile,
and uses that relationship to locate support files based on the known
starting point of the script being executed, much like RUNTIME_PREFIX
does for the Git binary.

This change enables Git's Perl scripts to work when their Git installation
is relocated or moved to another system, even when they are not in a
virtual filesystem environment.

Signed-off-by: Dan Jacques <dnj@google.com>
Thanks-to: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Thanks-to: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: generate Perl header from template fileDan Jacques Tue, 10 Apr 2018 15:05:42 +0000 (11:05 -0400)

Makefile: generate Perl header from template file

Currently, the generated Perl script headers are emitted by commands in
the Makefile. This mechanism restricts options to introduce alternative
header content, needed by Perl runtime prefix support, and obscures the
origin of the Perl script header.

Change the Makefile to generate a header by processing a template file and
move the header content into the "perl/" subdirectory. The generated
header content will now be stored in the "GIT-PERL-HEADER" file. This
allows the content of the Perl header to be controlled by changing the path
of the template in the Makefile.

Signed-off-by: Dan Jacques <dnj@google.com>
Thanks-to: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Thanks-to: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fsmonitor: force index write after full scanBen Peart Tue, 10 Apr 2018 18:14:31 +0000 (14:14 -0400)

fsmonitor: force index write after full scan

fsmonitor currently only flags the index as dirty if the extension is being
added or removed. This is a performance optimization that recognizes you can
stat() a lot of files in less time than it takes to write out an updated index.

This patch makes a small enhancement and flags the index dirty if we end up
having to stat() all files and scan the entire working directory. The assumption
being that must be expensive or you would not have turned on the feature.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Revert "Merge branch 'en/rename-directory-detection'"Junio C Hamano Wed, 11 Apr 2018 09:07:11 +0000 (18:07 +0900)

Revert "Merge branch 'en/rename-directory-detection'"

This reverts commit e4bb62fa1eeee689744b413e29a50b4d1dae6886, reversing
changes made to 468165c1d8a442994a825f3684528361727cd8c0.

The topic appears to inflict severe regression in renaming merges,
even though the promise of it was that it would improve them.

We do not yet know which exact change in the topic was wrong, but in
the meantime, let's play it safe and revert it out of 'master'
before real Git-using projects are harmed.

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

fsmonitor: fix incorrect buffer size when printing... Ben Peart Tue, 10 Apr 2018 18:43:43 +0000 (18:43 +0000)

fsmonitor: fix incorrect buffer size when printing version number

This is a trivial bug fix for passing the incorrect size to snprintf() when
outputting the version. It should be passing the size of the destination buffer
rather than the size of the value being printed.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/perf: add scripts to bisect performance regressionsChristian Couder Sun, 8 Apr 2018 09:35:13 +0000 (11:35 +0200)

t/perf: add scripts to bisect performance regressions

The new bisect_regression script can be used to automatically bisect
performance regressions. It will pass the new bisect_run_script to
`git bisect run`.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

perf/run: add --subsection optionChristian Couder Sun, 8 Apr 2018 09:35:12 +0000 (11:35 +0200)

perf/run: add --subsection option

This new option makes it possible to run perf tests as defined
in only one subsection of a config file.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

The third batch for 2.18Junio C Hamano Wed, 11 Apr 2018 04:13:49 +0000 (13:13 +0900)

The third batch for 2.18

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

Merge branch 'eb/cred-helper-ignore-sigpipe'Junio C Hamano Wed, 11 Apr 2018 04:09:57 +0000 (13:09 +0900)

Merge branch 'eb/cred-helper-ignore-sigpipe'

When credential helper exits very quickly without reading its
input, it used to cause Git to die with SIGPIPE, which has been
fixed.

* eb/cred-helper-ignore-sigpipe:
credential: ignore SIGPIPE when writing to credential helpers

Merge branch 'lv/tls-1.3'Junio C Hamano Wed, 11 Apr 2018 04:09:57 +0000 (13:09 +0900)

Merge branch 'lv/tls-1.3'

When built with more recent cURL, GIT_SSL_VERSION can now specify
"tlsv1.3" as its value.

* lv/tls-1.3:
http: allow use of TLS 1.3

Merge branch 'pk/test-avoid-pipe-hiding-exit-status'Junio C Hamano Wed, 11 Apr 2018 04:09:56 +0000 (13:09 +0900)

Merge branch 'pk/test-avoid-pipe-hiding-exit-status'

Test cleanup.

* pk/test-avoid-pipe-hiding-exit-status:
test: avoid pipes in git related commands for test

Merge branch 'rs/status-with-removed-submodule'Junio C Hamano Wed, 11 Apr 2018 04:09:56 +0000 (13:09 +0900)

Merge branch 'rs/status-with-removed-submodule'

"git submodule status" misbehaved on a submodule that has been
removed from the working tree.

* rs/status-with-removed-submodule:
submodule: check for NULL return of get_submodule_ref_store()

Merge branch 'nd/combined-test-helper'Junio C Hamano Wed, 11 Apr 2018 04:09:56 +0000 (13:09 +0900)

Merge branch 'nd/combined-test-helper'

Small test-helper programs have been consolidated into a single
binary.

* nd/combined-test-helper: (36 commits)
t/helper: merge test-write-cache into test-tool
t/helper: merge test-wildmatch into test-tool
t/helper: merge test-urlmatch-normalization into test-tool
t/helper: merge test-subprocess into test-tool
t/helper: merge test-submodule-config into test-tool
t/helper: merge test-string-list into test-tool
t/helper: merge test-strcmp-offset into test-tool
t/helper: merge test-sigchain into test-tool
t/helper: merge test-sha1-array into test-tool
t/helper: merge test-scrap-cache-tree into test-tool
t/helper: merge test-run-command into test-tool
t/helper: merge test-revision-walking into test-tool
t/helper: merge test-regex into test-tool
t/helper: merge test-ref-store into test-tool
t/helper: merge test-read-cache into test-tool
t/helper: merge test-prio-queue into test-tool
t/helper: merge test-path-utils into test-tool
t/helper: merge test-online-cpus into test-tool
t/helper: merge test-mktemp into test-tool
t/helper: merge (unused) test-mergesort into test-tool
...

Merge branch 'sb/packfiles-in-repository'Junio C Hamano Wed, 11 Apr 2018 04:09:55 +0000 (13:09 +0900)

Merge branch 'sb/packfiles-in-repository'

Refactoring of the internal global data structure continues.

* sb/packfiles-in-repository:
packfile: keep prepare_packed_git() private
packfile: allow find_pack_entry to handle arbitrary repositories
packfile: add repository argument to find_pack_entry
packfile: allow reprepare_packed_git to handle arbitrary repositories
packfile: allow prepare_packed_git to handle arbitrary repositories
packfile: allow prepare_packed_git_one to handle arbitrary repositories
packfile: add repository argument to reprepare_packed_git
packfile: add repository argument to prepare_packed_git
packfile: add repository argument to prepare_packed_git_one
packfile: allow install_packed_git to handle arbitrary repositories
packfile: allow rearrange_packed_git to handle arbitrary repositories
packfile: allow prepare_packed_git_mru to handle arbitrary repositories

Merge branch 'sb/object-store'Junio C Hamano Wed, 11 Apr 2018 04:09:55 +0000 (13:09 +0900)

Merge branch 'sb/object-store'

Refactoring the internal global data structure to make it possible
to open multiple repositories, work with and then close them.

Rerolled by Duy on top of a separate preliminary clean-up topic.
The resulting structure of the topics looked very sensible.

* sb/object-store: (27 commits)
sha1_file: allow sha1_loose_object_info to handle arbitrary repositories
sha1_file: allow map_sha1_file to handle arbitrary repositories
sha1_file: allow map_sha1_file_1 to handle arbitrary repositories
sha1_file: allow open_sha1_file to handle arbitrary repositories
sha1_file: allow stat_sha1_file to handle arbitrary repositories
sha1_file: allow sha1_file_name to handle arbitrary repositories
sha1_file: add repository argument to sha1_loose_object_info
sha1_file: add repository argument to map_sha1_file
sha1_file: add repository argument to map_sha1_file_1
sha1_file: add repository argument to open_sha1_file
sha1_file: add repository argument to stat_sha1_file
sha1_file: add repository argument to sha1_file_name
sha1_file: allow prepare_alt_odb to handle arbitrary repositories
sha1_file: allow link_alt_odb_entries to handle arbitrary repositories
sha1_file: add repository argument to prepare_alt_odb
sha1_file: add repository argument to link_alt_odb_entries
sha1_file: add repository argument to read_info_alternates
sha1_file: add repository argument to link_alt_odb_entry
sha1_file: add raw_object_store argument to alt_odb_usable
pack: move approximate object count to object store
...

Merge branch 'jc/test-must-be-empty'Junio C Hamano Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)

Merge branch 'jc/test-must-be-empty'

Test helper update.

* jc/test-must-be-empty:
test_must_be_empty: simplify file existence check

Merge branch 'cc/perf-aggregate-sort'Junio C Hamano Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)

Merge branch 'cc/perf-aggregate-sort'

Perf-test update.

* cc/perf-aggregate-sort:
perf/aggregate: add --sort-by=regression option
perf/aggregate: add display_dir()

Merge branch 'ab/doc-hash-brokenness'Junio C Hamano Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)

Merge branch 'ab/doc-hash-brokenness'

Doc updates.

* ab/doc-hash-brokenness:
doc hash-function-transition: clarify what SHAttered means
doc hash-function-transition: clarify how older gits die on NewHash

Merge branch 'bc/hash-independent-tests'Junio C Hamano Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)

Merge branch 'bc/hash-independent-tests'

Tests that rely on the exact hardcoded values of object names have
been updated in preparation for hash function migration.

* bc/hash-independent-tests:
t2107: abstract away SHA-1-specific constants
t2101: abstract away SHA-1-specific constants
t2101: modernize test style
t2020: abstract away SHA-1 specific constants
t1507: abstract away SHA-1-specific constants
t1411: abstract away SHA-1-specific constants
t1405: sort reflog entries in a hash-independent way
t1300: abstract away SHA-1-specific constants
t1304: abstract away SHA-1-specific constants
t1011: abstract away SHA-1-specific constants

Merge branch 'ab/drop-contrib-examples'Junio C Hamano Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)

Merge branch 'ab/drop-contrib-examples'

* ab/drop-contrib-examples:
Remove contrib/examples/*

commit-graph: implement "--append" optionDerrick Stolee Tue, 10 Apr 2018 12:56:08 +0000 (08:56 -0400)

commit-graph: implement "--append" option

Teach git-commit-graph to add all commits from the existing
commit-graph file to the file about to be written. This should be
used when adding new commits without performing garbage collection.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit-graph: build graph from starting commitsDerrick Stolee Tue, 10 Apr 2018 12:56:07 +0000 (08:56 -0400)

commit-graph: build graph from starting commits

Teach git-commit-graph to read commits from stdin when the
--stdin-commits flag is specified. Commits reachable from these
commits are added to the graph. This is a much faster way to construct
the graph than inspecting all packed objects, but is restricted to
known tips.

For the Linux repository, 700,000+ commits were added to the graph
file starting from 'master' in 7-9 seconds, depending on the number
of packfiles in the repo (1, 24, or 120).

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit-graph: read only from specific pack-indexesDerrick Stolee Tue, 10 Apr 2018 12:56:06 +0000 (08:56 -0400)

commit-graph: read only from specific pack-indexes

Teach git-commit-graph to inspect the objects only in a certain list
of pack-indexes within the given pack directory. This allows updating
the commit graph iteratively.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: integrate commit graph with commit parsingDerrick Stolee Tue, 10 Apr 2018 12:56:05 +0000 (08:56 -0400)

commit: integrate commit graph with commit parsing

Teach Git to inspect a commit graph file to supply the contents of a
struct commit when calling parse_commit_gently(). This implementation
satisfies all post-conditions on the struct commit, including loading
parents, the root tree, and the commit date.

If core.commitGraph is false, then do not check graph files.

In test script t5318-commit-graph.sh, add output-matching conditions on
read-only graph operations.

By loading commits from the graph instead of parsing commit buffers, we
save a lot of time on long commit walks. Here are some performance
results for a copy of the Linux repository where 'master' has 678,653
reachable commits and is behind 'origin/master' by 59,929 commits.

| Command | Before | After | Rel % |
|----------------------------------|--------|--------|-------|
| log --oneline --topo-order -1000 | 8.31s | 0.94s | -88% |
| branch -vv | 1.02s | 0.14s | -86% |
| rev-list --all | 5.89s | 1.07s | -81% |
| rev-list --all --objects | 66.15s | 58.45s | -11% |

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit-graph: close under reachabilityDerrick Stolee Tue, 10 Apr 2018 12:56:04 +0000 (08:56 -0400)

commit-graph: close under reachability

Teach write_commit_graph() to walk all parents from the commits
discovered in packfiles. This prevents gaps given by loose objects or
previously-missed packfiles.

Also automatically add commits from the existing graph file, if it
exists.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit-graph: add core.commitGraph settingDerrick Stolee Tue, 10 Apr 2018 12:56:03 +0000 (08:56 -0400)

commit-graph: add core.commitGraph setting

The commit graph feature is controlled by the new core.commitGraph config
setting. This defaults to 0, so the feature is opt-in.

The intention of core.commitGraph is that a user can always stop checking
for or parsing commit graph files if core.commitGraph=0.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit-graph: implement git commit-graph readDerrick Stolee Tue, 10 Apr 2018 12:56:02 +0000 (08:56 -0400)

commit-graph: implement git commit-graph read

Teach git-commit-graph to read commit graph files and summarize their contents.

Use the read subcommand to verify the contents of a commit graph file in the
tests.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

perl: fix installing modules from contribChristian Hesse Tue, 10 Apr 2018 13:36:41 +0000 (15:36 +0200)

perl: fix installing modules from contrib

Commit 20d2a30f (Makefile: replace perl/Makefile.PL with simple make rules)
removed a target that allowed Makefiles from contrib/ to get the correct
install path. This introduces a new target for main Makefile and fixes
installation for Mediawiki module.

v2: Pass prefix as that can have influence as well, add single quotes
for _SQ variant.

Signed-off-by: Christian Hesse <mail@eworm.de>

The second batch for 2.18Junio C Hamano Tue, 10 Apr 2018 07:32:45 +0000 (16:32 +0900)

The second batch for 2.18

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

Merge branch 'ys/bisect-object-id-missing-conversion... Junio C Hamano Tue, 10 Apr 2018 07:28:24 +0000 (16:28 +0900)

Merge branch 'ys/bisect-object-id-missing-conversion-fix'

Code clean-up.

* ys/bisect-object-id-missing-conversion-fix:
bisect: use oid_to_hex() for converting object_id hashes to hex strings

Merge branch 'yk/filter-branch-non-committish-refs'Junio C Hamano Tue, 10 Apr 2018 07:28:23 +0000 (16:28 +0900)

Merge branch 'yk/filter-branch-non-committish-refs'

when refs that do not point at committish are given, "git
filter-branch" gave a misleading error messages. This has been
corrected.

* yk/filter-branch-non-committish-refs:
filter-branch: fix errors caused by refs that point at non-committish

Merge branch 'nd/trace-with-env'Junio C Hamano Tue, 10 Apr 2018 07:28:22 +0000 (16:28 +0900)

Merge branch 'nd/trace-with-env'

Code cleanup.

* nd/trace-with-env:
run-command: use strbuf_addstr() for adding a string to a strbuf

Merge branch 'nd/parseopt-completion-more'Junio C Hamano Tue, 10 Apr 2018 07:28:22 +0000 (16:28 +0900)

Merge branch 'nd/parseopt-completion-more'

The mechanism to use parse-options API to automate the command line
completion continues to get extended and polished.

* nd/parseopt-completion-more:
completion: use __gitcomp_builtin in _git_cherry
completion: use __gitcomp_builtin in _git_ls_tree
completion: delete option-only completion commands
completion: add --option completion for most builtin commands
completion: factor out _git_xxx calling code
completion: mention the oldest version we need to support
git.c: add hidden option --list-parseopt-builtins
git.c: move cmd_struct declaration up

Merge branch 'ds/bsearch-hash'Junio C Hamano Tue, 10 Apr 2018 07:28:22 +0000 (16:28 +0900)

Merge branch 'ds/bsearch-hash'

Code to find the length to uniquely abbreviate object names based
on packfile content, which is a relatively recent addtion, has been
optimized to use the same fan-out table.

* ds/bsearch-hash:
sha1_name: use bsearch_pack() in unique_in_pack()
sha1_name: use bsearch_pack() for abbreviations
packfile: define and use bsearch_pack()
sha1_name: convert struct min_abbrev_data to object_id

Merge branch 'ws/rebase-p'Junio C Hamano Tue, 10 Apr 2018 07:28:21 +0000 (16:28 +0900)

Merge branch 'ws/rebase-p'

Code clean-up.

* ws/rebase-p:
rebase: remove merges_option and a blank line
rebase: remove unused code paths from git_rebase__interactive__preserve_merges
rebase: remove unused code paths from git_rebase__interactive
rebase: add and use git_rebase__interactive__preserve_merges
rebase: extract functions out of git_rebase__interactive
rebase: reindent function git_rebase__interactive
rebase: update invocation of rebase dot-sourced scripts
rebase-interactive: simplify pick_on_preserving_merges

Merge branch 'jk/diff-highlight-graph-fix'Junio C Hamano Tue, 10 Apr 2018 07:28:21 +0000 (16:28 +0900)

Merge branch 'jk/diff-highlight-graph-fix'

"diff-highlight" filter (in contrib/) learned to undertand "git log
--graph" output better.

* jk/diff-highlight-graph-fix:
diff-highlight: detect --graph by indent
diff-highlight: use flush() helper consistently
diff-highlight: test graphs with --color
diff-highlight: test interleaved parallel lines of history
diff-highlight: prefer "echo" to "cat" in tests
diff-highlight: use test_tick in graph test
diff-highlight: correct test graph diagram

Merge branch 'nd/remove-ignore-env-field'Junio C Hamano Tue, 10 Apr 2018 07:28:20 +0000 (16:28 +0900)

Merge branch 'nd/remove-ignore-env-field'

Code clean-up for the "repository" abstraction.

* nd/remove-ignore-env-field:
repository.h: add comment and clarify repo_set_gitdir
repository: delete ignore_env member
sha1_file.c: move delayed getenv(altdb) back to setup_git_env()
repository.c: delete dead functions
repository.c: move env-related setup code back to environment.c
repository: initialize the_repository in main()

Merge branch 'ps/contains-id-error-message'Junio C Hamano Tue, 10 Apr 2018 07:28:20 +0000 (16:28 +0900)

Merge branch 'ps/contains-id-error-message'

"git tag --contains no-such-commit" gave a full list of options
after giving an error message.

* ps/contains-id-error-message:
parse-options: do not show usage upon invalid option value

completion: improve ls-files filter performanceClemens Buchacher Wed, 4 Apr 2018 07:46:58 +0000 (09:46 +0200)

completion: improve ls-files filter performance

From the output of ls-files, we remove all but the leftmost path
component and then we eliminate duplicates. We do this in a while loop,
which is a performance bottleneck when the number of iterations is large
(e.g. for 60000 files in linux.git).

$ COMP_WORDS=(git status -- ar) COMP_CWORD=3; time _git

real 0m11.876s
user 0m4.685s
sys 0m6.808s

Replacing the loop with the cut command improves performance
significantly:

$ COMP_WORDS=(git status -- ar) COMP_CWORD=3; time _git

real 0m1.372s
user 0m0.263s
sys 0m0.167s

The measurements were done with Msys2 bash, which is used by Git for
Windows.

When filtering the ls-files output we take care not to touch absolute
paths. This is redundant, because ls-files will never output absolute
paths. Remove the unnecessary operations.

The issue was reported here:
https://github.com/git-for-windows/git/issues/1533

Signed-off-by: Clemens Buchacher <drizzd@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/config.c: treat type specifiers singularlyTaylor Blau Mon, 9 Apr 2018 22:46:54 +0000 (15:46 -0700)

builtin/config.c: treat type specifiers singularly

Internally, we represent `git config`'s type specifiers as a bitset
using OPT_BIT. 'bool' is 1<<0, 'int' is 1<<1, and so on. This technique
allows for the representation of multiple type specifiers in the `int
types` field, but this multi-representation is left unused.

In fact, `git config` will not accept multiple type specifiers at a
time, as indicated by:

$ git config --int --bool some.section
error: only one type at a time.

This patch uses `OPT_SET_INT` to prefer the _last_ mentioned type
specifier, so that the above command would instead be valid, and a
synonym of:

$ git config --bool some.section

This change is motivated by two urges: (1) it does not make sense to
represent a singular type specifier internally as a bitset, only to
complain when there are multiple bits in the set. `OPT_SET_INT` is more
well-suited to this task than `OPT_BIT` is. (2) a future patch will
introduce `--type=<type>`, and we would like not to complain in the
following situation:

$ git config --int --type=int

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

The first batch for 2.18 cycleJunio C Hamano Mon, 9 Apr 2018 23:31:10 +0000 (08:31 +0900)

The first batch for 2.18 cycle

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

Merge branch 'tg/stash-untracked-with-pathspec-fix'Junio C Hamano Mon, 9 Apr 2018 23:25:45 +0000 (08:25 +0900)

Merge branch 'tg/stash-untracked-with-pathspec-fix'

"git stash push -u -- <pathspec>" gave an unnecessary and confusing
error message when there was no tracked files that match the
<pathspec>, which has been fixed.

* tg/stash-untracked-with-pathspec-fix:
stash: drop superfluos pathspec parameter
stash push -u: don't create empty stash
stash push: avoid printing errors
stash: fix nonsense pipeline

Merge branch 'nd/worktree-prune'Junio C Hamano Mon, 9 Apr 2018 23:25:45 +0000 (08:25 +0900)

Merge branch 'nd/worktree-prune'

The way "git worktree prune" worked internally has been simplified,
by assuming how "git worktree move" moves an existing worktree to a
different place.

* nd/worktree-prune:
worktree prune: improve prune logic when worktree is moved
worktree: delete dead code
gc.txt: more details about what gc does

Merge branch 'bc/object-id'Junio C Hamano Mon, 9 Apr 2018 23:25:45 +0000 (08:25 +0900)

Merge branch 'bc/object-id'

Conversion from uchar[20] to struct object_id continues.

* bc/object-id: (36 commits)
convert: convert to struct object_id
sha1_file: introduce a constant for max header length
Convert lookup_replace_object to struct object_id
sha1_file: convert read_sha1_file to struct object_id
sha1_file: convert read_object_with_reference to object_id
tree-walk: convert tree entry functions to object_id
streaming: convert istream internals to struct object_id
tree-walk: convert get_tree_entry_follow_symlinks internals to object_id
builtin/notes: convert static functions to object_id
builtin/fmt-merge-msg: convert remaining code to object_id
sha1_file: convert sha1_object_info* to object_id
Convert remaining callers of sha1_object_info_extended to object_id
packfile: convert unpack_entry to struct object_id
sha1_file: convert retry_bad_packed_offset to struct object_id
sha1_file: convert assert_sha1_type to object_id
builtin/mktree: convert to struct object_id
streaming: convert open_istream to use struct object_id
sha1_file: convert check_sha1_signature to struct object_id
sha1_file: convert read_loose_object to use struct object_id
builtin/index-pack: convert struct ref_delta_entry to object_id
...

Merge branch 'ma/shortlog-revparse'Junio C Hamano Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)

Merge branch 'ma/shortlog-revparse'

"git shortlog cruft" aborted with a BUG message when run outside a
Git repository. The command has been taught to complain about
extra and unwanted arguments on its command line instead in such a
case.

* ma/shortlog-revparse:
shortlog: disallow left-over arguments outside repo
shortlog: add usage-string for stdin-reading
git-shortlog.txt: reorder usages

Merge branch 'ab/install-symlinks'Junio C Hamano Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)

Merge branch 'ab/install-symlinks'

The build procedure learned to optionally use symbolic links
(instead of hardlinks and copies) to install "git-foo" for built-in
commands, whose binaries are all identical.

* ab/install-symlinks:
Makefile: optionally symlink libexec/git-core binaries to bin/git
Makefile: add a gitexecdir_relative variable
Makefile: fix broken bindir_relative variable

Merge branch 'ml/filter-branch-no-op-error'Junio C Hamano Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)

Merge branch 'ml/filter-branch-no-op-error'

"git filter-branch" learned to use a different exit code to allow
the callers to tell the case where there was no new commits to
rewrite from other error cases.

* ml/filter-branch-no-op-error:
filter-branch: return 2 when nothing to rewrite

Merge branch 'ab/pcre-v2'Junio C Hamano Mon, 9 Apr 2018 23:25:43 +0000 (08:25 +0900)

Merge branch 'ab/pcre-v2'

Git can be built to use either v1 or v2 of the PCRE library, and so
far, the build-time configuration USE_LIBPCRE=YesPlease instructed
the build procedure to use v1, but now it means v2. USE_LIBPCRE1
and USE_LIBPCRE2 can be used to explicitly choose which version to
use, as before.

* ab/pcre-v2:
Makefile: make USE_LIBPCRE=YesPlease mean v2, not v1
configure: detect redundant --with-libpcre & --with-libpcre1
configure: fix a regression in PCRE v1 detection

Merge branch 'ti/fetch-everything-local-optim'Junio C Hamano Mon, 9 Apr 2018 23:25:43 +0000 (08:25 +0900)

Merge branch 'ti/fetch-everything-local-optim'

A "git fetch" from a repository with insane number of refs into a
repository that is already up-to-date still wasted too many cycles
making many lstat(2) calls to see if these objects at the tips
exist as loose objects locally. These lstat(2) calls are optimized
away by enumerating all loose objects beforehand.

It is unknown if the new strategy negatively affects existing use
cases, fetching into a repository with many loose objects from a
repository with small number of refs.

* ti/fetch-everything-local-optim:
fetch-pack.c: use oidset to check existence of loose object

Merge branch 'en/rename-directory-detection'Junio C Hamano Mon, 9 Apr 2018 23:25:43 +0000 (08:25 +0900)

Merge branch 'en/rename-directory-detection'

Rename detection logic in "diff" family that is used in "merge" has
learned to guess when all of x/a, x/b and x/c have moved to z/a,
z/b and z/c, it is likely that x/d added in the meantime would also
want to move to z/d by taking the hint that the entire directory
'x' moved to 'z'. A bug causing dirty files involved in a rename
to be overwritten during merge has also been fixed as part of this
work.

* en/rename-directory-detection: (29 commits)
merge-recursive: ensure we write updates for directory-renamed file
merge-recursive: avoid spurious rename/rename conflict from dir renames
directory rename detection: new testcases showcasing a pair of bugs
merge-recursive: fix remaining directory rename + dirty overwrite cases
merge-recursive: fix overwriting dirty files involved in renames
merge-recursive: avoid clobbering untracked files with directory renames
merge-recursive: apply necessary modifications for directory renames
merge-recursive: when comparing files, don't include trees
merge-recursive: check for file level conflicts then get new name
merge-recursive: add computation of collisions due to dir rename & merging
merge-recursive: check for directory level conflicts
merge-recursive: add get_directory_renames()
merge-recursive: make a helper function for cleanup for handle_renames
merge-recursive: split out code for determining diff_filepairs
merge-recursive: make !o->detect_rename codepath more obvious
merge-recursive: fix leaks of allocated renames and diff_filepairs
merge-recursive: introduce new functions to handle rename logic
merge-recursive: move the get_renames() function
directory rename detection: tests for handling overwriting dirty files
directory rename detection: tests for handling overwriting untracked files
...

git_config_set: reuse empty sectionsJohannes Schindelin Mon, 9 Apr 2018 08:32:29 +0000 (10:32 +0200)

git_config_set: reuse empty sections

It can happen quite easily that the last setting in a config section is
removed, and to avoid confusion when there are comments in the config
about that section, we keep a lone section header, i.e. an empty
section.

Now that we use the `event_fn` callback, it is easy to add support for
re-using empty sections, so let's do that.

Note: t5512-ls-remote requires that this change is applied *after* the
patch "git config --unset: remove empty sections (in the common case)":
without that patch, there would be empty `transfer` and `uploadpack`
sections ready for reuse, but in the *wrong* order (and sconsequently,
t5512's "overrides work between mixed transfer/upload-pack hideRefs"
would fail).

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

git config --unset: remove empty sections (in the commo... Johannes Schindelin Mon, 9 Apr 2018 08:32:24 +0000 (10:32 +0200)

git config --unset: remove empty sections (in the common case)

The original reasoning for not removing section headers upon removal of
the last entry went like this: the user could have added comments about
the section, or about the entries therein, and if there were other
comments there, we would not know whether we should remove them.

In particular, a concocted example was presented that looked like this
(and was added to t1300):

# some generic comment on the configuration file itself
# a comment specific to this "section" section.
[section]
# some intervening lines
# that should also be dropped

key = value
# please be careful when you update the above variable

The ideal thing for `git config --unset section.key` in this case would
be to leave only the first line behind, because all the other comments
are now obsolete.

However, this is unfeasible, short of adding a complete Natural Language
Processing module to Git, which seems not only a lot of work, but a
totally unreasonable feature (for little benefit to most users).

Now, the real kicker about this problem is: most users do not edit their
config files at all! In their use case, the config looks like this
instead:

[section]
key = value

... and it is totally obvious what should happen if the entry is
removed: the entire section should vanish.

Let's generalize this observation to this conservative strategy: if we
are removing the last entry from a section, and there are no comments
inside that section nor surrounding it, then remove the entire section.
Otherwise behave as before: leave the now-empty section (including those
comments, even ones about the now-deleted entry).

We have to be extra careful to handle the case where more than one entry
is removed: any subset of them might be the last entries of their
respective sections (and if there are no comments in or around that
section, the section should be removed, too).

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

git_config_set: make use of the config parser's event... Johannes Schindelin Mon, 9 Apr 2018 08:32:20 +0000 (10:32 +0200)

git_config_set: make use of the config parser's event stream

In the recent commit with the title "config: introduce an optional event
stream while parsing", we introduced an optional callback to keep track
of the config parser's events "comment", "white-space", "section header"
and "entry".

One motivation for this feature was to make use of it in the code that
edits the config. And this commit makes it so.

Note: this patch changes the meaning of the `seen` array that records
whether we saw the config entry that is to be edited: previously, it
contained the end offset of the found entry. Now, we introduce a new
array `parsed` that keeps a record of *all* config parser events (with
begin/end offsets), and the items in the `seen` array now point into the
`parsed` array.

There are two reasons why we do it this way:

1. To keep the implementation simple, the config parser's event stream
reports the event only after the config callback was called, so we
would not receive the begin offset otherwise.

2. In the following patches, we will re-use the `parsed` array to fix two
long-standing bugs related to empty sections.

Note that this also makes the code more robust with respect to finding the
begin offset of the part(s) of the config file to be edited, as we no
longer back-track to find the beginning of the line.

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