Commit graph

11387 commits

Author SHA1 Message Date
Jeff King c20d4d702f t1450: use "mv -f" within loose object directory
The loose objects are created with mode 0444. That doesn't
prevent them being overwritten by rename(), but some
versions of "mv" will be extra careful and prompt the user,
even without "-i".

Reportedly macOS does this, at least in the Travis builds.
The prompt reads from /dev/null, defaulting to "no", and the
object isn't moved. Then to make matters even more
interesting, it still returns "0" and the rest of the test
proceeds, but with a broken setup.

We can work around it by using "mv -f" to override the
prompt. This should work as it's already used in t5504 for
the same purpose.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-25 12:32:32 -08:00
Jeff King c3271a0e47 fsck: do not fallback "git fsck <bogus>" to "git fsck"
Since fsck tries to continue as much as it can after seeing
an error, we still do the reachability check even if some
heads we were given on the command-line are bogus. But if
_none_ of the heads is is valid, we fallback to checking all
refs and the index, which is not what the user asked for at
all.

Instead of checking "heads", the number of successful heads
we got, check "argc" (which we know only has non-options in
it, because parse_options removed the others).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-17 14:24:33 -08:00
Jeff King c6c7b16d23 fsck: tighten error-checks of "git fsck <head>"
Instead of checking reachability from the refs, you can ask
fsck to check from a particular set of heads. However, the
error checking here is quite lax. In particular:

  1. It claims lookup_object() will report an error, which
     is not true. It only does a hash lookup, and the user
     has no clue that their argument was skipped.

  2. When either the name or sha1 cannot be resolved, we
     continue to exit with a successful error code, even
     though we didn't check what the user asked us to.

This patch fixes both of these cases.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-17 14:24:33 -08:00
Jeff King 3e3f8bd608 fsck: prepare dummy objects for --connectivity-check
Normally fsck makes a pass over all objects to check their
integrity, and then follows up with a reachability check to
make sure we have all of the referenced objects (and to know
which ones are dangling). The latter checks for the HAS_OBJ
flag in obj->flags to see if we found the object in the
first pass.

Commit 02976bf85 (fsck: introduce `git fsck --connectivity-only`,
2015-06-22) taught fsck to skip the initial pass, and to
fallback to has_sha1_file() instead of the HAS_OBJ check.

However, it converted only one HAS_OBJ check to use
has_sha1_file(). But there are many other places in
builtin/fsck.c that assume that the flag is set (or that
lookup_object() will return an object at all). This leads to
several bugs with --connectivity-only:

  1. mark_object() will not queue objects for examination,
     so recursively following links from commits to trees,
     etc, did nothing. I.e., we were checking the
     reachability of hardly anything at all.

  2. When a set of heads is given on the command-line, we
     use lookup_object() to see if they exist. But without
     the initial pass, we assume nothing exists.

  3. When loading reflog entries, we do a similar
     lookup_object() check, and complain that the reflog is
     broken if the object doesn't exist in our hash.

So in short, --connectivity-only is broken pretty badly, and
will claim that your repository is fine when it's not.
Presumably nobody noticed for a few reasons.

One is that the embedded test does not actually test the
recursive nature of the reachability check. All of the
missing objects are still in the index, and we directly
check items from the index. This patch modifies the test to
delete the index, which shows off breakage (1).

Another is that --connectivity-only just skips the initial
pass for loose objects. So on a real repository, the packed
objects were still checked correctly. But on the flipside,
it means that "git fsck --connectivity-only" still checks
the sha1 of all of the packed objects, nullifying its
original purpose of being a faster git-fsck.

And of course the final problem is that the bug only shows
up when there _is_ corruption, which is rare. So anybody
running "git fsck --connectivity-only" proactively would
assume it was being thorough, when it was not.

One possibility for fixing this is to find all of the spots
that rely on HAS_OBJ and tweak them for the connectivity-only
case. But besides the risk that we might miss a spot (and I
found three already, corresponding to the three bugs above),
there are other parts of fsck that _can't_ work without a
full list of objects. E.g., the list of dangling objects.

Instead, let's make the connectivity-only case look more
like the normal case. Rather than skip the initial pass
completely, we'll do an abbreviated one that sets up the
HAS_OBJ flag for each object, without actually loading the
object data.

That's simple and fast, and we don't have to care about the
connectivity_only flag in the rest of the code at all.
While we're at it, let's make sure we treat loose and packed
objects the same (i.e., setting up dummy objects for both
and skipping the actual sha1 check). That makes the
connectivity-only check actually fast on a real repo (40
seconds versus 180 seconds on my copy of linux.git).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-17 14:23:20 -08:00
Jeff King b4584e4f66 fsck: report trees as dangling
After checking connectivity, fsck looks through the list of
any objects we've seen mentioned, and reports unreachable
and un-"used" ones as dangling. However, it skips any object
which is not marked as "parsed", as that is an object that
we _don't_ have (but that somebody mentioned).

Since 6e454b9a3 (clear parsed flag when we free tree
buffers, 2013-06-05), that flag can't be relied on, and the
correct method is to check the HAS_OBJ flag. The cleanup in
that commit missed this callsite, though. As a result, we
would generally fail to report dangling trees.

We never noticed because there were no tests in this area
(for trees or otherwise). Let's add some.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-17 12:49:41 -08:00
Jeff King 1ada11ee62 t1450: clean up sub-objects in duplicate-entry test
This test creates a multi-level set of trees, but its
cleanup routine only removes the top-level tree. After the
test finishes, the inner tree and the blob it points to
remain, making the inner tree dangling.

A later test ("cleaned up") verifies that we've removed any
cruft and "git fsck" output is clean. This passes only
because of a bug in git-fsck which fails to notice dangling
trees.

In preparation for fixing the bug, let's teach this earlier
test to clean up after itself correctly. We have to remove
the inner tree (and therefore the blob, too, which becomes
dangling after removing that tree).

Since the setup code happens inside a subshell, we can't
just set a variable for each object. However, we can stuff
all of the sha1s into the $T output variable, which is not
used for anything except cleanup.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-17 12:49:41 -08:00
Junio C Hamano c34a7daad7 Merge branch 'jc/setup-cleanup-fix'
"git archive" and "git mailinfo" stopped reading from local
configuration file with a recent update.

* jc/setup-cleanup-fix:
  archive: read local configuration
  mailinfo: read local configuration
2016-11-23 11:23:17 -08:00
Junio C Hamano bd53f38d52 Merge branch 'js/rebase-i-commentchar-fix'
"git rebase -i" did not work well with core.commentchar
configuration variable for two reasons, both of which have been
fixed.

* js/rebase-i-commentchar-fix:
  rebase -i: handle core.commentChar=auto
  stripspace: respect repository config
  rebase -i: highlight problems with core.commentchar
2016-11-23 11:23:17 -08:00
Junio C Hamano 48e9ad5ef3 Merge branch 'jc/for-each-ref-head-segfault-fix'
Using a %(HEAD) placeholder in "for-each-ref --format=" option
caused the command to segfault when on an unborn branch.

* jc/for-each-ref-head-segfault-fix:
  for-each-ref: do not segv with %(HEAD) on an unborn branch
2016-11-23 11:23:16 -08:00
Junio C Hamano eb0224c617 archive: read local configuration
Since b9605bc4f2 ("config: only read .git/config from configured
repos", 2016-09-12), we do not read from ".git/config" unless we
know we are in a repository.  "git archive" however didn't do the
repository discovery and instead relied on the old behaviour.

Teach the command to run a "gentle" version of repository discovery
so that local configuration variables are honoured.

[jc: stole tests from peff]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-22 13:55:20 -08:00
Junio C Hamano 3f0ec0687d mailinfo: read local configuration
Since b9605bc4f2 ("config: only read .git/config from configured
repos", 2016-09-12), we do not read from ".git/config" unless we
know we are in a repository.  "git mailinfo" however didn't do the
repository discovery and instead relied on the old behaviour.  This
was mostly OK because it was merely run as a helper program by other
porcelain scripts that first chdir's up to the root of the working
tree.

Teach the command to run a "gentle" version of repository discovery
so that local configuration variables like mailinfo.scissors are
honoured.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-22 13:13:16 -08:00
Johannes Schindelin 882cd23777 rebase -i: handle core.commentChar=auto
When 84c9dc2 (commit: allow core.commentChar=auto for character auto
selection, 2014-05-17) extended the core.commentChar functionality to
allow for the value 'auto', it forgot that rebase -i was already taught to
handle core.commentChar, and in turn forgot to let rebase -i handle that
new value gracefully.

Reported by Taufiq Hoven.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-21 11:00:41 -08:00
Johannes Schindelin 92068ae8bf stripspace: respect repository config
The way "git stripspace" reads the configuration was not quite
kosher, in that the code forgot to probe for a possibly existing
repository (note: stripspace is designed to be usable outside the
repository as well).  It read .git/config only when it was run from
the top-level of the working tree by accident.  A recent change
b9605bc4f2 ("config: only read .git/config from configured repos",
2016-09-12) stopped reading the repository-local configuration file
".git/config" unless the repository discovery process is done, so
that .git/config is never read even when run from the top-level,
exposing the old bug more.

When rebasing interactively with a commentChar defined in the
current repository's config, the help text at the bottom of the edit
script potentially used an incorrect comment character. This was not
only funny-looking, but also resulted in tons of warnings like this
one:

	Warning: the command isn't recognized in the following line
	 - #

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-21 11:00:38 -08:00
Johannes Schindelin 6645838845 rebase -i: highlight problems with core.commentchar
The interactive rebase does not currently play well with
core.commentchar. Let's add some tests to highlight those problems
that will be fixed in the remainder of the series.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-21 11:00:17 -08:00
Junio C Hamano 84679d470d for-each-ref: do not segv with %(HEAD) on an unborn branch
The code to flip between "*" and " " prefixes depending on what
branch is checked out used in --format='%(HEAD)' did not consider
that HEAD may resolve to an unborn branch and dereferenced a NULL.

This will become a lot easier to trigger as the codepath will be
used to reimplement "git branch [--list]" in the future.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-18 15:21:12 -08:00
Junio C Hamano 7f2a3921fb Merge branch 'js/pwd-var-vs-pwd-cmd-fix'
Last minute fixes to two fixups merged to 'master' recently.

* js/pwd-var-vs-pwd-cmd-fix:
  t0021, t5615: use $PWD instead of $(pwd) in PATH-like shell variables
2016-11-11 13:56:30 -08:00
Junio C Hamano b18f6a0066 Merge branch 'ls/filter-process'
Test portability improvements and optimization for an
already-graduated topic.

* ls/filter-process:
  t0021: remove debugging cruft
2016-11-11 13:56:30 -08:00
Junio C Hamano f5a8ad4c5a Merge branch 'as/merge-attr-sleep'
Fix for a racy false-positive test failure.

* as/merge-attr-sleep:
  t6026: clarify the point of "kill $(cat sleep.pid)"
  t6026: ensure that long-running script really is
  Revert "t6026-merge-attr: don't fail if sleep exits early"
  Revert "t6026-merge-attr: ensure that the merge driver was called"
  t6026-merge-attr: ensure that the merge driver was called
  t6026-merge-attr: don't fail if sleep exits early
2016-11-11 13:56:30 -08:00
Junio C Hamano a0d8b60da8 t0021: remove debugging cruft
The redirection of the standard error stream to a temporary file is
a leftover cruft during debugging.  Remove it.

Besides, it is reported by folks on the Windows that the test is
flaky with this redirection; somebody gets confused and this
merely-redirected-to file gets marked as delete-pending by git.exe
and makes it finish with a non-zero exit status when "git checkout"
finishes.  Windows folks may want to figure that one out, but for
the purpose of this test, it shouldn't become a show-stopper.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-11 13:09:24 -08:00
Johannes Sixt fdf4f6c79b t6026: clarify the point of "kill $(cat sleep.pid)"
We lengthened the time the leftover process sleeps in the previous
commit to make sure it will be there while 'git merge' runs and
finishes.  It therefore needs to be killed before leaving the test.
And it needs to be killed even when 'git merge' fails, so it has to
be triggered via test_when_finished mechanism.

Explain all that in a large comment, and move the use site of
test_when_finished to immediately before 'git merge' invocation,
where the process is spawned.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-11 12:53:21 -08:00
Johannes Sixt 71dd50472d t0021, t5615: use $PWD instead of $(pwd) in PATH-like shell variables
We have to use $PWD instead of $(pwd) because on Windows the latter
would add a C: style path to bash's Unix-style $PATH variable, which
becomes confused by the colon after the drive letter. ($PWD is a
Unix-style path.)

In the case of GIT_ALTERNATE_OBJECT_DIRECTORIES, bash on Windows
assembles a Unix-style path list with the colon as separators. It
converts the value to a Windows-style path list with the semicolon as
path separator when it forwards the variable to git.exe. The same
confusion happens when bash's original value is contaminated with
Windows style paths.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-11 10:54:46 -08:00
Johannes Schindelin a7d6bcc329 t6026: ensure that long-running script really is
When making sure that background tasks are cleaned up in 5babb5b
(t6026-merge-attr: clean up background process at end of test case,
2016-09-07), we considered to let the background task sleep longer, just
to be certain that it will still be running when we want to kill it
after the test.

Sadly, the assumption appears not to hold true that the test case passes
quickly enough to kill the background task within a second.

Simply increase it to an hour. No system can be possibly slow enough to
make above-mentioned assumption incorrect.

Reported by Andreas Schwab.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-10 15:57:06 -08:00
Junio C Hamano b36b716cf6 Revert "t6026-merge-attr: don't fail if sleep exits early"
This reverts commit 734fde2d71.

The point of the test is that the stray process was still running
when 'git merge' did its thing through its completion, so a failure
to "kill" it means we didn't give a condition to the test to trigger
a possible future breakage.  Appending "|| :" to the "kill" is
sweeping a test-bug under the rug.
2016-11-10 15:55:13 -08:00
Junio C Hamano 3b03097d66 Revert "t6026-merge-attr: ensure that the merge driver was called"
This reverts commit c1e0dc59bd.

We are not interested in the stray process in the merge driver
started; we want it to be still around.
2016-11-10 15:54:12 -08:00
Junio C Hamano 0538b84027 Merge branch 'jk/alt-odb-cleanup'
Fix a corner-case regression in a topic that graduated during the
v2.11 cycle.

* jk/alt-odb-cleanup:
  alternates: re-allow relative paths from environment
2016-11-10 13:17:30 -08:00
Junio C Hamano 7b2c338cae Merge branch 'jk/filter-process-fix'
Test portability improvements and cleanups for t0021.

* jk/filter-process-fix:
  t0021: fix filehandle usage on older perl
  t0021: use $PERL_PATH for rot13-filter.pl
  t0021: put $TEST_ROOT in $PATH
  t0021: use write_script to create rot13 shell script
2016-11-10 13:17:30 -08:00
Junio C Hamano 81cf0b6c7e Merge branch 'ls/filter-process'
Test portability improvements and optimization for an
already-graduated topic.

* ls/filter-process:
  t0021: compute file size with a single process instead of a pipeline
  t0021: expect more variations in the output of uniq -c
2016-11-10 13:17:30 -08:00
Andreas Schwab c1e0dc59bd t6026-merge-attr: ensure that the merge driver was called
Explicitly check for the existence of the pid file to test that the
merge driver was actually called.

Signed-off-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-10 11:20:56 -08:00
Andreas Schwab 734fde2d71 t6026-merge-attr: don't fail if sleep exits early
Commit 5babb5bdb3 ("t6026-merge-attr: clean up background process at end
of test case") added a kill command to clean up after the test, but this
can fail if the sleep command exits before the cleanup is executed.
Ignore the error from the kill command.

Signed-off-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Jeff King <peff@peff.net>
2016-11-08 15:29:24 -05:00
Jeff King 37a95862c6 alternates: re-allow relative paths from environment
Commit 670c359da (link_alt_odb_entry: handle normalize_path
errors, 2016-10-03) regressed the handling of relative paths
in the GIT_ALTERNATE_OBJECT_DIRECTORIES variable. It's not
entirely clear this was ever meant to work, but it _has_
worked for several years, so this commit restores the
original behavior.

When we get a path in GIT_ALTERNATE_OBJECT_DIRECTORIES, we
add it the path to the list of alternate object directories
as if it were found in objects/info/alternates, but with one
difference: we do not provide the link_alt_odb_entry()
function with a base for relative paths. That function
doesn't turn it into an absolute path, and we end up feeding
the relative path to the strbuf_normalize_path() function.

Most relative paths break out of the top-level directory
(e.g., "../foo.git/objects"), and thus normalizing fails.
Prior to 670c359da, we simply ignored the error, and due to
the way normalize_path_copy() was implemented it happened to
return the original path in this case. We then accessed the
alternate objects using this relative path.

By storing the relative path in the alt_odb list, the path
is relative to wherever we happen to be at the time we do an
object lookup. That means we look from $GIT_DIR in a bare
repository, and from the top of the worktree in a non-bare
repository.

If this were being designed from scratch, it would make
sense to pick a stable location (probably $GIT_DIR, or even
the object directory) and use that as the relative base,
turning the result into an absolute path.  However, given
the history, at this point the minimal fix is to match the
pre-670c359da behavior.

We can do this simply by ignoring the error when we have no
relative base and using the original value (which we now
reliably have, thanks to strbuf_normalize_path()).

That still leaves us with a relative path that foils our
duplicate detection, and may act strangely if we ever
chdir() later in the process. We could solve that by storing
an absolute path based on getcwd(). That may be a good
future direction; for now we'll do just the minimum to fix
the regression.

The new t5615 script demonstrates the fix in its final three
tests. Since we didn't have any tests of the alternates
environment variable at all, it also adds some tests of
absolute paths.

Reported-by: Bryan Turner <bturner@atlassian.com>
Signed-off-by: Jeff King <peff@peff.net>
2016-11-08 15:28:22 -05:00
Johannes Sixt ec2e8b3da2 t0021: compute file size with a single process instead of a pipeline
Avoid unwanted coding patterns (prodigal use of pipelines), and in
particular a useless use of cat.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jeff King <peff@peff.net>
2016-11-08 15:26:40 -05:00
Johannes Sixt 038212c4c4 t0021: expect more variations in the output of uniq -c
Some versions of uniq -c write the count left-justified, other version
write it right-justified. Be prepared for both kinds.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jeff King <peff@peff.net>
2016-11-08 15:26:40 -05:00
Jeff King 4821494ebc t0021: fix filehandle usage on older perl
The rot13-filter.pl script calls methods on implicitly
defined filehandles (STDOUT, and the result of an open()
call).  Prior to perl 5.13, these methods are not
automatically loaded, and perl will complain with:

  Can't locate object method "flush" via package "IO::Handle"

Let's explicitly load IO::File (which inherits from
IO::Handle). That's more than we need for just "flush", but
matches what perl has done since:

  http://perl5.git.perl.org/perl.git/commit/15e6cdd91beb4cefae4b65e855d68cf64766965d

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-02 19:36:29 -07:00
Jeff King f272696a35 t0021: use $PERL_PATH for rot13-filter.pl
The rot13-filter.pl script hardcodes "#!/usr/bin/perl", and
does not respect $PERL_PATH at all. That is a problem if the
system does not have perl at that path, or if it has a perl
that is too old to run a complicated script like the
rot13-filter (but PERL_PATH points to a more modern one).

We can fix this by using write_script() to create a new copy
of the script with the correct #!-line. In theory we could
move the whole script inside t0021-conversion.sh rather than
having it as an auxiliary file, but it's long enough that
it just makes things harder to read.

As a bonus, we can stop using the full path to the script in
the filter-process config we add (because the trash
directory is in our PATH). Not only is this shorter, but it
sidesteps any shell-quoting issues. The original was broken
when $TEST_DIRECTORY contained a space, because it was
interpolated in the outer script.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-02 19:36:29 -07:00
Jeff King 30030a36b6 t0021: put $TEST_ROOT in $PATH
We create a rot13.sh script in the trash directory, but need
to call it by its full path when we have moved our cwd to
another directory. Let's just put $TEST_ROOT in our $PATH so
that the script is always found.

This is a minor convenience for rot13.sh, but will be a
major one when we switch rot13-filter.pl to a script in the
same directory, as it means we will not have to deal with
shell quoting inside the filter-process config.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-02 19:36:29 -07:00
Jeff King cbb6707b11 t0021: use write_script to create rot13 shell script
This avoids us fooling around with $SHELL_PATH and the
executable bit ourselves.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-02 19:36:29 -07:00
Junio C Hamano ab3ad63c9a Merge branch 'nd/test-helpers'
Update to the test framework made in 2.9 timeframe broke running
the tests under valgrind, which has been fixed.

* nd/test-helpers:
  valgrind: support test helpers
2016-10-31 13:15:27 -07:00
Junio C Hamano 9fa1f902bf Merge branch 'aw/numbered-stash'
The user always has to say "stash@{$N}" when naming a single
element in the default location of the stash, i.e. reflogs in
refs/stash.  The "git stash" command learned to accept "git stash
apply 4" as a short-hand for "git stash apply stash@{4}".

* aw/numbered-stash:
  stash: allow stashes to be referenced by index only
2016-10-31 13:15:22 -07:00
Junio C Hamano cabb79d8c1 Merge branch 'jt/trailer-with-cruft'
Update "interpret-trailers" machinery and teaches it that people in
real world write all sorts of crufts in the "trailer" that was
originally designed to have the neat-o "Mail-Header: like thing"
and nothing else.

* jt/trailer-with-cruft:
  trailer: support values folded to multiple lines
  trailer: forbid leading whitespace in trailers
  trailer: allow non-trailers in trailer block
  trailer: clarify failure modes in parse_trailer
  trailer: make args have their own struct
  trailer: streamline trailer item create and add
  trailer: use list.h for doubly-linked list
  trailer: improve const correctness
2016-10-31 13:15:22 -07:00
Junio C Hamano dbaa6bdce2 Merge branch 'ls/filter-process'
The smudge/clean filter API expect an external process is spawned
to filter the contents for each path that has a filter defined.  A
new type of "process" filter API has been added to allow the first
request to run the filter for a path to spawn a single process, and
all filtering need is served by this single process for multiple
paths, reducing the process creation overhead.

* ls/filter-process:
  contrib/long-running-filter: add long running filter example
  convert: add filter.<driver>.process option
  convert: prepare filter.<driver>.process option
  convert: make apply_filter() adhere to standard Git error handling
  pkt-line: add functions to read/write flush terminated packet streams
  pkt-line: add packet_write_gently()
  pkt-line: add packet_flush_gently()
  pkt-line: add packet_write_fmt_gently()
  pkt-line: extract set_packet_header()
  pkt-line: rename packet_write() to packet_write_fmt()
  run-command: add clean_on_exit_handler
  run-command: move check_pipe() from write_or_die to run_command
  convert: modernize tests
  convert: quote filter names in error messages
2016-10-31 13:15:21 -07:00
René Scharfe 28fab7b23d valgrind: support test helpers
Tests run with --valgrind call git commands through a wrapper script
that invokes valgrind on them.  This script (valgrind.sh) is in turn
invoked through symlinks created for each command in t/valgrind/bin/.

Since e6e7530d (test helpers: move test-* to t/helper/ subdirectory)
these symlinks have been broken for test helpers -- they point to the
old locations in the root of the build directory.  Fix that by teaching
the code for creating the links about the new location of the binaries,
and do the same in the wrapper script to allow it to find its payload.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-27 23:33:53 -07:00
Junio C Hamano 650360210a Merge branch 'nd/ita-empty-commit'
When new paths were added by "git add -N" to the index, it was
enough to circumvent the check by "git commit" to refrain from
making an empty commit without "--allow-empty".  The same logic
prevented "git status" to show such a path as "new file" in the
"Changes not staged for commit" section.

* nd/ita-empty-commit:
  commit: don't be fooled by ita entries when creating initial commit
  commit: fix empty commit creation when there's no changes but ita entries
  diff: add --ita-[in]visible-in-index
  diff-lib: allow ita entries treated as "not yet exist in index"
2016-10-27 14:58:50 -07:00
Junio C Hamano cca3be6ea1 Merge branch 'js/prepare-sequencer'
Update of the sequencer codebase to make it reusable to reimplement
"rebase -i" continues.

* js/prepare-sequencer: (27 commits)
  sequencer: mark all error messages for translation
  sequencer: start error messages consistently with lower case
  sequencer: quote filenames in error messages
  sequencer: mark action_name() for translation
  sequencer: remove overzealous assumption in rebase -i mode
  sequencer: teach write_message() to append an optional LF
  sequencer: refactor write_message() to take a pointer/length
  sequencer: roll back lock file if write_message() failed
  sequencer: stop releasing the strbuf in write_message()
  sequencer: left-trim lines read from the script
  sequencer: support cleaning up commit messages
  sequencer: support amending commits
  sequencer: allow editing the commit message on a case-by-case basis
  sequencer: introduce a helper to read files written by scripts
  sequencer: prepare for rebase -i's commit functionality
  sequencer: remember the onelines when parsing the todo file
  sequencer: get rid of the subcommand field
  sequencer: avoid completely different messages for different actions
  sequencer: strip CR from the todo script
  sequencer: completely revamp the "todo" script parsing
  ...
2016-10-27 14:58:50 -07:00
Junio C Hamano 65aaa29f7d Merge branch 'sb/submodule-ignore-trailing-slash'
A minor regression fix for "git submodule".

* sb/submodule-ignore-trailing-slash:
  t0060: sidestep surprising path mangling results on Windows
  submodule: ignore trailing slash in relative url
  submodule: ignore trailing slash on superproject URL
2016-10-27 14:58:49 -07:00
Jeff King 4ce742fc9c test-*-cache-tree: setup git dir
These test helper programs access the index, but do not ever
setup_git_directory(), meaning we just blindly looked in
".git/index". This happened to work for the purposes of our
tests (which do not run from subdirectories, nor in
non-repos), but it's a bad habit.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-26 13:30:51 -07:00
Junio C Hamano 3b1e135b87 Merge branch 'ex/deprecate-empty-pathspec-as-match-all'
An empty string used as a pathspec element has always meant
'everything matches', but it is too easy to write a script that
finds a path to remove in $path and run 'git rm "$paht"', which
ends up removing everything.  Start warning about this use of an
empty string used for 'everything matches' and ask users to use a
more explicit '.' for that instead.

The hope is that existing users will not mind this change, and
eventually the warning can be turned into a hard error, upgrading
the deprecation into removal of this (mis)feature.

* ex/deprecate-empty-pathspec-as-match-all:
  pathspec: warn on empty strings as pathspec
2016-10-26 13:14:56 -07:00
Junio C Hamano f4db874d9a Merge branch 'jk/tap-verbose-fix'
The Travis CI configuration we ship ran the tests with --verbose
option but this risks non-TAP output that happens to be "ok" to be
misinterpreted as TAP signalling a test that passed.  This resulted
in unnecessary failure.  This has been corrected by introducing a
new mode to run our tests in the test harness to send the verbose
output separately to the log file.

* jk/tap-verbose-fix:
  test-lib: bail out when "-v" used under "prove"
  travis: use --verbose-log test option
  test-lib: add --verbose-log option
  test-lib: handle TEST_OUTPUT_DIRECTORY with spaces
2016-10-26 13:14:54 -07:00
Junio C Hamano bdcaebbedd Merge branch 'mm/send-email-cc-cruft-after-address'
"git send-email" attempts to pick up valid e-mails from the
trailers, but people in real world write non-addresses there, like
"Cc: Stable <add@re.ss> # 4.8+", which broke the output depending
on the availability and vintage of Mail::Address perl module.

* mm/send-email-cc-cruft-after-address:
  Git.pm: add comment pointing to t9000
  t9000-addresses: update expected results after fix
  parse_mailboxes: accept extra text after <...> address
2016-10-26 13:14:53 -07:00
Junio C Hamano d347fb6596 Merge branch 'jk/diff-submodule-diff-inline'
A recently graduated topic regressed "git rev-list --header"
output, breaking "gitweb".  This has been fixed.

* jk/diff-submodule-diff-inline:
  rev-list: use hdr_termination instead of a always using a newline
2016-10-26 13:14:51 -07:00
Junio C Hamano 78498729e4 Merge branch 'tg/add-chmod+x-fix'
A hot-fix for a test added by a recent topic that went to both
'master' and 'maint' already.

* tg/add-chmod+x-fix:
  t3700: fix broken test under !SANITY
2016-10-26 13:14:50 -07:00