gitweb.git
fsmonitor: simplify determining the git worktree under... Ben Peart Fri, 10 Nov 2017 21:03:11 +0000 (16:03 -0500)

fsmonitor: simplify determining the git worktree under Windows

Simplify and speed up the process of finding the git worktree when
running on Windows by keeping it in perl and avoiding spawning helper
processes.

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

fsmonitor: store fsmonitor bitmap before splitting... Alex Vandiver Thu, 9 Nov 2017 19:58:10 +0000 (11:58 -0800)

fsmonitor: store fsmonitor bitmap before splitting index

ba1b9cac ("fsmonitor: delay updating state until after split index
is merged", 2017-10-27) resolved the problem of the fsmonitor data
being applied to the non-base index when reading; however, a similar
problem exists when writing the index. Specifically, writing of the
fsmonitor extension happens only after the work to split the index
has been applied -- as such, the information in the index is only
for the non-"base" index, and thus the extension information
contains only partial data.

When saving, compute the ewah bitmap before the index is split, and
store it in the fsmonitor_dirty field, mirroring the behavior that
occurred during reading. fsmonitor_dirty is kept from being leaked by
being freed when the extension data is written -- which always happens
precisely once, no matter the split index configuration.

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fsmonitor: read from getcwd(), not the PWD environment... Alex Vandiver Thu, 9 Nov 2017 19:58:09 +0000 (11:58 -0800)

fsmonitor: read from getcwd(), not the PWD environment variable

Though the process has chdir'd to the root of the working tree, the
PWD environment variable is only guaranteed to be updated accordingly
if a shell is involved -- which is not guaranteed to be the case.
That is, if `/usr/bin/perl` is a binary, $ENV{PWD} is unchanged from
whatever spawned `git` -- if `/usr/bin/perl` is a trivial shell
wrapper to the real `perl`, `$ENV{PWD}` will have been updated to the
root of the working copy.

Update to read from the Cwd module using the `getcwd` syscall, not the
PWD environment variable. The Cygwin case is left unchanged, as it
necessarily _does_ go through a shell.

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fsmonitor: delay updating state until after split index... Alex Vandiver Fri, 27 Oct 2017 23:26:37 +0000 (16:26 -0700)

fsmonitor: delay updating state until after split index is merged

If the fsmonitor extension is used in conjunction with the split index
extension, the set of entries in the index when it is first loaded is
only a subset of the real index. This leads to only the non-"base"
index being marked as CE_FSMONITOR_VALID.

Delay the expansion of the ewah bitmap until after tweak_split_index
has been called to merge in the base index as well.

The new fsmonitor_dirty is kept from being leaked by dint of being
cleaned up in post_read_index_from, which is guaranteed to be called
after do_read_index in read_index_from.

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fsmonitor: document GIT_TRACE_FSMONITORAlex Vandiver Fri, 27 Oct 2017 23:26:36 +0000 (16:26 -0700)

fsmonitor: document GIT_TRACE_FSMONITOR

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fsmonitor: don't bother pretty-printing JSON from watchmanAlex Vandiver Fri, 27 Oct 2017 23:26:35 +0000 (16:26 -0700)

fsmonitor: don't bother pretty-printing JSON from watchman

This provides modest performance savings. Benchmarking with the
following program, with and without `--no-pretty`, we find savings of
23% (0.316s -> 0.242s) in the git repository, and savings of 8% (5.24s
-> 4.86s) on a large repository with 580k files in the working copy.

#!/usr/bin/perl

use strict;
use warnings;
use IPC::Open2;
use JSON::XS;

my $pid = open2(\*CHLD_OUT, \*CHLD_IN, "watchman -j @ARGV")
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";

my $query = qq|["query", "$ENV{PWD}", {}]|;

print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};

JSON::XS->new->utf8->decode($response);

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fsmonitor: set the PWD to the top of the working treeAlex Vandiver Fri, 27 Oct 2017 23:26:34 +0000 (16:26 -0700)

fsmonitor: set the PWD to the top of the working tree

The fsmonitor command inherits the PWD of its caller, which may be
anywhere in the working copy. This makes is difficult for the
fsmonitor command to operate on the whole repository. Specifically,
for the watchman integration, this causes each subdirectory to get its
own watch entry.

Set the CWD to the top of the working directory, for consistency.

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fsmonitor: preserve utf8 filenames in fsmonitor-watchma... Ben Peart Wed, 4 Oct 2017 12:33:39 +0000 (08:33 -0400)

fsmonitor: preserve utf8 filenames in fsmonitor-watchman log

Update the test fsmonitor-watchman integration script to properly
preserve utf8 filenames when outputting the .git/watchman-output.out log
file.

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

fsmonitor: read entirety of watchman outputAlex Vandiver Wed, 4 Oct 2017 06:27:46 +0000 (23:27 -0700)

fsmonitor: read entirety of watchman output

In Perl, setting $/ sets the string that is used as the "record
separator," which sets the boundary that the `<>` construct reads to.
Setting `local $/ = 0666;` evaluates the octal, getting 438, and
stringifies it. Thus, the later read from `<CHLD_OUT>` stops as soon
as it encounters the string "438" in the watchman output, yielding
invalid JSON; repositories containing filenames with SHA1 hashes are
able to trip this easily.

Set `$/` to undefined, thus slurping all output from watchman. Also
close STDIN which is provided to watchman, to better guarantee that we
cannot deadlock with watchman while both attempting to read.

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fsmonitor: MINGW support for watchman integrationBen Peart Wed, 4 Oct 2017 02:09:50 +0000 (11:09 +0900)

fsmonitor: MINGW support for watchman integration

Instead of just taking $ENV{'PWD'}, use the same logic that converts
PWD to $git_work_tree on MSYS_NT in the watchman integration hook
script also on MINGW.

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

fsmonitor: add a performance testBen Peart Fri, 22 Sep 2017 16:35:48 +0000 (12:35 -0400)

fsmonitor: add a performance test

Add a test utility (test-drop-caches) that flushes all changes to disk
then drops file system cache on Windows, Linux, and OSX.

Add a perf test (p7519-fsmonitor.sh) for fsmonitor.

By default, the performance test will utilize the Watchman file system
monitor if it is installed. If Watchman is not installed, it will use a
dummy integration script that does not report any new or modified files.
The dummy script has very little overhead which provides optimistic results.

The performance test will also use the untracked cache feature if it is
available as fsmonitor uses it to speed up scanning for untracked files.

There are 4 environment variables that can be used to alter the default
behavior of the performance test:

GIT_PERF_7519_UNTRACKED_CACHE: used to configure core.untrackedCache
GIT_PERF_7519_SPLIT_INDEX: used to configure core.splitIndex
GIT_PERF_7519_FSMONITOR: used to configure core.fsmonitor
GIT_PERF_7519_DROP_CACHE: if set, the OS caches are dropped between tests

The big win for using fsmonitor is the elimination of the need to scan the
working directory looking for changed and untracked files. If the file
information is all cached in RAM, the benefits are reduced.

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

fsmonitor: add a sample integration script for WatchmanBen Peart Fri, 22 Sep 2017 16:35:47 +0000 (12:35 -0400)

fsmonitor: add a sample integration script for Watchman

This script integrates the new fsmonitor capabilities of git with the
cross platform Watchman file watching service. To use the script:

Download and install Watchman from https://facebook.github.io/watchman/.
Rename the sample integration hook from fsmonitor-watchman.sample to
fsmonitor-watchman. Configure git to use the extension:

git config core.fsmonitor .git/hooks/fsmonitor-watchman

Optionally turn on the untracked cache for optimal performance.

Signed-off-by: Ben Peart <benpeart@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Christian Couder <christian.couder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fsmonitor: add test cases for fsmonitor extensionBen Peart Fri, 22 Sep 2017 16:35:46 +0000 (12:35 -0400)

fsmonitor: add test cases for fsmonitor extension

Test the ability to add/remove the fsmonitor index extension via
update-index.

Test that dirty files returned from the integration script are properly
represented in the index extension and verify that ls-files correctly
reports their state.

Test that ensure status results are correct when using the new fsmonitor
extension. Test untracked, modified, and new files by ensuring the
results are identical to when not using the extension.

Test that if the fsmonitor extension doesn't tell git about a change, it
doesn't discover it on its own. This ensures git is honoring the
extension and that we get the performance benefits desired.

Three test integration scripts are provided:

fsmonitor-all - marks all files as dirty
fsmonitor-none - marks no files as dirty
fsmonitor-watchman - integrates with Watchman with debug logging

To run tests in the test suite while utilizing fsmonitor:

First copy t/t7519/fsmonitor-all to a location in your path and then set
GIT_FORCE_PRELOAD_TEST=true and GIT_FSMONITOR_TEST=fsmonitor-all and run
your tests.

Note: currently when using the test script fsmonitor-watchman on
Windows, many tests fail due to a reported but not yet fixed bug in
Watchman where it holds on to handles for directories and files which
prevents the test directory from being cleaned up properly.

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

split-index: disable the fsmonitor extension when runni... Ben Peart Fri, 22 Sep 2017 16:35:45 +0000 (12:35 -0400)

split-index: disable the fsmonitor extension when running the split index test

The split index test t1700-split-index.sh has hard coded SHA values for
the index. Currently it supports index V4 and V3 but assumes there are
no index extensions loaded.

When manually forcing the fsmonitor extension to be turned on when
running the test suite, the SHA values no longer match which causes the
test to fail.

The potential matrix of index extensions and index versions can is quite
large so instead temporarily disable the extension before attempting to
run the test until the underlying problem of hard coded SHA values is fixed.

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

fsmonitor: add a test tool to dump the index extensionBen Peart Fri, 22 Sep 2017 16:35:44 +0000 (12:35 -0400)

fsmonitor: add a test tool to dump the index extension

Add a test utility (test-dump-fsmonitor) that will dump the fsmonitor
index extension.

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

update-index: add fsmonitor support to update-indexBen Peart Fri, 22 Sep 2017 16:35:43 +0000 (12:35 -0400)

update-index: add fsmonitor support to update-index

Add support in update-index to manually add/remove the fsmonitor
extension via --[no-]fsmonitor flags.

Add support in update-index to manually set/clear the fsmonitor
valid bit via --[no-]fsmonitor-valid flags.

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

ls-files: Add support in ls-files to display the fsmoni... Ben Peart Fri, 22 Sep 2017 16:35:42 +0000 (12:35 -0400)

ls-files: Add support in ls-files to display the fsmonitor valid bit

Add a new command line option (-f) to ls-files to have it use lowercase
letters for 'fsmonitor valid' files

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

fsmonitor: add documentation for the fsmonitor extension.Ben Peart Fri, 22 Sep 2017 16:35:41 +0000 (12:35 -0400)

fsmonitor: add documentation for the fsmonitor extension.

This includes the core.fsmonitor setting, the fsmonitor integration hook,
and the fsmonitor index extension.

Also add documentation for the new fsmonitor options to ls-files and
update-index.

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

fsmonitor: teach git to optionally utilize a file syste... Ben Peart Fri, 22 Sep 2017 16:35:40 +0000 (12:35 -0400)

fsmonitor: teach git to optionally utilize a file system monitor to speed up detecting new or changed files.

When the index is read from disk, the fsmonitor index extension is used
to flag the last known potentially dirty index entries. The registered
core.fsmonitor command is called with the time the index was last
updated and returns the list of files changed since that time. This list
is used to flag any additional dirty cache entries and untracked cache
directories.

We can then use this valid state to speed up preload_index(),
ie_match_stat(), and refresh_cache_ent() as they do not need to lstat()
files to detect potential changes for those entries marked
CE_FSMONITOR_VALID.

In addition, if the untracked cache is turned on valid_cached_dir() can
skip checking directories for new or changed files as fsmonitor will
invalidate the cache only for those directories that have been
identified as having potential changes.

To keep the CE_FSMONITOR_VALID state accurate during git operations;
when git updates a cache entry to match the current state on disk,
it will now set the CE_FSMONITOR_VALID bit.

Inversely, anytime git changes a cache entry, the CE_FSMONITOR_VALID bit
is cleared and the corresponding untracked cache directory is marked
invalid.

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

update-index: add a new --force-write-index optionBen Peart Fri, 22 Sep 2017 16:35:39 +0000 (12:35 -0400)

update-index: add a new --force-write-index option

At times, it makes sense to avoid the cost of writing out the index
when the only changes can easily be recomputed on demand. This causes
problems when trying to write test cases to verify that state as they
can't guarantee the state has been persisted to disk.

Add a new option (--force-write-index) to update-index that will
ensure the index is written out even if the cache_changed flag is not
set.

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

preload-index: add override to enable testing preload... Ben Peart Fri, 22 Sep 2017 16:35:38 +0000 (12:35 -0400)

preload-index: add override to enable testing preload-index

By default, the preload index code path doesn't run unless there is a
minimum of 1000 files. To enable running the test suite and having it
execute the preload-index path, add an environment variable
(GIT_FORCE_PRELOAD_TEST) which will override that minimum and set it to 2.

This enables you run existing tests and have the core.preloadindex code
path execute as long as the test has at least 2 files by setting
GIT_FORCE_PRELOAD_TEXT=1 before running the test.

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

bswap: add 64 bit endianness helper get_be64Ben Peart Fri, 22 Sep 2017 16:35:37 +0000 (12:35 -0400)

bswap: add 64 bit endianness helper get_be64

Add a new get_be64 macro to enable 64 bit endian conversions on memory
that may or may not be aligned.

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

Sync with maintJunio C Hamano Sun, 10 Sep 2017 08:15:43 +0000 (17:15 +0900)

Sync with maint

* maint:
RelNotes: further fixes for 2.14.2 from the master front

The seventh batch post 2.14Junio C Hamano Sun, 10 Sep 2017 08:15:09 +0000 (17:15 +0900)

The seventh batch post 2.14

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

Merge branch 'rs/apply-epoch'Junio C Hamano Sun, 10 Sep 2017 08:08:25 +0000 (17:08 +0900)

Merge branch 'rs/apply-epoch'

Code simplification.

* rs/apply-epoch:
apply: remove epoch date from regex
apply: check date of potential epoch timestamps first

Merge branch 'jk/drop-sha1-entry-pos'Junio C Hamano Sun, 10 Sep 2017 08:08:25 +0000 (17:08 +0900)

Merge branch 'jk/drop-sha1-entry-pos'

Code clean-up.

* jk/drop-sha1-entry-pos:
sha1-lookup: remove sha1_entry_pos() from header file

Merge branch 'nd/worktree-kill-parse-ref'Junio C Hamano Sun, 10 Sep 2017 08:08:23 +0000 (17:08 +0900)

Merge branch 'nd/worktree-kill-parse-ref'

"git branch -M a b" while on a branch that is completely unrelated
to either branch a or branch b misbehaved when multiple worktree
was in use. This has been fixed.

* nd/worktree-kill-parse-ref:
branch: fix branch renaming not updating HEADs correctly

Merge branch 'mm/send-email-cc-cruft'Junio C Hamano Sun, 10 Sep 2017 08:08:22 +0000 (17:08 +0900)

Merge branch 'mm/send-email-cc-cruft'

In addition to "cc: <a@dd.re.ss> # cruft", "cc: a@dd.re.ss # cruft"
was taught to "git send-email" as a valid way to tell it that it
needs to also send a carbon copy to <a@dd.re.ss> in the trailer
section.

* mm/send-email-cc-cruft:
send-email: don't use Mail::Address, even if available
send-email: fix garbage removal after address

Merge branch 'ls/convert-filter-progress'Junio C Hamano Sun, 10 Sep 2017 08:08:22 +0000 (17:08 +0900)

Merge branch 'ls/convert-filter-progress'

The codepath to call external process filter for smudge/clean
operation learned to show the progress meter.

* ls/convert-filter-progress:
convert: display progress for filtered objects that have been delayed

Merge branch 'ma/up-to-date'Junio C Hamano Sun, 10 Sep 2017 08:08:22 +0000 (17:08 +0900)

Merge branch 'ma/up-to-date'

Message and doc updates.

* ma/up-to-date:
treewide: correct several "up-to-date" to "up to date"
Documentation/user-manual: update outdated example output

Merge branch 'ma/ts-cleanups'Junio C Hamano Sun, 10 Sep 2017 08:08:22 +0000 (17:08 +0900)

Merge branch 'ma/ts-cleanups'

Assorted bugfixes and clean-ups.

* ma/ts-cleanups:
ThreadSanitizer: add suppressions
strbuf_setlen: don't write to strbuf_slopbuf
pack-objects: take lock before accessing `remaining`
convert: always initialize attr_action in convert_attrs

RelNotes: further fixes for 2.14.2 from the master... Junio C Hamano Sun, 10 Sep 2017 08:06:09 +0000 (17:06 +0900)

RelNotes: further fixes for 2.14.2 from the master front

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

Merge branch 'jt/doc-pack-objects-fix' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:10 +0000 (17:03 +0900)

Merge branch 'jt/doc-pack-objects-fix' into maint

Doc updates.

* jt/doc-pack-objects-fix:
Doc: clarify that pack-objects makes packs, plural

Merge branch 'jn/vcs-svn-cleanup' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:09 +0000 (17:03 +0900)

Merge branch 'jn/vcs-svn-cleanup' into maint

Code clean-up.

* jn/vcs-svn-cleanup:
vcs-svn: move remaining repo_tree functions to fast_export.h
vcs-svn: remove repo_delete wrapper function
vcs-svn: remove custom mode constants
vcs-svn: remove more unused prototypes and declarations

Merge branch 'bc/vcs-svn-cleanup' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:08 +0000 (17:03 +0900)

Merge branch 'bc/vcs-svn-cleanup' into maint

Code clean-up.

* bc/vcs-svn-cleanup:
vcs-svn: rename repo functions to "svn_repo"
vcs-svn: remove unused prototypes

Merge branch 'jk/doc-the-this' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:07 +0000 (17:03 +0900)

Merge branch 'jk/doc-the-this' into maint

Doc clean-up.

* jk/doc-the-this:
doc: fix typo in sendemail.identity

Merge branch 'rs/commit-h-single-parent-cleanup' into... Junio C Hamano Sun, 10 Sep 2017 08:03:07 +0000 (17:03 +0900)

Merge branch 'rs/commit-h-single-parent-cleanup' into maint

Code clean-up.

* rs/commit-h-single-parent-cleanup:
commit: remove unused inline function single_parent()

Merge branch 'mg/format-ref-doc-fix' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:06 +0000 (17:03 +0900)

Merge branch 'mg/format-ref-doc-fix' into maint

Doc fix.

* mg/format-ref-doc-fix:
Documentation/git-for-each-ref: clarify peeling of tags for --format
Documentation: use proper wording for ref format strings

Merge branch 'sb/submodule-parallel-update' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:06 +0000 (17:03 +0900)

Merge branch 'sb/submodule-parallel-update' into maint

Code clean-up.

* sb/submodule-parallel-update:
submodule.sh: remove unused variable

Merge branch 'hv/t5526-andand-chain-fix' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:05 +0000 (17:03 +0900)

Merge branch 'hv/t5526-andand-chain-fix' into maint

Test fix.

* hv/t5526-andand-chain-fix:
t5526: fix some broken && chains

Merge branch 'sb/sha1-file-cleanup' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:04 +0000 (17:03 +0900)

Merge branch 'sb/sha1-file-cleanup' into maint

Code clean-up.

* sb/sha1-file-cleanup:
sha1_file: make read_info_alternates static

Merge branch 'rs/t1002-do-not-use-sum' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:04 +0000 (17:03 +0900)

Merge branch 'rs/t1002-do-not-use-sum' into maint

Test simplification.

* rs/t1002-do-not-use-sum:
t1002: stop using sum(1)

Merge branch 'ah/doc-empty-string-is-false' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:03 +0000 (17:03 +0900)

Merge branch 'ah/doc-empty-string-is-false' into maint

Doc update.

* ah/doc-empty-string-is-false:
doc: clarify "config --bool" behaviour with empty string

Merge branch 'rs/merge-microcleanup' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:02 +0000 (17:03 +0900)

Merge branch 'rs/merge-microcleanup' into maint

Code clean-up.

* rs/merge-microcleanup:
merge: use skip_prefix()

Merge branch 'rs/find-pack-entry-bisection' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:02 +0000 (17:03 +0900)

Merge branch 'rs/find-pack-entry-bisection' into maint

Code clean-up.

* rs/find-pack-entry-bisection:
sha1_file: avoid comparison if no packed hash matches the first byte

Merge branch 'rs/apply-lose-prefix-length' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:01 +0000 (17:03 +0900)

Merge branch 'rs/apply-lose-prefix-length' into maint

Code clean-up.

* rs/apply-lose-prefix-length:
apply: remove prefix_length member from apply_state

Merge branch 'rj/add-chmod-error-message' into maintJunio C Hamano Sun, 10 Sep 2017 08:03:00 +0000 (17:03 +0900)

Merge branch 'rj/add-chmod-error-message' into maint

Message fix.

* rj/add-chmod-error-message:
builtin/add: add detail to a 'cannot chmod' error message

Merge branch 'jk/hashcmp-memcmp' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:59 +0000 (17:02 +0900)

Merge branch 'jk/hashcmp-memcmp' into maint

Code clean-up.

* jk/hashcmp-memcmp:
hashcmp: use memcmp instead of open-coded loop

Merge branch 'rs/t3700-clean-leftover' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:58 +0000 (17:02 +0900)

Merge branch 'rs/t3700-clean-leftover' into maint

A test fix.

* rs/t3700-clean-leftover:
t3700: fix broken test under !POSIXPERM

Merge branch 'jc/perl-git-comment-typofix' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:57 +0000 (17:02 +0900)

Merge branch 'jc/perl-git-comment-typofix' into maint

A comment fix.

* jc/perl-git-comment-typofix:
perl/Git.pm: typofix in a comment

Merge branch 'mf/no-dashed-subcommands' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:56 +0000 (17:02 +0900)

Merge branch 'mf/no-dashed-subcommands' into maint

Code clean-up.

* mf/no-dashed-subcommands:
scripts: use "git foo" not "git-foo"

Merge branch 'ab/ref-filter-no-contains' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:56 +0000 (17:02 +0900)

Merge branch 'ab/ref-filter-no-contains' into maint

A test fix.

* ab/ref-filter-no-contains:
tests: don't give unportable ">" to "test" built-in, use -gt

Merge branch 'rs/archive-excluded-directory' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:55 +0000 (17:02 +0900)

Merge branch 'rs/archive-excluded-directory' into maint

"git archive" did not work well with pathspecs and the
export-ignore attribute.

We may want to resurrect the "we don't archive an empty directory"
bonus patch, but I do not mind merging the above early to 'next'
and leave it as a separate follow-up enhancement.
cf. <20170820090629.tumvqwzkromcykjf@sigill.intra.peff.net>

* rs/archive-excluded-directory:
archive: don't queue excluded directories
archive: factor out helper functions for handling attributes
t5001: add tests for export-ignore attributes and exclude pathspecs

Merge branch 'mg/killed-merge' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:55 +0000 (17:02 +0900)

Merge branch 'mg/killed-merge' into maint

Killing "git merge --edit" before the editor returns control left
the repository in a state with MERGE_MSG but without MERGE_HEAD,
which incorrectly tells the subsequent "git commit" that there was
a squash merge in progress. This has been fixed.

* mg/killed-merge:
merge: save merge state earlier
merge: split write_merge_state in two
merge: clarify call chain
Documentation/git-merge: explain --continue

Merge branch 'tb/apply-with-crlf' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:55 +0000 (17:02 +0900)

Merge branch 'tb/apply-with-crlf' into maint

"git apply" that is used as a better "patch -p1" failed to apply a
taken from a file with CRLF line endings to a file with CRLF line
endings. The root cause was because it misused convert_to_git()
that tried to do "safe-crlf" processing by looking at the index
entry at the same path, which is a nonsense---in that mode, "apply"
is not working on the data in (or derived from) the index at all.
This has been fixed.

* tb/apply-with-crlf:
apply: file commited with CRLF should roundtrip diff and apply
convert: add SAFE_CRLF_KEEP_CRLF

Merge branch 'cc/subprocess-handshake-missing-capabilit... Junio C Hamano Sun, 10 Sep 2017 08:02:55 +0000 (17:02 +0900)

Merge branch 'cc/subprocess-handshake-missing-capabilities' into maint

When handshake with a subprocess filter notices that the process
asked for an unknown capability, Git did not report what program
the offending subprocess was running. This has been corrected.

We may want a follow-up fix to tighten the error checking, though.

* cc/subprocess-handshake-missing-capabilities:
sub-process: print the cmd when a capability is unsupported

Merge branch 'as/grep-quiet-no-match-exit-code-fix... Junio C Hamano Sun, 10 Sep 2017 08:02:55 +0000 (17:02 +0900)

Merge branch 'as/grep-quiet-no-match-exit-code-fix' into maint

"git grep -L" and "git grep --quiet -L" reported different exit
codes; this has been corrected.

* as/grep-quiet-no-match-exit-code-fix:
git-grep: correct exit code with --quiet and -L

Merge branch 'kd/stash-with-bash-4.4' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:54 +0000 (17:02 +0900)

Merge branch 'kd/stash-with-bash-4.4' into maint

bash 4.4 or newer gave a warning on NUL byte in command
substitution done in "git stash"; this has been squelched.

* kd/stash-with-bash-4.4:
stash: prevent warning about null bytes in input

Merge branch 'rs/win32-syslog-leakfix' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:54 +0000 (17:02 +0900)

Merge branch 'rs/win32-syslog-leakfix' into maint

Memory leak in an error codepath has been plugged.

* rs/win32-syslog-leakfix:
win32: plug memory leak on realloc() failure in syslog()

Merge branch 'rs/unpack-entry-leakfix' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:53 +0000 (17:02 +0900)

Merge branch 'rs/unpack-entry-leakfix' into maint

Memory leak in an error codepath has been plugged.

* rs/unpack-entry-leakfix:
sha1_file: release delta_stack on error in unpack_entry()

Merge branch 'rs/fsck-obj-leakfix' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:52 +0000 (17:02 +0900)

Merge branch 'rs/fsck-obj-leakfix' into maint

Memory leak in an error codepath has been plugged.

* rs/fsck-obj-leakfix:
fsck: free buffers on error in fsck_obj()

Merge branch 'ur/svn-local-zone' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:52 +0000 (17:02 +0900)

Merge branch 'ur/svn-local-zone' into maint

"git svn" used with "--localtime" option did not compute the tz
offset for the timestamp in question and instead always used the
current time, which has been corrected.

* ur/svn-local-zone:
git svn fetch: Create correct commit timestamp when using --localtime

Merge branch 'pw/am-signoff' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:51 +0000 (17:02 +0900)

Merge branch 'pw/am-signoff' into maint

"git am -s" has been taught that some input may end with a trailer
block that is not Signed-off-by: and it should refrain from adding
an extra blank line before adding a new sign-off in such a case.

* pw/am-signoff:
am: fix signoff when other trailers are present

Merge branch 'rs/in-obsd-basename-dirname-take-const... Junio C Hamano Sun, 10 Sep 2017 08:02:51 +0000 (17:02 +0900)

Merge branch 'rs/in-obsd-basename-dirname-take-const' into maint

Portability fix.

* rs/in-obsd-basename-dirname-take-const:
test-path-utils: handle const parameter of basename and dirname

Merge branch 'rs/t4062-obsd' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:51 +0000 (17:02 +0900)

Merge branch 'rs/t4062-obsd' into maint

Test portability fix.

* rs/t4062-obsd:
t4062: use less than 256 repetitions in regex

Merge branch 'rs/obsd-getcwd-workaround' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:50 +0000 (17:02 +0900)

Merge branch 'rs/obsd-getcwd-workaround' into maint

Test portability fix for BSDs.

* rs/obsd-getcwd-workaround:
t0001: skip test with restrictive permissions if getpwd(3) respects them

Merge branch 'bw/clone-recursive-quiet' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:49 +0000 (17:02 +0900)

Merge branch 'bw/clone-recursive-quiet' into maint

"git clone --recurse-submodules --quiet" did not pass the quiet
option down to submodules.

* bw/clone-recursive-quiet:
clone: teach recursive clones to respect -q

Merge branch 'pw/sequence-rerere-autoupdate' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:49 +0000 (17:02 +0900)

Merge branch 'pw/sequence-rerere-autoupdate' into maint

Commands like "git rebase" accepted the --rerere-autoupdate option
from the command line, but did not always use it. This has been
fixed.

* pw/sequence-rerere-autoupdate:
cherry-pick/revert: reject --rerere-autoupdate when continuing
cherry-pick/revert: remember --rerere-autoupdate
t3504: use test_commit
rebase -i: honor --rerere-autoupdate
rebase: honor --rerere-autoupdate
am: remember --rerere-autoupdate setting

Merge branch 'bw/push-options-recursively-to-submodules... Junio C Hamano Sun, 10 Sep 2017 08:02:49 +0000 (17:02 +0900)

Merge branch 'bw/push-options-recursively-to-submodules' into maint

"git push --recurse-submodules $there HEAD:$target" was not
propagated down to the submodules, but now it is.

* bw/push-options-recursively-to-submodules:
submodule--helper: teach push-check to handle HEAD

Merge branch 'ma/pager-per-subcommand-action' into... Junio C Hamano Sun, 10 Sep 2017 08:02:48 +0000 (17:02 +0900)

Merge branch 'ma/pager-per-subcommand-action' into maint

The "tag.pager" configuration variable was useless for those who
actually create tag objects, as it interfered with the use of an
editor. A new mechanism has been introduced for commands to enable
pager depending on what operation is being carried out to fix this,
and then "git tag -l" is made to run pager by default.

If this works out OK, I think there are low-hanging fruits in
other commands like "git branch" that outputs long list in one mode
while taking input in another.

* ma/pager-per-subcommand-action:
git.c: ignore pager.* when launching builtin as dashed external
tag: change default of `pager.tag` to "on"
tag: respect `pager.tag` in list-mode only
t7006: add tests for how git tag paginates
git.c: provide setup_auto_pager()
git.c: let builtins opt for handling `pager.foo` themselves
builtin.h: take over documentation from api-builtin.txt

Merge branch 'jk/rev-list-empty-input' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:48 +0000 (17:02 +0900)

Merge branch 'jk/rev-list-empty-input' into maint

"git log --tag=no-such-tag" showed log starting from HEAD, which
has been fixed---it now shows nothing.

* jk/rev-list-empty-input:
revision: do not fallback to default when rev_input_given is set
rev-list: don't show usage when we see empty ref patterns
revision: add rev_input_given flag
t6018: flesh out empty input/output rev-list tests

Merge branch 'st/lib-gpg-kill-stray-agent' into maintJunio C Hamano Sun, 10 Sep 2017 08:02:48 +0000 (17:02 +0900)

Merge branch 'st/lib-gpg-kill-stray-agent' into maint

Some versions of GnuPG fails to kill gpg-agent it auto-spawned
and such a left-over agent can interfere with a test. Work it
around by attempting to kill one before starting a new test.

* st/lib-gpg-kill-stray-agent:
t: lib-gpg: flush gpg agent on startup

The sixth batch post 2.14Junio C Hamano Wed, 6 Sep 2017 04:15:24 +0000 (13:15 +0900)

The sixth batch post 2.14

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

Merge branch 'rs/archive-excluded-directory'Junio C Hamano Wed, 6 Sep 2017 04:11:25 +0000 (13:11 +0900)

Merge branch 'rs/archive-excluded-directory'

"git archive" did not work well with pathspecs and the
export-ignore attribute.

* rs/archive-excluded-directory:
archive: don't queue excluded directories
archive: factor out helper functions for handling attributes
t5001: add tests for export-ignore attributes and exclude pathspecs

Merge branch 'po/read-graft-line'Junio C Hamano Wed, 6 Sep 2017 04:11:25 +0000 (13:11 +0900)

Merge branch 'po/read-graft-line'

Conversion from uchar[20] to struct object_id continues; this is to
ensure that we do not assume sizeof(struct object_id) is the same
as the length of SHA-1 hash (or length of longest hash we support).

* po/read-graft-line:
commit: rewrite read_graft_line
commit: allocate array using object_id size
commit: replace the raw buffer with strbuf in read_graft_line
sha1_file: fix definition of null_sha1

Merge branch 'ks/branch-set-upstream'Junio C Hamano Wed, 6 Sep 2017 04:11:24 +0000 (13:11 +0900)

Merge branch 'ks/branch-set-upstream'

"branch --set-upstream" that has been deprecated in Git 1.8 has
finally been retired.

* ks/branch-set-upstream:
branch: quote branch/ref names to improve readability
builtin/branch: stop supporting the "--set-upstream" option
t3200: cleanup cruft of a test

The fifth batch post 2.14Junio C Hamano Sun, 27 Aug 2017 06:00:01 +0000 (23:00 -0700)

The fifth batch post 2.14

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

Merge branch 'mg/killed-merge'Junio C Hamano Sun, 27 Aug 2017 05:55:10 +0000 (22:55 -0700)

Merge branch 'mg/killed-merge'

Killing "git merge --edit" before the editor returns control left
the repository in a state with MERGE_MSG but without MERGE_HEAD,
which incorrectly tells the subsequent "git commit" that there was
a squash merge in progress. This has been fixed.

* mg/killed-merge:
merge: save merge state earlier
merge: split write_merge_state in two
merge: clarify call chain
Documentation/git-merge: explain --continue

Merge branch 'jt/packmigrate'Junio C Hamano Sun, 27 Aug 2017 05:55:09 +0000 (22:55 -0700)

Merge branch 'jt/packmigrate'

Code movement to make it easier to hack later.

* jt/packmigrate: (23 commits)
pack: move for_each_packed_object()
pack: move has_pack_index()
pack: move has_sha1_pack()
pack: move find_pack_entry() and make it global
pack: move find_sha1_pack()
pack: move find_pack_entry_one(), is_pack_valid()
pack: move check_pack_index_ptr(), nth_packed_object_offset()
pack: move nth_packed_object_{sha1,oid}
pack: move clear_delta_base_cache(), packed_object_info(), unpack_entry()
pack: move unpack_object_header()
pack: move get_size_from_delta()
pack: move unpack_object_header_buffer()
pack: move {,re}prepare_packed_git and approximate_object_count
pack: move install_packed_git()
pack: move add_packed_git()
pack: move unuse_pack()
pack: move use_pack()
pack: move pack-closing functions
pack: move release_pack_memory()
pack: move open_pack_index(), parse_pack_index()
...

Merge branch 'mh/ref-lock-entry'Junio C Hamano Sun, 27 Aug 2017 05:55:09 +0000 (22:55 -0700)

Merge branch 'mh/ref-lock-entry'

The code to acquire a lock on a reference (e.g. while accepting a
push from a client) used to immediately fail when the reference is
already locked---now it waits for a very short while and retries,
which can make it succeed if the lock holder was holding it during
a read-only operation.

* mh/ref-lock-entry:
refs: retry acquiring reference locks for 100ms

Merge branch 'jt/doc-pack-objects-fix'Junio C Hamano Sun, 27 Aug 2017 05:55:09 +0000 (22:55 -0700)

Merge branch 'jt/doc-pack-objects-fix'

Doc updates.

* jt/doc-pack-objects-fix:
Doc: clarify that pack-objects makes packs, plural

Merge branch 'jc/cutoff-config'Junio C Hamano Sun, 27 Aug 2017 05:55:08 +0000 (22:55 -0700)

Merge branch 'jc/cutoff-config'

"[gc] rerereResolved = 5.days" used to be invalid, as the variable
is defined to take an integer counting the number of days. It now
is allowed.

* jc/cutoff-config:
rerere: allow approxidate in gc.rerereResolved/gc.rerereUnresolved
rerere: represent time duration in timestamp_t internally
t4200: parameterize "rerere gc" custom expiry test
t4200: gather "rerere gc" together
t4200: make "rerere gc" test more robust
t4200: give us a clean slate after "rerere gc" tests

Merge branch 'kw/write-index-reduce-alloc'Junio C Hamano Sun, 27 Aug 2017 05:55:08 +0000 (22:55 -0700)

Merge branch 'kw/write-index-reduce-alloc'

We used to spend more than necessary cycles allocating and freeing
piece of memory while writing each index entry out. This has been
optimized.

* kw/write-index-reduce-alloc:
read-cache: avoid allocating every ondisk entry when writing
read-cache: fix memory leak in do_write_index
perf: add test for writing the index

Merge branch 'bw/submodule-config-cleanup'Junio C Hamano Sun, 27 Aug 2017 05:55:07 +0000 (22:55 -0700)

Merge branch 'bw/submodule-config-cleanup'

Code clean-up to avoid mixing values read from the .gitmodules file
and values read from the .git/config file.

* bw/submodule-config-cleanup:
submodule: remove gitmodules_config
unpack-trees: improve loading of .gitmodules
submodule-config: lazy-load a repository's .gitmodules file
submodule-config: move submodule-config functions to submodule-config.c
submodule-config: remove support for overlaying repository config
diff: stop allowing diff to have submodules configured in .git/config
submodule: remove submodule_config callback routine
unpack-trees: don't respect submodule.update
submodule: don't rely on overlayed config when setting diffopts
fetch: don't overlay config with submodule-config
submodule--helper: don't overlay config in update-clone
submodule--helper: don't overlay config in remote_submodule_branch
add, reset: ensure submodules can be added or reset
submodule: don't use submodule_from_name
t7411: check configuration parsing errors

Merge branch 'js/gitweb-raw-blob-link-in-history'Junio C Hamano Sun, 27 Aug 2017 05:55:07 +0000 (22:55 -0700)

Merge branch 'js/gitweb-raw-blob-link-in-history'

"gitweb" shows a link to visit the 'raw' contents of blbos in the
history overview page.

* js/gitweb-raw-blob-link-in-history:
gitweb: add 'raw' blob_plain link in history overview

Merge branch 'po/object-id'Junio C Hamano Sun, 27 Aug 2017 05:55:06 +0000 (22:55 -0700)

Merge branch 'po/object-id'

* po/object-id:
sha1_file: convert index_stream to struct object_id
sha1_file: convert hash_sha1_file_literally to struct object_id
sha1_file: convert index_fd to struct object_id
sha1_file: convert index_path to struct object_id
read-cache: convert to struct object_id
builtin/hash-object: convert to struct object_id

Merge branch 'jn/vcs-svn-cleanup'Junio C Hamano Sun, 27 Aug 2017 05:55:06 +0000 (22:55 -0700)

Merge branch 'jn/vcs-svn-cleanup'

Code clean-up.

* jn/vcs-svn-cleanup:
vcs-svn: move remaining repo_tree functions to fast_export.h
vcs-svn: remove repo_delete wrapper function
vcs-svn: remove custom mode constants
vcs-svn: remove more unused prototypes and declarations

Merge branch 'bc/vcs-svn-cleanup'Junio C Hamano Sun, 27 Aug 2017 05:55:05 +0000 (22:55 -0700)

Merge branch 'bc/vcs-svn-cleanup'

Code clean-up.

* bc/vcs-svn-cleanup:
vcs-svn: rename repo functions to "svn_repo"
vcs-svn: remove unused prototypes

Merge branch 'tb/apply-with-crlf'Junio C Hamano Sun, 27 Aug 2017 05:55:05 +0000 (22:55 -0700)

Merge branch 'tb/apply-with-crlf'

"git apply" that is used as a better "patch -p1" failed to apply a
taken from a file with CRLF line endings to a file with CRLF line
endings. The root cause was because it misused convert_to_git()
that tried to do "safe-crlf" processing by looking at the index
entry at the same path, which is a nonsense---in that mode, "apply"
is not working on the data in (or derived from) the index at all.
This has been fixed.

* tb/apply-with-crlf:
apply: file commited with CRLF should roundtrip diff and apply
convert: add SAFE_CRLF_KEEP_CRLF

Merge branch 'jt/stash-tests'Junio C Hamano Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)

Merge branch 'jt/stash-tests'

Test update to improve coverage for "git stash" operations.

* jt/stash-tests:
stash: add a test for stashing in a detached state
stash: add a test for when apply fails during stash branch
stash: add a test for stash create with no files

Merge branch 'jk/trailers-parse'Junio C Hamano Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)

Merge branch 'jk/trailers-parse'

"git interpret-trailers" has been taught a "--parse" and a few
other options to make it easier for scripts to grab existing
trailer lines from a commit log message.

* jk/trailers-parse:
doc/interpret-trailers: fix "the this" typo
pretty: support normalization options for %(trailers)
t4205: refactor %(trailers) tests
pretty: move trailer formatting to trailer.c
interpret-trailers: add --parse convenience option
interpret-trailers: add an option to unfold values
interpret-trailers: add an option to show only existing trailers
interpret-trailers: add an option to show only the trailers
trailer: put process_trailers() options into a struct

Merge branch 'pb/trailers-from-command-line'Junio C Hamano Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)

Merge branch 'pb/trailers-from-command-line'

"git interpret-trailers" learned to take the trailer specifications
from the command line that overrides the configured values.

* pb/trailers-from-command-line:
interpret-trailers: fix documentation typo
interpret-trailers: add options for actions
trailers: introduce struct new_trailer_item
trailers: export action enums and corresponding lookup functions

Merge branch 'jt/diff-color-move-fix'Junio C Hamano Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)

Merge branch 'jt/diff-color-move-fix'

A handful of bugfixes and an improvement to "diff --color-moved".

* jt/diff-color-move-fix:
diff: define block by number of alphanumeric chars
diff: respect MIN_BLOCK_LENGTH for last block
diff: avoid redundantly clearing a flag

Merge branch 'sb/diff-color-move'Junio C Hamano Sun, 27 Aug 2017 05:55:03 +0000 (22:55 -0700)

Merge branch 'sb/diff-color-move'

"git diff" has been taught to optionally paint new lines that are
the same as deleted lines elsewhere differently from genuinely new
lines.

* sb/diff-color-move: (25 commits)
diff: document the new --color-moved setting
diff.c: add dimming to moved line detection
diff.c: color moved lines differently, plain mode
diff.c: color moved lines differently
diff.c: buffer all output if asked to
diff.c: emit_diff_symbol learns about DIFF_SYMBOL_SUMMARY
diff.c: emit_diff_symbol learns about DIFF_SYMBOL_STAT_SEP
diff.c: convert word diffing to use emit_diff_symbol
diff.c: convert show_stats to use emit_diff_symbol
diff.c: convert emit_binary_diff_body to use emit_diff_symbol
submodule.c: migrate diff output to use emit_diff_symbol
diff.c: emit_diff_symbol learns DIFF_SYMBOL_REWRITE_DIFF
diff.c: emit_diff_symbol learns about DIFF_SYMBOL_BINARY_FILES
diff.c: emit_diff_symbol learns DIFF_SYMBOL_HEADER
diff.c: emit_diff_symbol learns DIFF_SYMBOL_FILEPAIR_{PLUS, MINUS}
diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_INCOMPLETE
diff.c: emit_diff_symbol learns DIFF_SYMBOL_WORDS[_PORCELAIN]
diff.c: migrate emit_line_checked to use emit_diff_symbol
diff.c: emit_diff_symbol learns DIFF_SYMBOL_NO_LF_EOF
diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_FRAGINFO
...

apply: remove epoch date from regexRené Scharfe Fri, 25 Aug 2017 19:06:28 +0000 (21:06 +0200)

apply: remove epoch date from regex

We check the date of epoch timestamp candidates already with
starts_with(). Move beyond that part using skip_prefix() instead of
checking it again using a regular expression. Also group the minutes
part, so that we can access them using a substring match instead of
using a magic number.

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

apply: check date of potential epoch timestamps firstRené Scharfe Fri, 25 Aug 2017 19:04:54 +0000 (21:04 +0200)

apply: check date of potential epoch timestamps first

has_epoch_timestamp() looks for time stamps that amount to either
1969-12-31 24:00 or 1970-01-01 00:00 after applying the time zone
offset. Move the check for these two dates up, set the expected hour
based on which one is found, or exit early if none of them are present,
thus avoiding to engage the regex machinery for newer dates.

This also gets rid of two magic string length constants.

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

sha1-lookup: remove sha1_entry_pos() from header fileChristian Couder Fri, 25 Aug 2017 07:36:13 +0000 (09:36 +0200)

sha1-lookup: remove sha1_entry_pos() from header file

Since f1068efefe (sha1_file: drop experimental GIT_USE_LOOKUP search, 2017-08-09)
the definition of sha1_entry_pos() has been removed from "sha1-lookup.c", so
there is no need anymore for its declaration in "sha1-lookup.h".

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

send-email: don't use Mail::Address, even if availableMatthieu Moy Wed, 23 Aug 2017 10:21:02 +0000 (12:21 +0200)

send-email: don't use Mail::Address, even if available

Using Mail::Address made sense when we didn't have a proper parser. We
now have a reasonable address parser, and using Mail::Address
_if available_ causes much more trouble than it gives benefits:

* Developers typically test one version, not both.

* Users may not be aware that installing Mail::Address will change the
behavior. They may complain about the behavior in one case without
knowing that Mail::Address is involved.

* Having this optional Mail::Address makes it tempting to anwser "please
install Mail::Address" to users instead of fixing our own code. We've
reached the stage where bugs in our parser should be fixed, not worked
around.

Signed-off-by: Matthieu Moy <git@matthieu-moy.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-email: fix garbage removal after addressMatthieu Moy Wed, 23 Aug 2017 10:21:01 +0000 (12:21 +0200)

send-email: fix garbage removal after address

This is a followup over 9d33439 (send-email: only allow one address
per body tag, 2017-02-20). The first iteration did allow writting

Cc: <foo@example.com> # garbage
but did so by matching the regex ([^>]*>?), i.e. stop after the first
instance of '>'. However, it did not properly deal with

Cc: foo@example.com # garbage
Fix this using a new function strip_garbage_one_address, which does
essentially what the old ([^>]*>?) was doing, but dealing with more
corner-cases. Since we've allowed

Cc: "Foo # Bar" <foobar@example.com>
in previous versions, it makes sense to continue allowing it (but we
still remove any garbage after it). OTOH, when an address is given
without quoting, we just take the first word and ignore everything
after.

Signed-off-by: Matthieu Moy <git@matthieu-moy.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch: fix branch renaming not updating HEADs correctlyNguyễn Thái Ngọc Duy Thu, 24 Aug 2017 10:41:24 +0000 (17:41 +0700)

branch: fix branch renaming not updating HEADs correctly

There are two bugs that sort of work together and cause
problems. Let's start with one in replace_each_worktree_head_symref.

Before fa099d2322 (worktree.c: kill parse_ref() in favor of
refs_resolve_ref_unsafe() - 2017-04-24), this code looks like this:

if (strcmp(oldref, worktrees[i]->head_ref))
continue;
set_worktree_head_symref(...);

After fa099d2322, it is possible that head_ref can be NULL. However,
the updated code takes the wrong exit. In the error case (NULL
head_ref), we should "continue;" to the next worktree. The updated
code makes us _skip_ "continue;" and update HEAD anyway.

The NULL head_ref is triggered by the second bug in add_head_info (in
the same commit). With the flag RESOLVE_REF_READING, resolve_ref_unsafe()
will abort if it cannot resolve the target ref. For orphan checkouts,
HEAD always points to an unborned branch, resolving target ref will
always fail. Now we have NULL head_ref. Now we always update HEAD.

Correct the logic in replace_ function so that we don't accidentally
update HEAD on error. As it turns out, correcting the logic bug above
breaks branch renaming completely, thanks to the second bug.

"git branch -[Mm]" does two steps (on a normal checkout, no orphan!):

- rename the branch on disk (e.g. refs/heads/abc to refs/heads/def)
- update HEAD if it points to the branch being renamed.

At the second step, since the branch pointed to by HEAD (e.g. "abc") no
longer exists on disk, we run into a temporary orphan checkout situation
that has been just corrected to _not_ update HEAD. But we need to update
HEAD since it's not actually an orphan checkout. We need to update HEAD
to move out of that orphan state.

Correct add_head_info(), remove RESOLVE_REF_READING flag. With the flag
gone, we should always return good "head_ref" in orphan checkouts (either
temporary or permanent). With good head_ref, things start to work again.

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