gitweb.git
Merge branch 'jc/mailinfo-lib'Junio C Hamano Thu, 29 Oct 2015 20:59:21 +0000 (13:59 -0700)

Merge branch 'jc/mailinfo-lib'

The implementation of "git mailinfo" was refactored so that a
mailinfo() function can be directly called from inside a process.

* jc/mailinfo-lib: (34 commits)
mailinfo: remove calls to exit() and die() deep in the callchain
mailinfo: handle charset conversion errors in the caller
mailinfo: libify
mailinfo: keep the parsed log message in a strbuf
mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak
mailinfo: move content/content_top to struct mailinfo
mailinfo: move [ps]_hdr_data to struct mailinfo
mailinfo: move cmitmsg and patchfile to struct mailinfo
mailinfo: move charset to struct mailinfo
mailinfo: move transfer_encoding to struct mailinfo
mailinfo: move check for metainfo_charset to convert_to_utf8()
mailinfo: move metainfo_charset to struct mailinfo
mailinfo: move use_scissors and use_inbody_headers to struct mailinfo
mailinfo: move add_message_id and message_id to struct mailinfo
mailinfo: move patch_lines to struct mailinfo
mailinfo: move filter/header stage to struct mailinfo
mailinfo: move global "FILE *fin, *fout" to struct mailinfo
mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo
mailinfo: introduce "struct mailinfo" to hold globals
mailinfo: move global "line" into mailinfo() function
...

Merge branch 'rp/link-curl-before-ssl'Junio C Hamano Thu, 29 Oct 2015 20:59:20 +0000 (13:59 -0700)

Merge branch 'rp/link-curl-before-ssl'

The linkage order of libraries was wrong in places around libcurl.

* rp/link-curl-before-ssl:
configure.ac: detect ssl need with libcurl
Makefile: make curl-config path configurable
Makefile: link libcurl before zlib

Merge branch 'dt/name-hash-dir-entry-fix'Junio C Hamano Thu, 29 Oct 2015 20:59:19 +0000 (13:59 -0700)

Merge branch 'dt/name-hash-dir-entry-fix'

The name-hash subsystem that is used to cope with case insensitive
filesystems keeps track of directories and their on-filesystem
cases for all the paths in the index by holding a pointer to a
randomly chosen cache entry that is inside the directory (for its
ce->ce_name component). This pointer was not updated even when the
cache entry was removed from the index, leading to use after free.
This was fixed by recording the path for each directory instead of
borrowing cache entries and restructuring the API somewhat.

* dt/name-hash-dir-entry-fix:
name-hash: don't reuse cache_entry in dir_entry

Merge branch 'tk/sigchain-unnecessary-post-tempfile'Junio C Hamano Thu, 29 Oct 2015 20:59:17 +0000 (13:59 -0700)

Merge branch 'tk/sigchain-unnecessary-post-tempfile'

Remove no-longer used #include.

* tk/sigchain-unnecessary-post-tempfile:
shallow: remove unused #include "sigchain.h"
read-cache: remove unused #include "sigchain.h"
diff: remove unused #include "sigchain.h"
credential-cache--daemon: remove unused #include "sigchain.h"

Merge branch 'jk/war-on-sprintf'Junio C Hamano Thu, 29 Oct 2015 20:59:17 +0000 (13:59 -0700)

Merge branch 'jk/war-on-sprintf'

* jk/war-on-sprintf:
compat/mingw.c: remove printf format warning
read_branches_file: plug a FILE* leak

Merge branch 'jc/em-dash-in-doc'Junio C Hamano Thu, 29 Oct 2015 20:59:16 +0000 (13:59 -0700)

Merge branch 'jc/em-dash-in-doc'

AsciiDoc markup fixes.

* jc/em-dash-in-doc:
Documentation: AsciiDoc spells em-dash as double-dashes, not triple

Merge branch 'jc/everyday-markup'Junio C Hamano Thu, 29 Oct 2015 20:59:15 +0000 (13:59 -0700)

Merge branch 'jc/everyday-markup'

AsciiDoc markup fixes.

* jc/everyday-markup:
Documentation/everyday: match undefline with the text

Merge branch 'xf/user-manual-markup'Junio C Hamano Thu, 29 Oct 2015 20:59:14 +0000 (13:59 -0700)

Merge branch 'xf/user-manual-markup'

AsciiDoc markup fixes.

* xf/user-manual-markup:
Documentation: match undefline with the text in old release notes
Documentation: match underline with the text
Documentation: fix header markup

Seventh batch for 2.7Junio C Hamano Mon, 26 Oct 2015 23:02:08 +0000 (16:02 -0700)

Seventh batch for 2.7

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

Merge branch 'dk/p4-import-ctypes'Junio C Hamano Mon, 26 Oct 2015 22:55:26 +0000 (15:55 -0700)

Merge branch 'dk/p4-import-ctypes'

"git-p4" tried to use from ctypes module without first importing
it.

* dk/p4-import-ctypes:
git-p4: import the ctypes module

Merge branch 'jk/repository-extension'Junio C Hamano Mon, 26 Oct 2015 22:55:24 +0000 (15:55 -0700)

Merge branch 'jk/repository-extension'

Prepare for Git on-disk repository representation to undergo
backward incompatible changes by introducing a new repository
format version "1", with an extension mechanism.

* jk/repository-extension:
introduce "preciousObjects" repository extension
introduce "extensions" form of core.repositoryformatversion

Merge branch 'dt/t7063-fix-flaky-test'Junio C Hamano Mon, 26 Oct 2015 22:55:23 +0000 (15:55 -0700)

Merge branch 'dt/t7063-fix-flaky-test'

* dt/t7063-fix-flaky-test:
t7063: fix flaky untracked-cache test

Merge branch 'kn/for-each-tag'Junio C Hamano Mon, 26 Oct 2015 22:55:22 +0000 (15:55 -0700)

Merge branch 'kn/for-each-tag'

Recent update to "git tag --contains" caused a performance
regression.

* kn/for-each-tag:
tag.c: use the correct algorithm for the '--contains' option

Merge branch 'es/worktree-add'Junio C Hamano Mon, 26 Oct 2015 22:55:21 +0000 (15:55 -0700)

Merge branch 'es/worktree-add'

* es/worktree-add:
worktree: usage: denote <branch> as optional with 'add'

Merge branch 'tk/stripspace'Junio C Hamano Mon, 26 Oct 2015 22:55:20 +0000 (15:55 -0700)

Merge branch 'tk/stripspace'

The internal stripspace() function has been moved to where it
logically belongs to, i.e. strbuf API, and the command line parser
of "git stripspace" has been updated to use the parse_options API.

* tk/stripspace:
stripspace: use parse-options for command-line parsing
strbuf: make stripspace() part of strbuf

Merge branch 'rt/placeholder-in-usage'Junio C Hamano Mon, 26 Oct 2015 22:55:18 +0000 (15:55 -0700)

Merge branch 'rt/placeholder-in-usage'

A couple of commands still showed "[options]" in their usage string
to note where options should come on their command line, but we
spell that "[<options>]" in most places these days.

* rt/placeholder-in-usage:
am, credential-cache: add angle brackets to usage string

Merge branch 'jc/usage-stdin'Junio C Hamano Mon, 26 Oct 2015 22:55:17 +0000 (15:55 -0700)

Merge branch 'jc/usage-stdin'

The synopsis text and the usage string of subcommands that read
list of things from the standard input are often shown as if they
only take input from a file on a filesystem, which was misleading.

* jc/usage-stdin:
usage: do not insist that standard input must come from a file

Merge branch 'mr/worktree-list'Junio C Hamano Mon, 26 Oct 2015 22:55:16 +0000 (15:55 -0700)

Merge branch 'mr/worktree-list'

Add the "list" subcommand to "git worktree".

* mr/worktree-list:
worktree: add 'list' command
worktree: add details to the worktree struct
worktree: add a function to get worktree details
worktree: refactor find_linked_symref function
worktree: add top-level worktree.c

Merge branch 'jc/am-3-fallback-regression-fix'Junio C Hamano Mon, 26 Oct 2015 22:55:15 +0000 (15:55 -0700)

Merge branch 'jc/am-3-fallback-regression-fix'

"git am -3" had a small regression where it is aborted in its error
handling codepath when underlying merge-recursive failed in certain
ways, as it assumed that the internal call to merge-recursive will
never die, which is not the case (yet).

* jc/am-3-fallback-regression-fix:
am -3: do not let failed merge from completing the error codepath

compat/mingw.c: remove printf format warningJohannes Sixt Fri, 23 Oct 2015 06:02:52 +0000 (08:02 +0200)

compat/mingw.c: remove printf format warning

5096d490 (convert trivial sprintf / strcpy calls to xsnprintf) converted
two sprintf calls. Now GCC warns that "format '%u' expects argument of
type 'unsigned int', but argument 4 has type 'long unsigned int'".
Instead of changing the format string, use a variable of type unsigned
in place of the typedef-ed type DWORD, which hides that it is actually an
unsigned long.

There is no correctness issue with the old code because unsigned long and
unsigned are always of the same size on Windows, even in 64-bit builds.

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

read_branches_file: plug a FILE* leakJohannes Sixt Fri, 23 Oct 2015 06:02:51 +0000 (08:02 +0200)

read_branches_file: plug a FILE* leak

The earlier rewrite f28e3ab2 (read_branches_file: simplify string handling)
of read_branches_file() lost an fclose() call. Put it back.

As on Windows files that are open cannot be removed, the leak manifests in
a failure of 'git remote rename origin origin' when the remote's URL is
specified in .git/branches/origin, because by the time that the command
attempts to remove this file, it is still open.

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

Documentation: AsciiDoc spells em-dash as double-dashes... Junio C Hamano Thu, 22 Oct 2015 20:02:33 +0000 (13:02 -0700)

Documentation: AsciiDoc spells em-dash as double-dashes, not triple

Again, we do not usually process release notes with AsciiDoc, but it
is better to be consistent.

This incidentally reveals breakages left by an ancient 5e00439f
(Documentation: build html for all files in technical and howto,
2012-10-23). The index-format documentation was originally written
to be read as straight text without formatting and when the commit
forced everything in Documentation/ to go through AsciiDoc, it did
not do any adjustment--hence the double-dashes will be seen in the
resulting text that is rendered as preformatted fixed-width without
converted into em-dashes.

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

shallow: remove unused #include "sigchain.h"Tobias Klauser Thu, 22 Oct 2015 12:43:30 +0000 (14:43 +0200)

shallow: remove unused #include "sigchain.h"

After switching to use the tempfile module in commit 6e122b44
(setup_temporary_shallow(): use tempfile module), no declarations from
sigchain.h are used in read-cache.c anymore. Thus, remove the #include.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read-cache: remove unused #include "sigchain.h"Tobias Klauser Thu, 22 Oct 2015 12:43:29 +0000 (14:43 +0200)

read-cache: remove unused #include "sigchain.h"

After switching to use the tempfile module in commit f6ecc62d
(write_shared_index(): use tempfile module), no declarations from
sigchain.h are used in read-cache.c anymore. Thus, remove the #include.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: remove unused #include "sigchain.h"Tobias Klauser Thu, 22 Oct 2015 12:43:28 +0000 (14:43 +0200)

diff: remove unused #include "sigchain.h"

After switching to use the tempfile module in commit 284098f1
(diff: use tempfile module), no declarations from sigchain.h are used in
diff.c anymore. Thus, remove the #include.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

credential-cache--daemon: remove unused #include "sigch... Tobias Klauser Thu, 22 Oct 2015 12:43:27 +0000 (14:43 +0200)

credential-cache--daemon: remove unused #include "sigchain.h"

After switching to use the tempfile module in commit 9e903316
(credential-cache--daemon: use tempfile module), no declarations from
sigchain.h are used in credential-cache--daemon.c anymore. Thus, remove
the #include.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: match undefline with the text in old... Junio C Hamano Thu, 22 Oct 2015 17:11:41 +0000 (10:11 -0700)

Documentation: match undefline with the text in old release notes

These are not processed with AsciiDoc, but it is better to be
consistent.

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

Documentation: match underline with the textJunio C Hamano Thu, 22 Oct 2015 17:09:07 +0000 (10:09 -0700)

Documentation: match underline with the text

Even though AsciiDoc is more lenient when deciding if an underline
is for the contents on the previous line to find section headers, we
should match the length of them for other formatters to help them.

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

Documentation/everyday: match undefline with the textJunio C Hamano Thu, 22 Oct 2015 17:14:44 +0000 (10:14 -0700)

Documentation/everyday: match undefline with the text

Even though AsciiDoc is more lenient when deciding if an underline
is for the contents on the previous line to find section headers, we
should match the length of them for other formatters to help them.

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

Documentation: fix header markupXue Fuqiao Thu, 22 Oct 2015 12:59:00 +0000 (20:59 +0800)

Documentation: fix header markup

Asciidoctor is stricter than AsciiDoc when deciding if underlining
is a section title or the start of preformatted text. Make the
length of the underlining match the text to ensure that it renders
correctly in all implementations.

Signed-off-by: Xue Fuqiao <xfq.free@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailinfo: remove calls to exit() and die() deep in... Junio C Hamano Thu, 15 Oct 2015 00:45:29 +0000 (17:45 -0700)

mailinfo: remove calls to exit() and die() deep in the callchain

The top-level mailinfo() would instead punt when the code in the
deeper part of the callchain detects an unrecoverable error in the
input.

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

mailinfo: handle charset conversion errors in the callerJunio C Hamano Thu, 15 Oct 2015 00:45:16 +0000 (17:45 -0700)

mailinfo: handle charset conversion errors in the caller

Instead of dying in convert_to_utf8(), just report an error and let
the callers handle it. Between the two callers:

- decode_header() silently punts when it cannot parse a broken
RFC2047 encoded text (e.g. when it sees anything other than B or
Q after it sees "=?<charset>") by jumping to release_return,
returning the string it successfully parsed out so far, to the
caller. A piece of string that convert_to_utf8() cannot handle
can be treated the same way.

- handle_commit_msg() doesn't cope with a malformed line well, so
die there for now. We'll lift this even higher in later changes
in this series.

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

mailinfo: libifyJunio C Hamano Thu, 15 Oct 2015 00:44:55 +0000 (17:44 -0700)

mailinfo: libify

Move the bulk of the code from builtin/mailinfo.c to mailinfo.c
so that new callers can start calling mailinfo() directly.

Note that a few calls to exit() and die() need to be cleaned up
for the API to be truly useful, which will come in later steps.

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

mailinfo: keep the parsed log message in a strbufJunio C Hamano Thu, 15 Oct 2015 00:43:27 +0000 (17:43 -0700)

mailinfo: keep the parsed log message in a strbuf

When mailinfo() is eventually libified, the calling "git am" still
will have to write out the log message in the "msg" file for hooks
and other users of the information, but it does not have to reopen
and reread what it wrote earlier if the function kept it in a strbuf.

This also removes the need for seeking and truncating the output
file when we see a scissors mark in the input, which in turn allows
us to lose two callsites of die_errno().

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

mailinfo: handle_commit_msg() shouldn't be called after... Junio C Hamano Wed, 14 Oct 2015 23:16:33 +0000 (16:16 -0700)

mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak

There is a strange "if (!mi->cmitmsg) return 0" at the very beginning
of handle_commit_msg(), but the condition should never trigger, because:

* The only place cmitmsg is set to NULL is after this function sees
a patch break, closes the FILE * to write the commit log message
and returns 1. This function returns non-zero only from that
codepath.

* The caller of this function, upon seeing a non-zero return,
increments filter_stage, starts treating the input as patch text
and will never call handle_commit_msg() again.

Replace it with an assert(!mi->filter_stage) to ensure the above
observation will stay to be true.

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

mailinfo: move content/content_top to struct mailinfoJunio C Hamano Thu, 15 Oct 2015 00:43:54 +0000 (17:43 -0700)

mailinfo: move content/content_top to struct mailinfo

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

mailinfo: move [ps]_hdr_data to struct mailinfoJunio C Hamano Thu, 15 Oct 2015 00:43:24 +0000 (17:43 -0700)

mailinfo: move [ps]_hdr_data to struct mailinfo

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

mailinfo: move cmitmsg and patchfile to struct mailinfoJunio C Hamano Wed, 14 Oct 2015 23:16:47 +0000 (16:16 -0700)

mailinfo: move cmitmsg and patchfile to struct mailinfo

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

mailinfo: move charset to struct mailinfoJunio C Hamano Mon, 19 Oct 2015 05:30:08 +0000 (22:30 -0700)

mailinfo: move charset to struct mailinfo

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

mailinfo: move transfer_encoding to struct mailinfoJunio C Hamano Wed, 14 Oct 2015 23:16:05 +0000 (16:16 -0700)

mailinfo: move transfer_encoding to struct mailinfo

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

mailinfo: move check for metainfo_charset to convert_to... Junio C Hamano Sun, 18 Oct 2015 22:58:35 +0000 (15:58 -0700)

mailinfo: move check for metainfo_charset to convert_to_utf8()

All callers of this function refrain from calling it when
mi->metainfo_charset is NULL; move the check to the callee,
as it already has a few conditions at its beginning to turn
it into a no-op.

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

mailinfo: move metainfo_charset to struct mailinfoJunio C Hamano Wed, 14 Oct 2015 23:15:40 +0000 (16:15 -0700)

mailinfo: move metainfo_charset to struct mailinfo

This requires us to pass the struct down to decode_header() and
convert_to_utf8() callchain.

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

mailinfo: move use_scissors and use_inbody_headers... Junio C Hamano Wed, 14 Oct 2015 23:14:57 +0000 (16:14 -0700)

mailinfo: move use_scissors and use_inbody_headers to struct mailinfo

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

mailinfo: move add_message_id and message_id to struct... Junio C Hamano Mon, 19 Oct 2015 05:27:56 +0000 (22:27 -0700)

mailinfo: move add_message_id and message_id to struct mailinfo

This requires us to pass the structure into check_header() codepath.

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

mailinfo: move patch_lines to struct mailinfoJunio C Hamano Wed, 14 Oct 2015 23:13:51 +0000 (16:13 -0700)

mailinfo: move patch_lines to struct mailinfo

This one is trivial thanks to previous steps that started passing
the structure throughout the input codepaths.

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

mailinfo: move filter/header stage to struct mailinfoJunio C Hamano Wed, 14 Oct 2015 23:13:34 +0000 (16:13 -0700)

mailinfo: move filter/header stage to struct mailinfo

Earlier we got rid of two function-scope static variables that kept
track of the states of helper functions by making them extra arguments
that are passed throughout the callchain. Now we have a convenient
place to store and pass them around in the form of "struct mailinfo",
change them into two fields in the struct.

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

mailinfo: move global "FILE *fin, *fout" to struct... Junio C Hamano Wed, 14 Oct 2015 22:40:04 +0000 (15:40 -0700)

mailinfo: move global "FILE *fin, *fout" to struct mailinfo

This requires us to pass "struct mailinfo" to more functions
throughout the codepath that read input lines. Incidentally,
later steps are helped by this patch passing the struct to
more callchains.

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

mailinfo: move keep_subject & keep_non_patch_bracket... Junio C Hamano Wed, 14 Oct 2015 22:39:37 +0000 (15:39 -0700)

mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo

These two are the only easy ones that do not require passing the
structure around to deep corners of the callchain.

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

mailinfo: introduce "struct mailinfo" to hold globalsJunio C Hamano Mon, 19 Oct 2015 05:22:10 +0000 (22:22 -0700)

mailinfo: introduce "struct mailinfo" to hold globals

In this first step, move only 'email' and 'name' fields in there and
remove the corresponding globals. In subsequent patches, more
globals will be moved to this and the structure will be passed
around as a new parameter to more functions.

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

mailinfo: move global "line" into mailinfo() functionJunio C Hamano Sun, 18 Oct 2015 22:47:02 +0000 (15:47 -0700)

mailinfo: move global "line" into mailinfo() function

With the previous steps, it becomes clear that the mailinfo()
function is the only one that wants the "line" to be directly
touchable. Move it to the function scope of this function.

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

mailinfo: do not let find_boundary() touch global ... Junio C Hamano Sun, 18 Oct 2015 22:40:06 +0000 (15:40 -0700)

mailinfo: do not let find_boundary() touch global "line" directly

With the previous two commits, we established that the local
variable "line" in handle_body() and handle_boundary() functions
always refer to the global "line" that is used as the common and
shared "current line from the input". They are the only callers of
the last function that refers to the global line directly, i.e.
find_boundary(). Pass "line" as a parameter to this leaf function
to complete the clean-up. Now the only function that directly refers
to the global "line" is the caller of handle_body() at the very
beginning of this whole callchain.

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

mailinfo: do not let handle_boundary() touch global... Junio C Hamano Sun, 18 Oct 2015 22:40:06 +0000 (15:40 -0700)

mailinfo: do not let handle_boundary() touch global "line" directly

This function has a single caller, and called with the global "line"
holding the multi-part boundary line the caller saw while processing
the e-mail body. The function then goes into a loop to process each
line of the input, and fills the same global "line" variable from
the input as it needs to read more lines to process the multi-part
headers.

Let the caller explicitly pass a pointer to this global "line"
variable as an argument, and have the function itself use that
strbuf throughout, instead of referring to the global "line" itself.

There still is a helper function that this function calls that still
touches the global directly; it will be updated as the series progresses.

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

mailinfo: do not let handle_body() touch global "line... Junio C Hamano Sun, 18 Oct 2015 22:36:16 +0000 (15:36 -0700)

mailinfo: do not let handle_body() touch global "line" directly

This function has a single caller, and called with the global "line"
holding the first line of the e-mail body after the caller finished
processing the e-mail headers. The function then goes into a loop
to process each line of the input, starting from what was given by
its caller, and fills the same global "line" variable from the input
as it needs to process more lines.

Let the caller explicitly pass a pointer to this global "line"
variable as an argument, and have the function itself use that
strbuf throughout, instead of referring to the global "line" itself.

There are helper functions that this function calls that still touch
the global directly; they will be updated as the series progresses.

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

mailinfo: get rid of function-local static statesJunio C Hamano Tue, 13 Oct 2015 18:13:32 +0000 (11:13 -0700)

mailinfo: get rid of function-local static states

Two helper functions use "static int" in their scope to keep track
of the state while repeatedly getting called once for each input
line. Move these state variables to their ultimate caller and pass
down pointers to them along the callchain, as a small step in
preparation for making this entire callchain more reentrant.

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

mailinfo: move definition of MAX_HDR_PARSED closer... Junio C Hamano Thu, 15 Oct 2015 00:44:46 +0000 (17:44 -0700)

mailinfo: move definition of MAX_HDR_PARSED closer to its use

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

mailinfo: move cleanup_space() before its usersJunio C Hamano Thu, 15 Oct 2015 00:44:26 +0000 (17:44 -0700)

mailinfo: move cleanup_space() before its users

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

mailinfo: move check_header() after the helpers it... Junio C Hamano Thu, 15 Oct 2015 00:44:21 +0000 (17:44 -0700)

mailinfo: move check_header() after the helpers it uses

This way, we can lose a forward decl for decode_header().

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

mailinfo: move read_one_header_line() closer to its... Junio C Hamano Thu, 15 Oct 2015 00:44:07 +0000 (17:44 -0700)

mailinfo: move read_one_header_line() closer to its callers

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

mailinfo: move handle_boundary() lowerJunio C Hamano Tue, 13 Oct 2015 18:03:20 +0000 (11:03 -0700)

mailinfo: move handle_boundary() lower

This function wants to call find_boundary() and is called only from
one place without any recursing, so it becomes easier to read if it
appears after the called function.

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

mailinfo: plug strbuf leak during continuation line... Junio C Hamano Tue, 20 Oct 2015 21:32:32 +0000 (14:32 -0700)

mailinfo: plug strbuf leak during continuation line handling

Whether this loop is left via EOF/break or upon finding a
non-continuation line, the storage used for the contination line
handling is left behind.

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

name-hash: don't reuse cache_entry in dir_entryDavid Turner Wed, 21 Oct 2015 17:54:11 +0000 (13:54 -0400)

name-hash: don't reuse cache_entry in dir_entry

Stop reusing cache_entry in dir_entry; doing so causes a
use-after-free bug.

During merges, we free entries that we no longer need in the
destination index. But those entries might have also been stored in
the dir_entry cache, and when a later call to add_to_index found them,
they would be used after being freed.

To prevent this, change dir_entry to store a copy of the name instead
of a pointer to a cache_entry. This entails some refactoring of code
that expects the cache_entry.

Keith McGuigan <kmcguigan@twitter.com> diagnosed this bug and wrote
the initial patch, but this version does not use any of Keith's code.

Helped-by: Keith McGuigan <kmcguigan@twitter.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

configure.ac: detect ssl need with libcurlRemi Pommarel Thu, 24 Sep 2015 19:14:00 +0000 (21:14 +0200)

configure.ac: detect ssl need with libcurl

When libcurl has been statically compiled with openssl support they both
need to be linked in everytime libcurl is used.

During configuration this can be detected by looking for Curl_ssl_init
function symbol in libcurl, which will only be present if libcurl has been
compiled statically built with openssl.

configure.ac checks for Curl_ssl_init function in libcurl and if such function
exists; it sets NEEDS_SSL_WITH_CURL that is used by the Makefile to include
-lssl alongside with -lcurl.

Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: make curl-config path configurableRemi Pommarel Wed, 21 Oct 2015 17:10:46 +0000 (19:10 +0200)

Makefile: make curl-config path configurable

There are situations, e.g. during cross compilation, where curl-config
program is not present in the PATH.

Make the makefile use a configurable curl-config program passed through
CURL_CONFIG variable which can be set through config.mak.

Also make this variable tunable through use of autoconf/configure. Configure
will set CURL_CONFIG variable in config.mak.autogen to whatever value has been
passed to ac_cv_prog_CURL_CONFIG.

Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: link libcurl before zlibRemi Pommarel Wed, 21 Oct 2015 17:01:13 +0000 (19:01 +0200)

Makefile: link libcurl before zlib

For static linking especially library order while linking is important. For
example, libcurl wants symbols from zlib when building http-push, http-fetch
and remote-curl. So for these programs libcurl has to be linked before zlib.

Signed-off-by: Remi Pommarel <repk@triplefau.lt>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Tue, 20 Oct 2015 22:29:57 +0000 (15:29 -0700)

Sync with maint

* maint:

Sixth batch for 2.7Junio C Hamano Tue, 20 Oct 2015 22:29:50 +0000 (15:29 -0700)

Sixth batch for 2.7

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

Merge branch 'tb/t0027-crlf'Junio C Hamano Tue, 20 Oct 2015 22:26:18 +0000 (15:26 -0700)

Merge branch 'tb/t0027-crlf'

The test for various line-ending conversions has been enhanced.

* tb/t0027-crlf:
t0027: improve test for not-normalized files

Merge branch 'ls/p4-test-updates'Junio C Hamano Tue, 20 Oct 2015 22:26:09 +0000 (15:26 -0700)

Merge branch 'ls/p4-test-updates'

A few test scripts around "git p4" have been improved for
portability.

* ls/p4-test-updates:
git-p4: skip t9819 test case on case insensitive file systems
git-p4: avoid "stat" command in t9815 git-p4-submit-fail

Merge branch 'jk/war-on-sprintf'Junio C Hamano Tue, 20 Oct 2015 22:24:00 +0000 (15:24 -0700)

Merge branch 'jk/war-on-sprintf'

Many allocations that is manually counted (correctly) that are
followed by strcpy/sprintf have been replaced with a less error
prone constructs such as xstrfmt.

Macintosh-specific breakage was noticed and corrected in this
reroll.

* jk/war-on-sprintf: (70 commits)
name-rev: use strip_suffix to avoid magic numbers
use strbuf_complete to conditionally append slash
fsck: use for_each_loose_file_in_objdir
Makefile: drop D_INO_IN_DIRENT build knob
fsck: drop inode-sorting code
convert strncpy to memcpy
notes: document length of fanout path with a constant
color: add color_set helper for copying raw colors
prefer memcpy to strcpy
help: clean up kfmclient munging
receive-pack: simplify keep_arg computation
avoid sprintf and strcpy with flex arrays
use alloc_ref rather than hand-allocating "struct ref"
color: add overflow checks for parsing colors
drop strcpy in favor of raw sha1_to_hex
use sha1_to_hex_r() instead of strcpy
daemon: use cld->env_array when re-spawning
stat_tracking_info: convert to argv_array
http-push: use an argv_array for setup_revisions
fetch-pack: use argv_array for index-pack / unpack-objects
...

Merge branch 'js/gc-with-stale-symref' into maintJunio C Hamano Tue, 20 Oct 2015 22:22:41 +0000 (15:22 -0700)

Merge branch 'js/gc-with-stale-symref' into maint

"git gc" used to barf when a symbolic ref has gone dangling
(e.g. the branch that used to be your upstream's default when you
cloned from it is now gone, and you did "fetch --prune").

* js/gc-with-stale-symref:
pack-objects: do not get distracted by broken symrefs
gc: demonstrate failure with stale remote HEAD

Merge branch 'rd/test-path-utils' into maintJunio C Hamano Tue, 20 Oct 2015 22:22:40 +0000 (15:22 -0700)

Merge branch 'rd/test-path-utils' into maint

The normalize_ceiling_entry() function does not muck with the end
of the path it accepts, and the real world callers do rely on that,
but a test insisted that the function drops a trailing slash.

* rd/test-path-utils:
test-path-utils.c: remove incorrect assumption

Merge branch 'jc/doc-gc-prune-now' into maintJunio C Hamano Tue, 20 Oct 2015 22:22:40 +0000 (15:22 -0700)

Merge branch 'jc/doc-gc-prune-now' into maint

"git gc" is safe to run anytime only because it has the built-in
grace period to protect young objects. In order to run with no
grace period, the user must make sure that the repository is
quiescent.

* jc/doc-gc-prune-now:
Documentation/gc: warn against --prune=<now>

Merge branch 'jk/filter-branch-use-of-sed-on-incomplete... Junio C Hamano Tue, 20 Oct 2015 22:22:39 +0000 (15:22 -0700)

Merge branch 'jk/filter-branch-use-of-sed-on-incomplete-line' into maint

A recent "filter-branch --msg-filter" broke skipping of the commit
object header, which is fixed.

* jk/filter-branch-use-of-sed-on-incomplete-line:
filter-branch: remove multi-line headers in msg filter

git-p4: import the ctypes moduleDennis Kaarsemaker Tue, 20 Oct 2015 19:31:46 +0000 (21:31 +0200)

git-p4: import the ctypes module

The ctypes module is used on windows to calculate free disk space,
so it must be imported. We won't need it on other platforms, but
the module is available in Python 2.5 and newer, so importing it
unconditionally is harmless.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7063: fix flaky untracked-cache testDavid Turner Mon, 19 Oct 2015 19:48:15 +0000 (15:48 -0400)

t7063: fix flaky untracked-cache test

Dirty the test worktree's root directory, as the test expects.

When testing the untracked-cache, we previously assumed that checking
out master would be sufficient to mark the mtime of the worktree's
root directory as racily-dirty. But sometimes, the checkout would
happen at 12345.999 seconds and the status at 12346.001 seconds,
meaning that the worktree's root directory would not be racily-dirty.
And since it was not truly dirty, occasionally the test would fail.
By making the root truly dirty, the test will always succeed.

Tested by running a few hundred times.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maint for Russian translationJunio C Hamano Mon, 19 Oct 2015 06:39:20 +0000 (23:39 -0700)

Sync with maint for Russian translation

* maint:
l10n: ru.po: update Russian translation

Merge branch 'maint' of git://github.com/git-l10n/git... Junio C Hamano Mon, 19 Oct 2015 06:37:35 +0000 (23:37 -0700)

Merge branch 'maint' of git://github.com/git-l10n/git-po into maint

* 'maint' of git://github.com/git-l10n/git-po:
l10n: ru.po: update Russian translation

worktree: usage: denote <branch> as optional with ... Sidhant Sharma Mon, 19 Oct 2015 04:44:53 +0000 (10:14 +0530)

worktree: usage: denote <branch> as optional with 'add'

Although 1eb07d8 (worktree: add: auto-vivify new branch when
<branch> is omitted, 2015-07-06) updated the documentation when
<branch> became optional, it neglected to update the in-code
usage message. Fix this oversight.

Reported-by: ch3cooli@gmail.com
Signed-off-by: Sidhant Sharma <tigerkid001@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailinfo: explicitly close file handle to the patch... Junio C Hamano Wed, 14 Oct 2015 22:35:10 +0000 (15:35 -0700)

mailinfo: explicitly close file handle to the patch output

This does not make a difference within the context of "git mailinfo"
that runs once and exits, as flushing and closing would happen upon
process termination. It however will matter when we eventually make
it callable as an API function.

Besides, cleaning after yourself once you are done is a good hygiene.

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

mailinfo: fix an off-by-one error in the boundary stackJunio C Hamano Wed, 14 Oct 2015 22:34:19 +0000 (15:34 -0700)

mailinfo: fix an off-by-one error in the boundary stack

We pre-increment the pointer that we will use to store something at,
so the pointer is already beyond the end of the array if it points
at content[MAX_BOUNDARIES].

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

mailinfo: fold decode_header_bq() into decode_header()Junio C Hamano Wed, 14 Oct 2015 22:33:44 +0000 (15:33 -0700)

mailinfo: fold decode_header_bq() into decode_header()

In olden days we might have wanted to behave differently in
decode_header() if the header line was encoded with RFC2047, but we
apparently do not do so, hence this helper function can go, together
with its return value.

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

mailinfo: remove a no-op call convert_to_utf8(it, "")Junio C Hamano Wed, 14 Oct 2015 22:33:07 +0000 (15:33 -0700)

mailinfo: remove a no-op call convert_to_utf8(it, "")

The called function checks if the second parameter is either a NULL
or an empty string at the very beginning and returns without doing
anything. Remove the useless call.

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

tag.c: use the correct algorithm for the '--contains... Karthik Nayak Sun, 18 Oct 2015 10:25:04 +0000 (15:55 +0530)

tag.c: use the correct algorithm for the '--contains' option

In b7cc53e9 (tag.c: use 'ref-filter' APIs, 2015-09-11) we port tag.c
to use the ref-filter APIs for filtering and printing refs. In
ref-filter we have two implementations for filtering refs when the
'--contains' option is used.

Although they do the same thing, one is optimized for filtering
branches and the other for tags (borrowed from branch.c and tag.c
respectively) and the 'filter->with_commit_tag_algo' bit decides
which algorithm must be used. We should unify these.

When we ported tag.c to use ref-filter APIs we missed out on setting
the 'filter->with_commit_tag_algo' bit. As reported by Jerry
Snitselaar, this causes "git tag --contains" to work way slower than
expected, fix this by setting 'filter->with_commit_tag_algo' in
tag.c before calling 'filter_refs()'.

Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Tested-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

usage: do not insist that standard input must come... Junio C Hamano Fri, 16 Oct 2015 18:27:42 +0000 (11:27 -0700)

usage: do not insist that standard input must come from a file

The synopsys text and the usage string of subcommands that read list
of things from the standard input are often shown like this:

git gostak [--distim] < <list-of-doshes>

This is problematic in a number of ways:

* The way to use these commands is more often to feed them the
output from another command, not feed them from a file.

* Manual pages outside Git, commands that operate on the data read
from the standard input, e.g "sort", "grep", "sed", etc., are not
described with such a "< redirection-from-file" in their synopsys
text. Our doing so introduces inconsistency.

* We do not insist on where the output should go, by saying

git gostak [--distim] < <list-of-doshes> > <output>

* As it is our convention to enclose placeholders inside <braket>,
the redirection operator followed by a placeholder filename
becomes very hard to read, both in the documentation and in the
help text.

Let's clean them all up, after making sure that the documentation
clearly describes the modes that take information from the standard
input and what kind of things are expected on the input.

[jc: stole example for fmt-merge-msg from Jonathan]

Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with 2.6.2Junio C Hamano Fri, 16 Oct 2015 21:45:46 +0000 (14:45 -0700)

Sync with 2.6.2

Fifth batch for 2.7Junio C Hamano Fri, 16 Oct 2015 21:43:59 +0000 (14:43 -0700)

Fifth batch for 2.7

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

Merge branch 'jc/doc-gc-prune-now'Junio C Hamano Fri, 16 Oct 2015 21:42:50 +0000 (14:42 -0700)

Merge branch 'jc/doc-gc-prune-now'

"git gc" is safe to run anytime only because it has the built-in
grace period to protect young objects. In order to run with no
grace period, the user must make sure that the repository is
quiescent.

* jc/doc-gc-prune-now:
Documentation/gc: warn against --prune=<now>

Merge branch 'sb/submodule-config-parse'Junio C Hamano Fri, 16 Oct 2015 21:42:49 +0000 (14:42 -0700)

Merge branch 'sb/submodule-config-parse'

Code simplification.

* sb/submodule-config-parse:
submodule-config: "goto" removal in parse_config()

Merge branch 'jk/filter-branch-use-of-sed-on-incomplete... Junio C Hamano Fri, 16 Oct 2015 21:42:47 +0000 (14:42 -0700)

Merge branch 'jk/filter-branch-use-of-sed-on-incomplete-line'

A recent "filter-branch --msg-filter" broke skipping of the commit
object header, which is fixed.

* jk/filter-branch-use-of-sed-on-incomplete-line:
filter-branch: remove multi-line headers in msg filter

Merge branch 'rd/test-path-utils'Junio C Hamano Fri, 16 Oct 2015 21:42:44 +0000 (14:42 -0700)

Merge branch 'rd/test-path-utils'

The normalize_ceiling_entry() function does not muck with the end
of the path it accepts, and the real world callers do rely on that,
but a test insisted that the function drops a trailing slash.

* rd/test-path-utils:
test-path-utils.c: remove incorrect assumption

Git 2.6.2 v2.6.2Junio C Hamano Fri, 16 Oct 2015 21:40:04 +0000 (14:40 -0700)

Git 2.6.2

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

Merge branch 'cc/quote-comments' into maintJunio C Hamano Fri, 16 Oct 2015 21:32:58 +0000 (14:32 -0700)

Merge branch 'cc/quote-comments' into maint

A no-op code-health maintenance.

* cc/quote-comments:
quote: move comment before sq_quote_buf()
quote: fix broken sq_quote_buf() related comment

Merge branch 'es/worktree-add-cleanup' into maintJunio C Hamano Fri, 16 Oct 2015 21:32:57 +0000 (14:32 -0700)

Merge branch 'es/worktree-add-cleanup' into maint

A no-op code-health maintenance.

* es/worktree-add-cleanup:
t2026: rename worktree prune test

Merge branch 'tk/doc-interpret-trailers-grammo' into... Junio C Hamano Fri, 16 Oct 2015 21:32:56 +0000 (14:32 -0700)

Merge branch 'tk/doc-interpret-trailers-grammo' into maint

* tk/doc-interpret-trailers-grammo:
Documentation/interpret-trailers: Grammar fix

Merge branch 'tk/typofix-connect-unknown-proto-error... Junio C Hamano Fri, 16 Oct 2015 21:32:55 +0000 (14:32 -0700)

Merge branch 'tk/typofix-connect-unknown-proto-error' into maint

* tk/typofix-connect-unknown-proto-error:
connect: fix typo in result string of prot_name()

Merge branch 'jk/asciidoctor-section-heading-markup... Junio C Hamano Fri, 16 Oct 2015 21:32:53 +0000 (14:32 -0700)

Merge branch 'jk/asciidoctor-section-heading-markup-fix' into maint

* jk/asciidoctor-section-heading-markup-fix:
Documentation: fix section header mark-up

Merge branch 'nd/ls-remote-does-not-have-u-option'... Junio C Hamano Fri, 16 Oct 2015 21:32:52 +0000 (14:32 -0700)

Merge branch 'nd/ls-remote-does-not-have-u-option' into maint

* nd/ls-remote-does-not-have-u-option:
ls-remote.txt: delete unsupported option

Merge branch 'jc/fsck-dropped-errors' into maintJunio C Hamano Fri, 16 Oct 2015 21:32:50 +0000 (14:32 -0700)

Merge branch 'jc/fsck-dropped-errors' into maint

There were some classes of errors that "git fsck" diagnosed to its
standard error that did not cause it to exit with non-zero status.

* jc/fsck-dropped-errors:
fsck: exit with non-zero when problems are found

Merge branch 'sb/http-flaky-test-fix' into maintJunio C Hamano Fri, 16 Oct 2015 21:32:49 +0000 (14:32 -0700)

Merge branch 'sb/http-flaky-test-fix' into maint

A test script for the HTTP service had a timing dependent bug,
which was fixed.

* sb/http-flaky-test-fix:
t5561: get rid of racy appending to logfile

Merge branch 'sb/perf-without-installed-git' into maintJunio C Hamano Fri, 16 Oct 2015 21:32:47 +0000 (14:32 -0700)

Merge branch 'sb/perf-without-installed-git' into maint

Performance-measurement tests did not work without an installed Git.

* sb/perf-without-installed-git:
t/perf: make runner work even if Git is not installed