gitweb.git
hex: make wraparound of the index into ring-buffer... René Scharfe Sun, 23 Oct 2016 17:57:30 +0000 (19:57 +0200)

hex: make wraparound of the index into ring-buffer explicit

Overflow is defined for unsigned integers, but not for signed ones.

We could make the ring-buffer index in sha1_to_hex() and
get_pathname() unsigned to be on the safe side to resolve this, but
let's make it explicit that we are wrapping around at whatever the
number of elements the ring-buffer has. The compiler is smart enough
to turn modulus into bitmask for these codepaths that use
ring-buffers of a size that is a power of 2.

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

stash: allow stashes to be referenced by index onlyAaron M Watson Mon, 24 Oct 2016 23:40:13 +0000 (19:40 -0400)

stash: allow stashes to be referenced by index only

Instead of referencing "stash@{n}" explicitly, make it possible to
simply reference as "n". Most users only reference stashes by their
position in the stash stack (what I refer to as the "index" here).

The syntax for the typical stash (stash@{n}) is slightly annoying and
easy to forget, and sometimes difficult to escape properly in a
script. Because of this the capability to do things with the stash by
simply referencing the index is desirable.

This patch includes the superior implementation provided by Øsse Walle
(thanks for that), with a slight change to fix a broken test in the test
suite. I also merged the test scripts as suggested by Jeff King, and
un-wrapped the documentation as suggested by Junio Hamano.

Signed-off-by: Aaron M Watson <watsona4@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>

t0060: sidestep surprising path mangling results on... Johannes Sixt Tue, 18 Oct 2016 20:06:07 +0000 (22:06 +0200)

t0060: sidestep surprising path mangling results on Windows

When an MSYS program (such as the bash that drives the test suite)
invokes git on Windows, absolute Unix style paths are transformed into
Windows native absolute paths (drive letter form). However, this
transformation also includes some simplifications that are not just
straight-forward textual substitutions:

- When the path ends in "/.", then the dot is stripped, but not the
directory separator.

- When the path contains "..", then it is optimized away if possible,
e.g., "/c/dir/foo/../bar" becomes "c:/dir/bar".

These additional transformations violate the assumptions of some
submodule path tests. We can avoid them when the input is already a
Windows native path, because then MSYS leaves the path unmolested.

Convert the uses of $PWD to $(pwd); the latter returns a native Windows
path.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read-cache: make sure file handles are not inherited... Lars Schneider Mon, 24 Oct 2016 18:03:00 +0000 (20:03 +0200)

read-cache: make sure file handles are not inherited by child processes

This fixes "convert: add filter.<driver>.process option" (edcc8581) on
Windows.

Consider the case of a file that requires filtering and is present in
branch A but not in branch B. If A is the current HEAD and we checkout B
then the following happens:

1. ce_compare_data() opens the file
2. index_fd() detects that the file requires to run a clean filter and
calls index_stream_convert_blob()
4. index_stream_convert_blob() calls convert_to_git_filter_fd()
5. convert_to_git_filter_fd() calls apply_filter() which creates a
new long running filter process (in case it is the first file
of this kind to be filtered)
6. The new filter process inherits all file handles. This is the
default on Linux/OSX and is explicitly defined in the
`CreateProcessW` call in `mingw.c` on Windows.
7. ce_compare_data() closes the file
8. Git unlinks the file as it is not present in B

The unlink operation does not work on Windows because the filter process
has still an open handle to the file. On Linux/OSX the unlink operation
succeeds but the file descriptors still leak into the child process.

Fix this problem by opening files in read-cache with the O_CLOEXEC flag
to ensure that the file descriptor does not remain open in a newly
spawned process similar to 05d1ed6148 ("mingw: ensure temporary file
handles are not inherited by child processes", 2016-08-22).

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

sha1_file: open window into packfiles with O_CLOEXECLars Schneider Mon, 24 Oct 2016 18:02:59 +0000 (20:02 +0200)

sha1_file: open window into packfiles with O_CLOEXEC

All processes that the Git main process spawns inherit the open file
descriptors of the main process. These leaked file descriptors can
cause problems.

Use the O_CLOEXEC flag similar to 05d1ed61 to fix the leaked file
descriptors.

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

sha1_file: rename git_open_noatime() to git_open()Lars Schneider Mon, 24 Oct 2016 18:02:59 +0000 (20:02 +0200)

sha1_file: rename git_open_noatime() to git_open()

This function is meant to be used when reading from files in the
object store, and the original objective was to avoid smudging atime
of loose object files too often, hence its name. Because we'll be
extending its role in the next commit to also arrange the file
descriptors they return auto-closed in the child processes, rename
it to lose "noatime" part that is too specific.

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

doc: fix the 'revert a faulty merge' ASCII art tab... Philip Oakley Mon, 24 Oct 2016 21:54:32 +0000 (22:54 +0100)

doc: fix the 'revert a faulty merge' ASCII art tab spacing

The asciidoctor doc-tool stack does not always respect the 'tab = 8 spaces' rule
expectation, particularly for the Git-for-Windows generated html pages. This
follows on from the 'doc: fix merge-base ASCII art tab spacing' fix.

Use just spaces within the block of the ascii art.

All other *.txt ascii art containing three dashes has been checked.
Asciidoctor correctly formats the other art blocks that do contain tabs.

Signed-off-by: Philip Oakley <philipoakley@iee.org
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: don't be fooled by ita entries when creating... Nguyễn Thái Ngọc Duy Mon, 24 Oct 2016 10:42:22 +0000 (17:42 +0700)

commit: don't be fooled by ita entries when creating initial commit

ita entries are dropped at tree generation phase. If the entire index
consists of just ita entries, the result would be a a commit with no
entries, which should be caught unless --allow-empty is specified. The
test "!!active_nr" is not sufficient to catch this.

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

commit: fix empty commit creation when there's no chang... Nguyễn Thái Ngọc Duy Mon, 24 Oct 2016 10:42:21 +0000 (17:42 +0700)

commit: fix empty commit creation when there's no changes but ita entries

If i-t-a entries are present and there is no change between the index
and HEAD i-t-a entries, index_differs_from() still returns "dirty, new
entries" (aka, the resulting commit is not empty), but cache-tree will
skip i-t-a entries and produce the exact same tree of current
commit.

index_differs_from() is supposed to catch this so we can abort
git-commit (unless --no-empty is specified). Update it to optionally
ignore i-t-a entries when doing a diff between the index and HEAD so
that it would return "no change" in this case and abort commit.

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

diff: add --ita-[in]visible-in-indexNguyễn Thái Ngọc Duy Mon, 24 Oct 2016 10:42:20 +0000 (17:42 +0700)

diff: add --ita-[in]visible-in-index

The option --ita-invisible-in-index exposes the "ita_invisible_in_index"
diff flag to outside to allow easier experimentation with this new mode.
The "plan" is to make --ita-invisible-in-index default to keep consistent
behavior with 'status' and 'commit', but a bunch other commands like
'apply', 'merge', 'reset'.... need to be taken into consideration as well.

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

diff-lib: allow ita entries treated as "not yet exist... Nguyễn Thái Ngọc Duy Mon, 24 Oct 2016 10:42:19 +0000 (17:42 +0700)

diff-lib: allow ita entries treated as "not yet exist in index"

When comparing the index and the working tree to show which paths are
new, and comparing the tree recorded in the HEAD and the index to see if
committing the contents recorded in the index would result in an empty
commit, we would want the former comparison to say "these are new paths"
and the latter to say "there is no change" for paths that are marked as
intent-to-add.

We made a similar attempt at d95d728a ("diff-lib.c: adjust position of
i-t-a entries in diff", 2015-03-16), which redefined the semantics of
these two comparison modes globally, which was a disaster and had to be
reverted at 78cc1a54 ("Revert "diff-lib.c: adjust position of i-t-a
entries in diff"", 2015-06-23).

To make sure we do not repeat the same mistake, introduce a new internal
diffopt option so that this different semantics can be asked for only by
callers that ask it, while making sure other unaudited callers will get
the same comparison result.

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

daemon: detect and reject too-long pathsJeff King Sat, 22 Oct 2016 04:59:38 +0000 (00:59 -0400)

daemon: detect and reject too-long paths

When we are checking the path via path_ok(), we use some
fixed PATH_MAX buffers. We write into them via snprintf(),
so there's no possibility of overflow, but it does mean we
may silently truncate the path, leading to potentially
confusing errors when the partial path does not exist.

We're better off to reject the path explicitly.

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

test-lib: bail out when "-v" used under "prove"Jeff King Sat, 22 Oct 2016 04:45:06 +0000 (00:45 -0400)

test-lib: bail out when "-v" used under "prove"

When there is a TAP harness consuming the output of our test
scripts, the "--verbose" breaks the output by mingling
test command output with TAP. Because the TAP::Harness
module used by "prove" is fairly lenient, this _usually_
works, but it violates the spec, and things get very
confusing if the commands happen to output a line that looks
like TAP (e.g., the word "ok" on its own line).

Let's detect this situation and complain. Just calling
error() isn't great, though; prove will tell us that the
script failed, but the message doesn't make it through to
the user. Instead, we can use the special TAP signal "Bail
out!". This not only shows the message to the user, but
instructs the harness to stop running the tests entirely.
This is exactly what we want here, as the problem is in the
command-line options, and every test script would produce
the same error.

The result looks like this (the first "Bailout called" line
is in red if prove uses color on your terminal):

$ make GIT_TEST_OPTS='--verbose --tee'
rm -f -r 'test-results'
*** prove ***
Bailout called. Further testing stopped: verbose mode forbidden under TAP harness; try --verbose-log
FAILED--Further testing stopped: verbose mode forbidden under TAP harness; try --verbose-log
Makefile:39: recipe for target 'prove' failed
make: *** [prove] Error 255

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

transport: compute summary-width dynamicallyJunio C Hamano Sat, 22 Oct 2016 04:33:06 +0000 (21:33 -0700)

transport: compute summary-width dynamically

Now all that is left to do is to actually iterate over the refs
and measure the display width needed to show their abbreviation.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

transport: allow summary-width to be computed dynamicallyJunio C Hamano Fri, 21 Oct 2016 22:28:07 +0000 (15:28 -0700)

transport: allow summary-width to be computed dynamically

Now we have identified three callchains that have a set of refs that
they want to show their <old, new> object names in an aligned output,
we can replace their reference to the constant TRANSPORT_SUMMARY_WIDTH
with a helper function call to transport_summary_width() that takes
the set of ref as a parameter. This step does not yet iterate over
the refs and compute, which is left as an exercise to the readers.

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

fetch: pass summary_width down the callchainJunio C Hamano Fri, 21 Oct 2016 22:22:55 +0000 (15:22 -0700)

fetch: pass summary_width down the callchain

The leaf function on the "fetch" side that uses TRANSPORT_SUMMARY_WIDTH
constant is builtin/fetch.c::format_display() and it has two distinct
callchains. The one that reports the primary result of fetch originates
at store_updated_refs(); the other one that reports the pruning of
the remote-tracking refs originates at prune_refs().

Teach these two places to pass summary_width down the callchain,
just like we did for the "push" side in the previous commit.

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

transport: pass summary_width down the callchainJunio C Hamano Fri, 21 Oct 2016 21:39:41 +0000 (14:39 -0700)

transport: pass summary_width down the callchain

The callchain that originates at transport_print_push_status()
eventually hits a single leaf function, print_ref_status(), that is
used to show from what old object to what new object a ref got
updated, and the width of the part that shows old and new object
names used a constant TRANSPORT_SUMMARY_WIDTH.

Teach the callchain to pass the width down from the top instead.
This allows a future enhancement to compute the necessary display
width before calling down this callchain.

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

trailer: support values folded to multiple linesJonathan Tan Fri, 21 Oct 2016 17:55:03 +0000 (10:55 -0700)

trailer: support values folded to multiple lines

Currently, interpret-trailers requires that a trailer be only on 1 line.
For example:

a: first line
second line

would be interpreted as one trailer line followed by one non-trailer line.

Make interpret-trailers support RFC 822-style folding, treating those
lines as one logical trailer.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trailer: forbid leading whitespace in trailersJonathan Tan Fri, 21 Oct 2016 17:55:02 +0000 (10:55 -0700)

trailer: forbid leading whitespace in trailers

Currently, interpret-trailers allows leading whitespace in trailer
lines. This leads to false positives, especially for quoted lines or
bullet lists.

Forbid leading whitespace in trailers.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trailer: allow non-trailers in trailer blockJonathan Tan Fri, 21 Oct 2016 17:55:01 +0000 (10:55 -0700)

trailer: allow non-trailers in trailer block

Currently, interpret-trailers requires all lines of a trailer block to
be trailers (or comments) - if not it would not identify that block as a
trailer block, and thus create its own trailer block, inserting a blank
line. For example:

echo -e "\nSigned-off-by: x\nnot trailer" |
git interpret-trailers --trailer "c: d"

would result in:

Signed-off-by: x
not trailer

c: d

Relax the definition of a trailer block to require that the trailers (i)
are all trailers, or (ii) contain at least one Git-generated trailer and
consists of at least 25% trailers.

Signed-off-by: x
not trailer
c: d

(i) is the existing functionality. (ii) allows arbitrary lines to be
included in trailer blocks, like those in [1], and still allow
interpret-trailers to be used.

[1]
https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable/+/e7d316a02f683864a12389f8808570e37fb90aa3

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trailer: clarify failure modes in parse_trailerJonathan Tan Fri, 21 Oct 2016 17:55:00 +0000 (10:55 -0700)

trailer: clarify failure modes in parse_trailer

The parse_trailer function has a few modes of operation, all depending
on whether the separator is present in its input, and if yes, the
separator's position. Some of these modes are failure modes, and these
failure modes are handled differently depending on whether the trailer
line was sourced from a file or from a command-line argument.

Extract a function to find the separator, allowing the invokers of
parse_trailer to determine how to handle the failure modes instead of
making parse_trailer do it. In this function, also take in the list of
separators, so that we can distinguish between command line arguments
(which allow '=' as separator) and file input (which does not allow '='
as separator).

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

travis: use --verbose-log test optionJeff King Fri, 21 Oct 2016 10:48:12 +0000 (06:48 -0400)

travis: use --verbose-log test option

Because we run the tests via "prove", the output from
"--verbose" may interfere with our TAP output. Using
"--verbose-log" solves this while letting us retain our
on-disk log.

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

test-lib: add --verbose-log optionJeff King Fri, 21 Oct 2016 10:48:00 +0000 (06:48 -0400)

test-lib: add --verbose-log option

The "--verbose" option redirects output from arbitrary
test commands to stdout. This is useful for examining the
output manually, like:

./t5547-push-quarantine.sh -v | less

But it also means that the output is intermingled with the
TAP directives, which can confuse a TAP parser like "prove".
This has always been a potential problem, but became an
issue recently when one test happened to output the word
"ok" on a line by itself, which prove interprets as a test
success:

$ prove t5547-push-quarantine.sh :: -v
t5547-push-quarantine.sh .. 1/? To dest.git
* [new branch] HEAD -> master
To dest.git
! [remote rejected] reject -> reject (pre-receive hook declined)
error: failed to push some refs to 'dest.git'
fatal: git cat-file d08c8eba97f4e683ece08654c7c8d2ba0c03b129: bad file
t5547-push-quarantine.sh .. Failed -1/4 subtests

Test Summary Report
-------------------
t5547-push-quarantine.sh (Wstat: 0 Tests: 5 Failed: 0)
Parse errors: Tests out of sequence. Found (2) but expected (3)
Tests out of sequence. Found (3) but expected (4)
Tests out of sequence. Found (4) but expected (5)
Bad plan. You planned 4 tests but ran 5.
Files=1, Tests=5, 0 wallclock secs ( 0.01 usr + 0.01 sys = 0.02 CPU)
Result: FAIL

One answer is "if it hurts, don't do it", but that's not
quite the whole story. The Travis tests use "--verbose
--tee" so that they can get the benefit of prove's parallel
options, along with a verbose log in case there is a
failure. We just need the verbose output to go to the log,
but keep stdout clean.

Getting this right turns out to be surprisingly difficult.
Here's the progression of alternatives I considered:

1. Add an option to write verbose output to stderr. This is
hard to capture, though, because we want each test to
have its own log (because they're all run in parallel
and the jumbled output would be useless).

2. Add an option to write verbose output to a file in
test-results. This works, but the log is missing all of
the non-verbose output, which gives context.

3. Like (2), but teach say_color() to additionally output
to the log. This mostly works, but misses any output
that happens outside of the say() functions (which isn't
a lot, but is a potential maintenance headache).

4. Like (2), but make the log file the same as the "--tee"
file. That almost works, but now we have two processes
opening the same file. That gives us two separate
descriptors, each with their own idea of the current
position. They'll each start writing at offset 0, and
overwrite each other's data.

5. Like (4), but in each case open the file for appending.
That atomically positions each write at the end of the
file.

It's possible we may still get sheared writes between
the two processes, but this is already the case when
writing to stdout. It's not a problem in practice
because the test harness generally waits for snippets to
finish before writing the TAP output.

We can ignore buffering issues with tee, because POSIX
mandates that it does not buffer. Likewise, POSIX
specifies "tee -a", so it should be available
everywhere.

This patch implements option (5), which seems to work well
in practice.

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

test-lib: handle TEST_OUTPUT_DIRECTORY with spacesJeff King Fri, 21 Oct 2016 10:42:10 +0000 (06:42 -0400)

test-lib: handle TEST_OUTPUT_DIRECTORY with spaces

We are careful in test_done to handle a results directory
with a space in it, but the "--tee" code path does not.
Doing:

export TEST_OUTPUT_DIRECTORY='/tmp/path with spaces'
./t000-init.sh --tee

results in errors. Let's consistently double-quote our path
variables so that this works.

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

Git.pm: add comment pointing to t9000Matthieu Moy Fri, 21 Oct 2016 09:20:24 +0000 (11:20 +0200)

Git.pm: add comment pointing to t9000

parse_mailboxes should probably eventually be completely equivalent to
Mail::Address, and if this happens we can drop the Mail::Address
dependency. Add a comment in the code reminding the current state of the
code, and point to the corresponding failing test to help future
contributors to get it right.

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

t9000-addresses: update expected results after fixMatthieu Moy Fri, 21 Oct 2016 09:20:23 +0000 (11:20 +0200)

t9000-addresses: update expected results after fix

e3fdbcc8e1 (parse_mailboxes: accept extra text after <...> address,
2016-10-13) improved our in-house address parser and made it closer to
Mail::Address. As a consequence, some tests comparing it to
Mail::Address now pass, but e3fdbcc8e1 forgot to update the test.

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

doc: fix merge-base ASCII art tab spacingPhilip Oakley Thu, 20 Oct 2016 23:40:09 +0000 (00:40 +0100)

doc: fix merge-base ASCII art tab spacing

The doc-tool stack does not always respect the 'tab = 8 spaces' rule,
particularly the git-scm doc pages https://git-scm.com/docs/git-merge-base
and the Git generated html pages.

Use just spaces within the block of the ascii art.

Noticed when reviewing Junio's suggested update to `git merge-base`
https://public-inbox.org/git/xmqqmvi2sj8f.fsf@gitster.mtv.corp.google.com/T/#u

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: mark all error messages for translationJohannes Schindelin Fri, 21 Oct 2016 12:26:32 +0000 (14:26 +0200)

sequencer: mark all error messages for translation

There was actually only one error message that was not yet marked for
translation.

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

sequencer: start error messages consistently with lower... Johannes Schindelin Fri, 21 Oct 2016 12:26:25 +0000 (14:26 +0200)

sequencer: start error messages consistently with lower case

Quite a few error messages touched by this developer during the work to
speed up rebase -i started with an upper case letter, violating our
current conventions. Instead of sneaking in this fix (and forgetting
quite a few error messages), let's just have one wholesale patch fixing
all of the error messages in the sequencer.

While at it, the funny "error: Error wrapping up..." was changed to a
less funny, but more helpful, "error: failed to finalize...".

Pointed out by Junio Hamano.

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

sequencer: quote filenames in error messagesJohannes Schindelin Fri, 21 Oct 2016 12:26:21 +0000 (14:26 +0200)

sequencer: quote filenames in error messages

This makes the code consistent by fixing quite a couple of error messages.

Suggested by Jakub Narębski.

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

sequencer: mark action_name() for translationJohannes Schindelin Fri, 21 Oct 2016 12:26:17 +0000 (14:26 +0200)

sequencer: mark action_name() for translation

The definition of this function goes back all the way to 043a449
(sequencer: factor code out of revert builtin, 2012-01-11), long before a
serious effort was made to translate all the error messages.

It is slightly out of the context of the current patch series (whose
purpose it is to re-implement the performance critical parts of the
interactive rebase in C) to make the error messages in the sequencer
translatable, but what the heck. We'll just do it while we're looking at
this part of the code.

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

sequencer: remove overzealous assumption in rebase... Johannes Schindelin Fri, 21 Oct 2016 12:26:13 +0000 (14:26 +0200)

sequencer: remove overzealous assumption in rebase -i mode

The sequencer was introduced to make the cherry-pick and revert
functionality available as library function, with the original idea
being to extend the sequencer to also implement the rebase -i
functionality.

The test to ensure that all of the commands in the script are identical
to the overall operation does not mesh well with that.

Therefore let's disable the test in rebase -i mode.

While at it, error out early if the "instruction sheet" (i.e. the todo
script) could not be parsed.

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

sequencer: teach write_message() to append an optional LFJohannes Schindelin Fri, 21 Oct 2016 12:26:09 +0000 (14:26 +0200)

sequencer: teach write_message() to append an optional LF

This commit prepares for future callers that will have a pointer/length
to some text to be written that lacks an LF, yet an LF is desired.
Instead of requiring the caller to append an LF to the buffer (and
potentially allocate memory to do so), the write_message() function
learns to append an LF at the end of the file.

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

sequencer: refactor write_message() to take a pointer... Johannes Schindelin Fri, 21 Oct 2016 12:26:05 +0000 (14:26 +0200)

sequencer: refactor write_message() to take a pointer/length

Previously, we required an strbuf. But that limits the use case too much.
In the upcoming patch series (for which the current patch series prepares
the sequencer), we will want to write content to a file for which we have
a pointer and a length, not an strbuf.

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

sequencer: roll back lock file if write_message() failedJohannes Schindelin Fri, 21 Oct 2016 12:26:00 +0000 (14:26 +0200)

sequencer: roll back lock file if write_message() failed

There is no need to wait until the atexit() handler kicks in at the end.

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

sequencer: stop releasing the strbuf in write_message()Johannes Schindelin Fri, 21 Oct 2016 12:25:41 +0000 (14:25 +0200)

sequencer: stop releasing the strbuf in write_message()

Nothing in the name "write_message()" suggests that the function
releases the strbuf passed to it. So let's release the strbuf in the
caller instead.

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

sequencer: left-trim lines read from the scriptJohannes Schindelin Fri, 21 Oct 2016 12:25:36 +0000 (14:25 +0200)

sequencer: left-trim lines read from the script

Interactive rebase's scripts may be indented; we need to handle this
case, too, now that we prepare the sequencer to process interactive
rebases.

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

sequencer: support cleaning up commit messagesJohannes Schindelin Fri, 21 Oct 2016 12:25:28 +0000 (14:25 +0200)

sequencer: support cleaning up commit messages

The run_git_commit() function already knows how to amend commits, and
with this new option, it can also clean up commit messages (i.e. strip
out commented lines). This is needed to implement rebase -i's 'fixup'
and 'squash' commands as sequencer commands.

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

sequencer: support amending commitsJohannes Schindelin Fri, 21 Oct 2016 12:25:17 +0000 (14:25 +0200)

sequencer: support amending commits

This teaches the run_git_commit() function to take an argument that will
allow us to implement "todo" commands that need to amend the commit
messages ("fixup", "squash" and "reword").

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

sequencer: allow editing the commit message on a case... Johannes Schindelin Fri, 21 Oct 2016 12:25:12 +0000 (14:25 +0200)

sequencer: allow editing the commit message on a case-by-case basis

In the upcoming commits, we will implement more and more of rebase -i's
functionality inside the sequencer. One particular feature of the
commands to come is that some of them allow editing the commit message
while others don't, i.e. we cannot define in the replay_opts whether the
commit message should be edited or not.

Let's add a new parameter to the run_git_commit() function. Previously,
it was the duty of the caller to ensure that the opts->edit setting
indicates whether to let the user edit the commit message or not,
indicating that it is an "all or nothing" setting, i.e. that the
sequencer wants to let the user edit *all* commit message, or none at
all. In the upcoming rebase -i mode, it will depend on the particular
command that is currently executed, though.

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

sequencer: introduce a helper to read files written... Johannes Schindelin Fri, 21 Oct 2016 12:25:08 +0000 (14:25 +0200)

sequencer: introduce a helper to read files written by scripts

As we are slowly teaching the sequencer to perform the hard work for
the interactive rebase, we need to read files that were written by
shell scripts.

These files typically contain a single line and are invariably ended
by a line feed (and possibly a carriage return before that). Let's use
a helper to read such files and to remove the line ending.

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

sequencer: prepare for rebase -i's commit functionalityJohannes Schindelin Fri, 21 Oct 2016 12:25:04 +0000 (14:25 +0200)

sequencer: prepare for rebase -i's commit functionality

In interactive rebases, we commit a little bit differently than the
sequencer did so far: we heed the "author-script", the "message" and the
"amend" files in the .git/rebase-merge/ subdirectory.

Likewise, we may want to edit the commit message *even* when providing a
file containing the suggested commit message. Therefore we change the
code to not even provide a default message when we do not want any, and
to call the editor explicitly.

Also, in "interactive rebase" mode we want to skip reading the options
in the state directory of the cherry-pick/revert commands.

Finally, as interactive rebase's GPG settings are configured differently
from how cherry-pick (and therefore sequencer) handles them, we will
leave support for that to the next commit.

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

sequencer: remember the onelines when parsing the todo... Johannes Schindelin Fri, 21 Oct 2016 12:25:00 +0000 (14:25 +0200)

sequencer: remember the onelines when parsing the todo file

The `git-rebase-todo` file contains a list of commands. Most of those
commands have the form

<verb> <sha1> <oneline>

The <oneline> is displayed primarily for the user's convenience, as
rebase -i really interprets only the <verb> <sha1> part. However, there
are *some* places in interactive rebase where the <oneline> is used to
display messages, e.g. for reporting at which commit we stopped.

So let's just remember it when parsing the todo file; we keep a copy of
the entire todo file anyway (to write out the new `done` and
`git-rebase-todo` file just before processing each command), so all we
need to do is remember the begin offsets and lengths.

As we will have to parse and remember the command-line for `exec` commands
later, we do not call the field "oneline" but rather "arg" (and will reuse
that for exec's command-line).

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

sequencer: get rid of the subcommand fieldJohannes Schindelin Fri, 21 Oct 2016 12:24:55 +0000 (14:24 +0200)

sequencer: get rid of the subcommand field

The subcommands are used exactly once, at the very beginning of
sequencer_pick_revisions(), to determine what to do. This is an
unnecessary level of indirection: we can simply call the correct
function to begin with. So let's do that.

While at it, ensure that the subcommands return an error code so that
they do not have to die() all over the place (bad practice for library
functions...).

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

sequencer: avoid completely different messages for... Johannes Schindelin Fri, 21 Oct 2016 12:24:50 +0000 (14:24 +0200)

sequencer: avoid completely different messages for different actions

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

sequencer: strip CR from the todo scriptJohannes Schindelin Fri, 21 Oct 2016 12:24:46 +0000 (14:24 +0200)

sequencer: strip CR from the todo script

It is not unheard of that editors on Windows write CR/LF even if the
file originally had only LF. This is particularly awkward for exec lines
of a rebase -i todo sheet. Take for example the insn "exec echo": The
shell script parser splits at the LF and leaves the CR attached to
"echo", which leads to the unknown command "echo\r".

Work around that by stripping CR when reading the todo commands, as we
already do for LF.

This happens to fix t9903.14 and .15 in MSYS1 environments (with the
rebase--helper patches based on this patch series): the todo script
constructed in such a setup contains CR/LF thanks to MSYS1 runtime's
cleverness.

Based on a report and a patch by Johannes Sixt.

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

sequencer: completely revamp the "todo" script parsingJohannes Schindelin Fri, 21 Oct 2016 12:24:41 +0000 (14:24 +0200)

sequencer: completely revamp the "todo" script parsing

When we came up with the "sequencer" idea, we really wanted to have
kind of a plumbing equivalent of the interactive rebase. Hence the
choice of words: the "todo" script, a "pick", etc.

However, when it came time to implement the entire shebang, somehow this
idea got lost and the sequencer was used as working horse for
cherry-pick and revert instead. So as not to interfere with the
interactive rebase, it even uses a separate directory to store its
state.

Furthermore, it also is stupidly strict about the "todo" script it
accepts: while it parses commands in a way that was *designed* to be
similar to the interactive rebase, it then goes on to *error out* if the
commands disagree with the overall action (cherry-pick or revert).

Finally, the sequencer code chose to deviate from the interactive rebase
code insofar that when it comes to writing the file with the remaining
commands, it *reformats* the "todo" script instead of just writing the
part of the parsed script that were not yet processed. This is not only
unnecessary churn, but might well lose information that is valuable to
the user (i.e. comments after the commands).

Let's just bite the bullet and rewrite the entire parser; the code now
becomes not only more elegant: it allows us to go on and teach the
sequencer how to parse *true* "todo" scripts as used by the interactive
rebase itself. In a way, the sequencer is about to grow up to do its
older brother's job. Better.

In particular, we choose to maintain the list of commands in an array
instead of a linked list: this is flexible enough to allow us later on to
even implement rebase -i's reordering of fixup!/squash! commits very
easily (and with a very nice speed bonus, at least on Windows).

While at it, do not stop at the first problem, but list *all* of the
problems. This will help the user when the sequencer will do `rebase
-i`'s work by allowing to address all issues in one go rather than going
back and forth until the todo list is valid.

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

sequencer: refactor the code to obtain a short commit... Johannes Schindelin Fri, 21 Oct 2016 12:24:37 +0000 (14:24 +0200)

sequencer: refactor the code to obtain a short commit name

Not only does this DRY up the code (providing a better documentation what
the code is about, as well as allowing to change the behavior in a single
place), it also makes it substantially shorter to use the same
functionality in functions to be introduced when we teach the sequencer to
process interactive-rebase's git-rebase-todo file.

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

sequencer: future-proof read_populate_todo()Johannes Schindelin Fri, 21 Oct 2016 12:24:32 +0000 (14:24 +0200)

sequencer: future-proof read_populate_todo()

Over the next commits, we will work on improving the sequencer to the
point where it can process the todo script of an interactive rebase. To
that end, we will need to teach the sequencer to read interactive
rebase's todo file. In preparation, we consolidate all places where
that todo file is needed to call a function that we will later extend.

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

sequencer: plug memory leaks for the option valuesJohannes Schindelin Fri, 21 Oct 2016 12:24:13 +0000 (14:24 +0200)

sequencer: plug memory leaks for the option values

The sequencer is our attempt to lib-ify cherry-pick. Yet it behaves
like a one-shot command when it reads its configuration: memory is
allocated and released only when the command exits.

This is kind of okay for git-cherry-pick, which *is* a one-shot
command. All the work to make the sequencer its work horse was
done to allow using the functionality as a library function, though,
including proper clean-up after use.

To remedy that, take custody of the option values in question,
allocating and duping literal constants as needed and freeing them
at end.

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

trailer: make args have their own structJonathan Tan Thu, 20 Oct 2016 21:39:49 +0000 (14:39 -0700)

trailer: make args have their own struct

Improve type safety by making arguments (whether from configuration or
from the command line) have their own "struct arg_item" type, separate
from the "struct trailer_item" type used to represent the trailers in
the buffer being manipulated.

This change also prepares "struct trailer_item" to be further
differentiated from "struct arg_item" in future patches.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trailer: streamline trailer item create and addJonathan Tan Thu, 20 Oct 2016 21:39:48 +0000 (14:39 -0700)

trailer: streamline trailer item create and add

Currently, creation and addition (to a list) of trailer items are spread
across multiple functions. Streamline this by only having 2 functions:
one to parse the user-supplied string, and one to add the parsed
information to a list.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trailer: use list.h for doubly-linked listJonathan Tan Thu, 20 Oct 2016 21:39:47 +0000 (14:39 -0700)

trailer: use list.h for doubly-linked list

Replace the existing handwritten implementation of a doubly-linked list
in trailer.c with the functions and macros from list.h. This
significantly simplifies the code.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-list: use hdr_termination instead of a always using... Jacob Keller Thu, 20 Oct 2016 20:41:00 +0000 (13:41 -0700)

rev-list: use hdr_termination instead of a always using a newline

When adding support for prefixing output of log and other commands using
--line-prefix, commit 660e113ce118 ("graph: add support for
--line-prefix on all graph-aware output", 2016-08-31) accidentally
broke rev-list --header output.

In order to make the output appear with a line-prefix, the flow was
changed to always use the graph subsystem for display. Unfortunately
the graph flow in rev-list did not use info->hdr_termination as it was
assumed that graph output would never need to putput NULs.

Since we now always use the graph code in order to handle the case of
line-prefix, simply replace putchar('\n') with
putchar(info->hdr_termination) which will correct this issue.

Add a test for the --header case to make sure we don't break it in the
future.

Reported-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge tag 'gitgui-0.21.0' of git://repo.or.cz/git-guiJunio C Hamano Thu, 20 Oct 2016 16:33:17 +0000 (09:33 -0700)

Merge tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui

git-gui 0.21.0

* tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui: (22 commits)
git-gui: set version 0.21
git-gui: Mark 'All' in remote.tcl for translation
git-gui i18n: Updated Bulgarian translation (565,0f,0u)
git-gui: avoid persisting modified author identity
git-gui: handle the encoding of Git's output correctly
git-gui: unicode file name support on windows
git-gui: Update Russian translation
git-gui: maintain backwards compatibility for merge syntax
git-gui i18n: mark string in lib/error.tcl for translation
git-gui: fix incorrect use of Tcl append command
git-gui i18n: mark "usage:" strings for translation
git-gui i18n: internationalize use of colon punctuation
git-gui: ensure the file in the diff pane is in the list of selected files
git-gui: support for $FILENAMES in tool definitions
git-gui: fix initial git gui message encoding
git-gui/po/glossary/txt-to-pot.sh: use the $( ... ) construct for command substitution
git-gui (Windows): use git-gui.exe in `Create Desktop Shortcut`
git-gui: fix detection of Cygwin
Amend tab ordering and text widget border and highlighting.
Allow keyboard control to work in the staging widgets.
...

doc: remove reference to the traditional layout in... Younes Khoudli Thu, 20 Oct 2016 13:21:44 +0000 (15:21 +0200)

doc: remove reference to the traditional layout in git-tag.txt

This is the only place in the documentation that the traditional layout
is mentioned, and it is confusing. Remove it.

* Documentation/git-tag.txt: Here.

Signed-off-by: Younes Khoudli <younes.khoudli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3700: fix broken test under !SANITYJunio C Hamano Mon, 10 Oct 2016 17:41:51 +0000 (10:41 -0700)

t3700: fix broken test under !SANITY

An "add --chmod=+x" test recently added by 610d55af0f ("add: modify
already added files when --chmod is given", 2016-09-14) used "xfoo3"
as a test file. The paths xfoo[1-3] were used by earlier tests for
symbolic links but they were expected to have been removed by the
time the execution reached this new test.

The removal with "git reset --hard" however happened in a pair of
earlier tests, both of which are protected by POSIXPERM,SANITY
prerequisites. Platforms and test environments that lacked these
would have seen xfoo3 as a leftover symbolic link that points at
somewhere else at this point of the sequence, and the chmod test
would have given a wrong result.

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

git-gui: set version 0.21 gitgui-0.21.0Pat Thoyts Thu, 20 Oct 2016 10:19:43 +0000 (11:19 +0100)

git-gui: set version 0.21

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Merge branch 'as/bulgarian' into puPat Thoyts Thu, 20 Oct 2016 10:13:42 +0000 (11:13 +0100)

Merge branch 'as/bulgarian' into pu

git-gui: Mark 'All' in remote.tcl for translationAlexander Shopov Thu, 13 Oct 2016 18:43:48 +0000 (21:43 +0300)

git-gui: Mark 'All' in remote.tcl for translation

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui i18n: Updated Bulgarian translation (565,0f,0u)Alexander Shopov Thu, 13 Oct 2016 18:43:49 +0000 (21:43 +0300)

git-gui i18n: Updated Bulgarian translation (565,0f,0u)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Merge branch 'os/preserve-author' into puPat Thoyts Thu, 20 Oct 2016 10:07:24 +0000 (11:07 +0100)

Merge branch 'os/preserve-author' into pu

Merge branch 'kb/unicode' into puPat Thoyts Thu, 20 Oct 2016 10:06:28 +0000 (11:06 +0100)

Merge branch 'kb/unicode' into pu

submodules doc: update documentation for "." used for... Brandon Williams Wed, 19 Oct 2016 20:42:54 +0000 (13:42 -0700)

submodules doc: update documentation for "." used for submodule branches

4d7bc52b17 ("submodule update: allow '.' for branch value",
2016-08-03) adopted from Gerrit a feature to set "." as a special
value of "submodule.<name>.branch" in .gitmodules file to indicate
that the tracking branch in the submodule should be the same as the
current branch in the superproject.

Update the documentation to describe this.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: diff: mark warnings for translationVasco Almeida Mon, 17 Oct 2016 13:15:29 +0000 (13:15 +0000)

i18n: diff: mark warnings for translation

Mark rename_limit_warning and degrade_cc_to_c_warning and
rename_limit_warning for translation.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: credential-cache--daemon: mark advice for translationVasco Almeida Mon, 17 Oct 2016 13:15:28 +0000 (13:15 +0000)

i18n: credential-cache--daemon: mark advice for translation

Mark permissions_advice for translation.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: convert mark error messages for translationVasco Almeida Mon, 17 Oct 2016 13:15:27 +0000 (13:15 +0000)

i18n: convert mark error messages for translation

Mark error messages about CRLF for translation.

Update test to reflect changes.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: apply: mark error message for translationVasco Almeida Mon, 17 Oct 2016 13:15:26 +0000 (13:15 +0000)

i18n: apply: mark error message for translation

Update test to reflect changes.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0040: convert all possible tests to use `test-parse... Pranit Bauva Sat, 15 Oct 2016 12:28:13 +0000 (12:28 +0000)

t0040: convert all possible tests to use `test-parse-options --expect`

Use "test-parse-options --expect" to rewrite the tests to avoid checking
the whole variable dump by just testing what is required.

This commit is a follow-up to 8ca65aebad ("t0040: convert a few
tests to use test-parse-options --expect", 2016-05-06).

Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

inline xalloc_flex() into FLEXPTR_ALLOC_MEMRené Scharfe Sun, 16 Oct 2016 10:06:02 +0000 (12:06 +0200)

inline xalloc_flex() into FLEXPTR_ALLOC_MEM

Allocate and copy directly in FLEXPTR_ALLOC_MEM and remove the now
unused helper function xalloc_flex(). The resulting code is shorter
and the offset arithmetic is a bit simpler.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

avoid pointer arithmetic involving NULL in FLEX_ALLOC_MEMRené Scharfe Sat, 15 Oct 2016 16:23:11 +0000 (18:23 +0200)

avoid pointer arithmetic involving NULL in FLEX_ALLOC_MEM

Calculating offsets involving a NULL pointer is undefined. It works in
practice (for now?), but we should not rely on it. Allocate first and
then simply refer to the flexible array member by its name instead of
performing pointer arithmetic up front. The resulting code is slightly
shorter, easier to read and doesn't rely on undefined behaviour.

NB: The cast to a (non-const) void pointer is necessary to keep support
for flexible array members declared as const.

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

Sync with maintJunio C Hamano Mon, 17 Oct 2016 20:52:26 +0000 (13:52 -0700)

Sync with maint

* maint:
l10n: de.po: translate 260 new messages
l10n: de.po: fix translation of autostash
l10n: ru.po: update Russian translation

Merge tag 'l10n-2.10.0-rnd2.4' of git://github.com... Junio C Hamano Mon, 17 Oct 2016 20:27:38 +0000 (13:27 -0700)

Merge tag 'l10n-2.10.0-rnd2.4' of git://github.com/git-l10n/git-po into maint

l10n-2.10.0-rnd2.4

* tag 'l10n-2.10.0-rnd2.4' of git://github.com/git-l10n/git-po:
l10n: de.po: translate 260 new messages
l10n: de.po: fix translation of autostash
l10n: ru.po: update Russian translation

Tenth batch for 2.11Junio C Hamano Mon, 17 Oct 2016 20:26:27 +0000 (13:26 -0700)

Tenth batch for 2.11

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

Merge branch 'sb/submodule-config-doc-drop-path'Junio C Hamano Mon, 17 Oct 2016 20:25:23 +0000 (13:25 -0700)

Merge branch 'sb/submodule-config-doc-drop-path'

The "submodule.<name>.path" stored in .gitmodules is never copied
to .git/config and such a key in .git/config has no meaning, but
the documentation described it and submodule.<name>.url next to
each other as if both belong to .git/config. This has been fixed.

* sb/submodule-config-doc-drop-path:
documentation: improve submodule.<name>.{url, path} description

Merge branch 'rs/pretty-format-color-doc-fix'Junio C Hamano Mon, 17 Oct 2016 20:25:23 +0000 (13:25 -0700)

Merge branch 'rs/pretty-format-color-doc-fix'

* rs/pretty-format-color-doc-fix:
pretty: fix document link for color specification

Merge branch 'js/reset-usage'Junio C Hamano Mon, 17 Oct 2016 20:25:22 +0000 (13:25 -0700)

Merge branch 'js/reset-usage'

* js/reset-usage:
reset: fix usage

Merge branch 'da/mergetool-diff-order'Junio C Hamano Mon, 17 Oct 2016 20:25:21 +0000 (13:25 -0700)

Merge branch 'da/mergetool-diff-order'

"git mergetool" learned to honor "-O<orderfile>" to control the
order of paths to present to the end user.

* da/mergetool-diff-order:
mergetool: honor -O<orderfile>
mergetool: honor diff.orderFile
mergetool: move main program flow into a main() function
mergetool: add copyright

Merge branch 'rs/cocci'Junio C Hamano Mon, 17 Oct 2016 20:25:21 +0000 (13:25 -0700)

Merge branch 'rs/cocci'

Code cleanup.

* rs/cocci:
use strbuf_add_unique_abbrev() for adding short hashes, part 3
remove unnecessary NULL check before free(3)

Merge branch 'js/regexec-buf'Junio C Hamano Mon, 17 Oct 2016 20:25:21 +0000 (13:25 -0700)

Merge branch 'js/regexec-buf'

* js/regexec-buf:
configure.ac: improve description of NO_REGEX test

Merge branch 'jk/alt-odb-cleanup'Junio C Hamano Mon, 17 Oct 2016 20:25:19 +0000 (13:25 -0700)

Merge branch 'jk/alt-odb-cleanup'

Codepaths involved in interacting alternate object store have
been cleaned up.

* jk/alt-odb-cleanup:
alternates: use fspathcmp to detect duplicates
sha1_file: always allow relative paths to alternates
count-objects: report alternates via verbose mode
fill_sha1_file: write into a strbuf
alternates: store scratch buffer as strbuf
fill_sha1_file: write "boring" characters
alternates: use a separate scratch space
alternates: encapsulate alt->base munging
alternates: provide helper for allocating alternate
alternates: provide helper for adding to alternates list
link_alt_odb_entry: refactor string handling
link_alt_odb_entry: handle normalize_path errors
t5613: clarify "too deep" recursion tests
t5613: do not chdir in main process
t5613: whitespace/style cleanups
t5613: use test_must_fail
t5613: drop test_valid_repo function
t5613: drop reachable_via function

Merge branch 'jk/ref-symlink-loop'Junio C Hamano Mon, 17 Oct 2016 20:25:20 +0000 (13:25 -0700)

Merge branch 'jk/ref-symlink-loop'

A stray symbolic link in $GIT_DIR/refs/ directory could make name
resolution loop forever, which has been corrected.

* jk/ref-symlink-loop:
files_read_raw_ref: prevent infinite retry loops in general
files_read_raw_ref: avoid infinite loop on broken symlinks

Merge branch 'jk/quarantine-received-objects'Junio C Hamano Mon, 17 Oct 2016 20:25:20 +0000 (13:25 -0700)

Merge branch 'jk/quarantine-received-objects'

In order for the receiving end of "git push" to inspect the
received history and decide to reject the push, the objects sent
from the sending end need to be made available to the hook and
the mechanism for the connectivity check, and this was done
traditionally by storing the objects in the receiving repository
and letting "git gc" to expire it. Instead, store the newly
received objects in a temporary area, and make them available by
reusing the alternate object store mechanism to them only while we
decide if we accept the check, and once we decide, either migrate
them to the repository or purge them immediately.

* jk/quarantine-received-objects:
tmp-objdir: do not migrate files starting with '.'
tmp-objdir: put quarantine information in the environment
receive-pack: quarantine objects until pre-receive accepts
tmp-objdir: introduce API for temporary object directories
check_connected: accept an env argument

Merge branch 'nd/commit-p-doc'Junio C Hamano Mon, 17 Oct 2016 20:25:19 +0000 (13:25 -0700)

Merge branch 'nd/commit-p-doc'

Documentation for "git commit" was updated to clarify that "commit
-p <paths>" adds to the current contents of the index to come up
with what to commit.

* nd/commit-p-doc:
git-commit.txt: clarify --patch mode with pathspec

Merge branch 'jk/clone-copy-alternates-fix'Junio C Hamano Mon, 17 Oct 2016 20:25:18 +0000 (13:25 -0700)

Merge branch 'jk/clone-copy-alternates-fix'

"git clone" of a local repository can be done at the filesystem
level, but the codepath did not check errors while copying and
adjusting the file that lists alternate object stores.

* jk/clone-copy-alternates-fix:
clone: detect errors in normalize_path_copy

Merge branch 'dt/http-empty-auth'Junio C Hamano Mon, 17 Oct 2016 20:25:18 +0000 (13:25 -0700)

Merge branch 'dt/http-empty-auth'

http.emptyauth configuration is a way to allow an empty username to
pass when attempting to authenticate using mechanisms like
Kerberos. We took an unspecified (NULL) username and sent ":"
(i.e. no username, no password) to CURLOPT_USERPWD, but did not do
the same when the username is explicitly set to an empty string.

* dt/http-empty-auth:
http: http.emptyauth should allow empty (not just NULL) usernames

sequencer: future-proof remove_sequencer_state()Johannes Schindelin Fri, 14 Oct 2016 13:17:20 +0000 (15:17 +0200)

sequencer: future-proof remove_sequencer_state()

In a couple of commits, we will teach the sequencer to handle the
nitty gritty of the interactive rebase, which keeps its state in a
different directory.

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

sequencer: avoid unnecessary indirectionJohannes Schindelin Fri, 14 Oct 2016 13:17:16 +0000 (15:17 +0200)

sequencer: avoid unnecessary indirection

We really do not need the *pointer to a* pointer to the options in
the read_populate_opts() function.

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

sequencer: use memoized sequencer directory pathJohannes Schindelin Fri, 14 Oct 2016 13:17:12 +0000 (15:17 +0200)

sequencer: use memoized sequencer directory path

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

sequencer: use static initializers for replay_optsJohannes Schindelin Fri, 14 Oct 2016 13:15:56 +0000 (15:15 +0200)

sequencer: use static initializers for replay_opts

This change is not completely faithful: instead of initializing all fields
to 0, we choose to initialize command and subcommand to -1 (instead of
defaulting to REPLAY_REVERT and REPLAY_NONE, respectively). Practically,
it makes no difference at all, but future-proofs the code to require
explicit assignments for both fields.

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

contrib/long-running-filter: add long running filter... Lars Schneider Sun, 16 Oct 2016 23:20:38 +0000 (16:20 -0700)

contrib/long-running-filter: add long running filter example

Add a simple pass-thru filter as example implementation for the Git
filter protocol version 2. See Documentation/gitattributes.txt, section
"Filter Protocol" for more info.

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

convert: add filter.<driver>.process optionLars Schneider Sun, 16 Oct 2016 23:20:37 +0000 (16:20 -0700)

convert: add filter.<driver>.process option

Git's clean/smudge mechanism invokes an external filter process for
every single blob that is affected by a filter. If Git filters a lot of
blobs then the startup time of the external filter processes can become
a significant part of the overall Git execution time.

In a preliminary performance test this developer used a clean/smudge
filter written in golang to filter 12,000 files. This process took 364s
with the existing filter mechanism and 5s with the new mechanism. See
details here: https://github.com/github/git-lfs/pull/1382

This patch adds the `filter.<driver>.process` string option which, if
used, keeps the external filter process running and processes all blobs
with the packet format (pkt-line) based protocol over standard input and
standard output. The full protocol is explained in detail in
`Documentation/gitattributes.txt`.

A few key decisions:

* The long running filter process is referred to as filter protocol
version 2 because the existing single shot filter invocation is
considered version 1.
* Git sends a welcome message and expects a response right after the
external filter process has started. This ensures that Git will not
hang if a version 1 filter is incorrectly used with the
filter.<driver>.process option for version 2 filters. In addition,
Git can detect this kind of error and warn the user.
* The status of a filter operation (e.g. "success" or "error) is set
before the actual response and (if necessary!) re-set after the
response. The advantage of this two step status response is that if
the filter detects an error early, then the filter can communicate
this and Git does not even need to create structures to read the
response.
* All status responses are pkt-line lists terminated with a flush
packet. This allows us to send other status fields with the same
protocol in the future.

Helped-by: Martin-Louis Bright <mlbright@gmail.com>
Reviewed-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

convert: prepare filter.<driver>.process optionLars Schneider Sun, 16 Oct 2016 23:20:36 +0000 (16:20 -0700)

convert: prepare filter.<driver>.process option

Refactor the existing 'single shot filter mechanism' and prepare the
new 'long running filter mechanism'.

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

convert: make apply_filter() adhere to standard Git... Lars Schneider Sun, 16 Oct 2016 23:20:35 +0000 (16:20 -0700)

convert: make apply_filter() adhere to standard Git error handling

apply_filter() returns a boolean that tells the caller if it
"did convert or did not convert". The variable `ret` was used throughout
the function to track errors whereas `1` denoted success and `0`
failure. This is unusual for the Git source where `0` denotes success.

Rename the variable and flip its value to make the function easier
readable for Git developers.

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

pkt-line: add functions to read/write flush terminated... Lars Schneider Sun, 16 Oct 2016 23:20:34 +0000 (16:20 -0700)

pkt-line: add functions to read/write flush terminated packet streams

write_packetized_from_fd() and write_packetized_from_buf() write a
stream of packets. All content packets use the maximal packet size
except for the last one. After the last content packet a `flush` control
packet is written.

read_packetized_to_strbuf() reads arbitrary sized packets until it
detects a `flush` packet.

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

pkt-line: add packet_write_gently()Lars Schneider Sun, 16 Oct 2016 23:20:33 +0000 (16:20 -0700)

pkt-line: add packet_write_gently()

packet_write_fmt_gently() uses format_packet() which lets the caller
only send string data via "%s". That means it cannot be used for
arbitrary data that may contain NULs.

Add packet_write_gently() which writes arbitrary data and does not die
in case of an error. The function is used by other pkt-line functions in
a subsequent patch.

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

pkt-line: add packet_flush_gently()Lars Schneider Sun, 16 Oct 2016 23:20:32 +0000 (16:20 -0700)

pkt-line: add packet_flush_gently()

packet_flush() would die in case of a write error even though for some
callers an error would be acceptable. Add packet_flush_gently() which
writes a pkt-line flush packet like packet_flush() but does not die in
case of an error. The function is used in a subsequent patch.

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

pkt-line: add packet_write_fmt_gently()Lars Schneider Sun, 16 Oct 2016 23:20:31 +0000 (16:20 -0700)

pkt-line: add packet_write_fmt_gently()

packet_write_fmt() would die in case of a write error even though for
some callers an error would be acceptable. Add packet_write_fmt_gently()
which writes a formatted pkt-line like packet_write_fmt() but does not
die in case of an error. The function is used in a subsequent patch.

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

pkt-line: extract set_packet_header()Lars Schneider Sun, 16 Oct 2016 23:20:30 +0000 (16:20 -0700)

pkt-line: extract set_packet_header()

Extracted set_packet_header() function converts an integer to a 4 byte
hex string. Make this function locally available so that other pkt-line
functions could use it.

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

pkt-line: rename packet_write() to packet_write_fmt()Lars Schneider Sun, 16 Oct 2016 23:20:29 +0000 (16:20 -0700)

pkt-line: rename packet_write() to packet_write_fmt()

packet_write() should be called packet_write_fmt() because it is a
printf-like function that takes a format string as first parameter.

packet_write_fmt() should be used for text strings only. Arbitrary
binary data should use a new packet_write() function that is introduced
in a subsequent patch.

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