gitweb.git
Merge branch 'kb/msys2-tty' into maintJunio C Hamano Mon, 6 Jun 2016 21:27:38 +0000 (14:27 -0700)

Merge branch 'kb/msys2-tty' into maint

The "are we talking with TTY, doing an interactive session?"
detection has been updated to work better for "Git for Windows".

* kb/msys2-tty:
mingw: make isatty() recognize MSYS2's pseudo terminals (/dev/pty*)

Merge branch 'da/difftool' into maintJunio C Hamano Mon, 6 Jun 2016 21:27:37 +0000 (14:27 -0700)

Merge branch 'da/difftool' into maint

"git difftool" learned to handle unmerged paths correctly in
dir-diff mode.

* da/difftool:
difftool: handle unmerged files in dir-diff mode
difftool: initialize variables for readability

Merge branch 'tb/core-eol-fix' into maintJunio C Hamano Mon, 6 Jun 2016 21:27:36 +0000 (14:27 -0700)

Merge branch 'tb/core-eol-fix' into maint

A couple of bugs around core.autocrlf have been fixed.

* tb/core-eol-fix:
convert.c: ident + core.autocrlf didn't work
t0027: test cases for combined attributes
convert: allow core.autocrlf=input and core.eol=crlf
t0027: make commit_chk_wrnNNO() reliable

Merge branch 'ar/diff-args-osx-precompose' into maintJunio C Hamano Mon, 6 Jun 2016 21:27:35 +0000 (14:27 -0700)

Merge branch 'ar/diff-args-osx-precompose' into maint

Many commands normalize command line arguments from NFD to NFC
variant of UTF-8 on OSX, but commands in the "diff" family did
not, causing "git diff $path" to complain that no such path is
known to Git. They have been taught to do the normalization.

* ar/diff-args-osx-precompose:
diff: run arguments through precompose_argv

Merge branch 'sb/submodule-helper-relative-path'Junio C Hamano Mon, 6 Jun 2016 21:18:55 +0000 (14:18 -0700)

Merge branch 'sb/submodule-helper-relative-path'

A bash-ism "local" has been removed from "git submodule" scripted
Porcelain.

* sb/submodule-helper-relative-path:
submodule: remove bashism from shell script

Merge branch 'sb/submodule-helper-list-signal-unmatch... Junio C Hamano Mon, 6 Jun 2016 21:18:55 +0000 (14:18 -0700)

Merge branch 'sb/submodule-helper-list-signal-unmatch-via-exit-status'

The way how "submodule--helper list" signals unmatch error to its
callers has been updated.

* sb/submodule-helper-list-signal-unmatch-via-exit-status:
submodule--helper: offer a consistent API

builtin/apply: remove misleading comment on lock_file... Junio C Hamano Mon, 6 Jun 2016 20:11:02 +0000 (13:11 -0700)

builtin/apply: remove misleading comment on lock_file field

Just like pointer field like prefix, the piece of memory pointed at
by lock_file field is not owned by the apply_state structure. It is
true that the caller needs to be careful about the lifetime rule for
lockfile instances, but that is none of this API's business.

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

git-prompt.sh: Don't error on null ${ZSH,BASH}_VERSION... Ville Skyttä Mon, 6 Jun 2016 16:29:33 +0000 (19:29 +0300)

git-prompt.sh: Don't error on null ${ZSH,BASH}_VERSION, $short_sha

When the shell is in "nounset" or "set -u" mode, referencing unset or
null variables results in an error. Protect $ZSH_VERSION and
$BASH_VERSION against that, and initialize $short_sha before use.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cherry-pick: allow to pick to unborn branchesMichael J Gruber Mon, 6 Jun 2016 13:23:54 +0000 (15:23 +0200)

cherry-pick: allow to pick to unborn branches

cherry-pick allows to pick single commits to an empty HEAD, but not
multiple commits.

Allow the multiple commit case, too.

Reported-by: Fabrizio Cucci <fabrizio.cucci@gmail.com>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

receive-pack: send auto-gc output over sideband 2Lukas Fleischer Sun, 5 Jun 2016 09:36:38 +0000 (11:36 +0200)

receive-pack: send auto-gc output over sideband 2

Redirect auto-gc output to the sideband such that it is visible to all
clients. As a side effect, all auto-gc error messages are now prefixed
with "remote: " before being printed to stderr on the client-side which
makes it easier to understand that those error messages originate from
the server.

Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: zh_CN: for git v2.9.0 l10n round 1Jiang Xin Sun, 29 May 2016 12:40:35 +0000 (20:40 +0800)

l10n: zh_CN: for git v2.9.0 l10n round 1

Update 104 new translations (2596t1f0u) for git v2.9.0-rc0.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>

userdiff: add built-in pattern for CSSWilliam Duclot Fri, 3 Jun 2016 12:32:26 +0000 (14:32 +0200)

userdiff: add built-in pattern for CSS

CSS is widely used, motivating it being included as a built-in pattern.

It must be noted that the word_regex for CSS (i.e. the regex defining
what is a word in the language) does not consider '.' and '#' characters
(in CSS selectors) to be part of the word. This behavior is documented
by the test t/t4018/css-rule.
The logic behind this behavior is the following: identifiers in CSS
selectors are identifiers in a HTML/XML document. Therefore, the '.'/'#'
character are not part of the identifier, but an indicator of the nature
of the identifier in HTML/XML (class or id). Diffing ".class1" and
".class2" must show that the class name is changed, but we still are
selecting a class.

Logic behind the "pattern" regex is:
1. reject lines ending with a colon/semicolon (properties)
2. if a line begins with a name in column 1, pick the whole line

Credits to Johannes Sixt (j6t@kdbg.org) for the pattern regex and most
of the tests.

Signed-off-by: William Duclot <william.duclot@ensimag.grenoble-inp.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Almost ready for 2.9-rc2Junio C Hamano Fri, 3 Jun 2016 21:38:35 +0000 (14:38 -0700)

Almost ready for 2.9-rc2

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

Merge branch 'rs/apply-name-terminate'Junio C Hamano Fri, 3 Jun 2016 21:38:04 +0000 (14:38 -0700)

Merge branch 'rs/apply-name-terminate'

Code clean-up.

* rs/apply-name-terminate:
apply: remove unused parameters from name_terminate()

Merge branch 'rs/patch-id-use-skip-prefix'Junio C Hamano Fri, 3 Jun 2016 21:38:03 +0000 (14:38 -0700)

Merge branch 'rs/patch-id-use-skip-prefix'

Code clean-up.

* rs/patch-id-use-skip-prefix:
patch-id: use starts_with() and skip_prefix()

Merge branch 'bd/readme.markdown-more'Junio C Hamano Fri, 3 Jun 2016 21:38:02 +0000 (14:38 -0700)

Merge branch 'bd/readme.markdown-more'

The mark-up in the top-level README.md file has been updated to
typeset CLI command names differently from the body text.

* bd/readme.markdown-more:
README.md: format CLI commands with code syntax

Merge branch 'mm/makefile-developer-can-be-in-config... Junio C Hamano Fri, 3 Jun 2016 21:38:02 +0000 (14:38 -0700)

Merge branch 'mm/makefile-developer-can-be-in-config-mak'

"make DEVELOPER=1" worked as expected; setting DEVELOPER=1 in
config.mak didn't.

* mm/makefile-developer-can-be-in-config-mak:
Makefile: add $(DEVELOPER_CFLAGS) variable
Makefile: move 'ifdef DEVELOPER' after config.mak* inclusion

Merge branch 'em/man-bold-literal'Junio C Hamano Fri, 3 Jun 2016 21:38:02 +0000 (14:38 -0700)

Merge branch 'em/man-bold-literal'

The manpage output of our documentation did not render well in
terminal; typeset literals in bold by default to make them stand
out more.

* em/man-bold-literal:
Documentation: bold literals in man

Merge branch 'pa/cherry-pick-doc-typo'Junio C Hamano Fri, 3 Jun 2016 21:38:02 +0000 (14:38 -0700)

Merge branch 'pa/cherry-pick-doc-typo'

"git cherry-pick --help" had three instances of word "behavior",
one of which was spelled "behaviour", which is updated to match the
other two.

* pa/cherry-pick-doc-typo:
git-cherry-pick.txt: correct a small typo

Merge branch 'mr/send-email-doc-gmail-2fa'Junio C Hamano Fri, 3 Jun 2016 21:38:01 +0000 (14:38 -0700)

Merge branch 'mr/send-email-doc-gmail-2fa'

Typofix.

* mr/send-email-doc-gmail-2fa:
Documentation/git-send-email: fix typo in gmail 2FA section

Merge branch 'js/rebase-i-dedup-call-to-rerere'Junio C Hamano Fri, 3 Jun 2016 21:38:01 +0000 (14:38 -0700)

Merge branch 'js/rebase-i-dedup-call-to-rerere'

"git rebase -i", after it fails to auto-resolve the conflict, had
an unnecessary call to "git rerere" from its very early days, which
was spotted recently; the call has been removed.

* js/rebase-i-dedup-call-to-rerere:
rebase -i: remove an unnecessary 'rerere' invocation

Merge branch 'js/perf-rebase-i'Junio C Hamano Fri, 3 Jun 2016 21:38:00 +0000 (14:38 -0700)

Merge branch 'js/perf-rebase-i'

The one in 'master' has a brown-paper-bag bug that breaks the perf
test when used inside a usual Git repository with a working tree.

* js/perf-rebase-i:
perf: make the tests work without a worktree

builtin/apply: move 'newfd' global into 'struct apply_s... Christian Couder Fri, 3 Jun 2016 16:58:52 +0000 (18:58 +0200)

builtin/apply: move 'newfd' global into 'struct apply_state'

To libify the apply functionality the 'newfd' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: add 'lock_file' pointer into 'struct... Christian Couder Fri, 3 Jun 2016 16:58:51 +0000 (18:58 +0200)

builtin/apply: add 'lock_file' pointer into 'struct apply_state'

We cannot have a 'struct lock_file' allocated on the stack, as lockfile.c
keeps a linked list of all created lock_file structures.

Also 'struct apply_state' users might later want the same 'struct lock_file'
instance to be reused by different series of calls to the apply api.

So let's add a 'struct lock_file *lock_file' pointer into 'struct apply_state'
and have the user of 'struct apply_state' allocate memory for the actual
'struct lock_file' instance.

Let's also add an argument to init_apply_state(), so that the caller can
easily supply a pointer to the allocated instance.

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

rev-list: disable bitmaps when "-n" is used with listin... Jeff King Fri, 3 Jun 2016 07:08:05 +0000 (03:08 -0400)

rev-list: disable bitmaps when "-n" is used with listing objects

You can ask rev-list to use bitmaps to speed up an --objects
traversal, which should generally give you your answers much
faster.

Likewise, you can ask rev-list to limit such a traversal
with `-n`, in which case we'll show only a limited set of
commits (and only the tree and commit objects directly
reachable from those commits).

But if you do both together, the results are nonsensical. We
end up limiting any fallback traversal we do to _find_ the
bitmaps, but the actual set of objects we output will be
picked arbitrarily from the union of any bitmaps we do find,
and will involve the objects of many more commits.

It's possible that somebody might want this as a "show me
what you can, but limit the amount of work you do" flag.
But as with the prior commit clamping "--count", the results
are basically non-deterministic; you'll get the values from
some commits between `n` and the total number, and you can't
tell which.

And unlike the `--count` case, we can't easily generate the
"real" value from the bitmap values (you can't just walk
back `-n` commits and subtract out the reachable objects
from the boundary commits; the bitmaps for `X` record its
total reachability, so you don't know which objects are
directly from `X` itself, which from `X^`, and so on).

So let's just fallback to the non-bitmap code path in this
case, so we always give a sane answer.

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

rev-list: "adjust" results of "--count --use-bitmap... Jeff King Fri, 3 Jun 2016 07:07:34 +0000 (03:07 -0400)

rev-list: "adjust" results of "--count --use-bitmap-index -n"

If you ask rev-list for:

git rev-list --count --use-bitmap-index HEAD

we optimize out the actual traversal and just give you the
number of bits set in the commit bitmap. This is faster,
which is good.

But if you ask to limit the size of the traversal, like:

git rev-list --count --use-bitmap-index -n 100 HEAD

we'll still output the full bitmapped number we found. On
the surface, that might even seem OK. You explicitly asked
to use the bitmap index, and it was cheap to compute the
real answer, so we gave it to you.

But there's something much more complicated going on under
the hood. If we don't have a bitmap directly for HEAD, then
we have to actually traverse backwards, looking for a
bitmapped commit. And _that_ traversal is bounded by our
`-n` count.

This is a good thing, because it bounds the work we have to
do, which is probably what the user wanted by asking for
`-n`. But now it makes the output quite confusing. You might
get many values:

- your `-n` value, if we walked back and never found a
bitmap (or fewer if there weren't that many commits)

- the actual full count, if we found a bitmap root for
every path of our traversal with in the `-n` limit

- any number in between! We might have walked back and
found _some_ bitmaps, but then cut off the traversal
early with some commits not accounted for in the result.

So you cannot even see a value higher than your `-n` and say
"OK, bitmaps kicked in, this must be the real full count".
The only sane thing is for git to just clamp the value to a
maximum of the `-n` value, which means we should output the
exact same results whether bitmaps are in use or not.

The test in t5310 demonstrates this by using `-n 1`.
Without this patch we fail in the full-bitmap case (where we
do not have to traverse at all) but _not_ in the
partial-bitmap case (where we have to walk down to find an
actual bitmap). With this patch, both cases just work.

I didn't implement the crazy in-between case, just because
it's complicated to set up, and is really a subset of the
full-count case, which we do cover.

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

pathspec: rename free_pathspec() to clear_pathspec()Junio C Hamano Thu, 2 Jun 2016 21:09:22 +0000 (14:09 -0700)

pathspec: rename free_pathspec() to clear_pathspec()

The function takes a pointer to a pathspec structure, and releases
the resources held by it, but does not free() the structure itself.
Such a function should be called "clear", not "free".

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

Documentation/git-send-email: fix typo in gmail 2FA... SZEDER Gábor Wed, 1 Jun 2016 23:37:41 +0000 (01:37 +0200)

Documentation/git-send-email: fix typo in gmail 2FA section

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t2300: run git-sh-setup in an environment that better... Junio C Hamano Wed, 1 Jun 2016 20:30:47 +0000 (13:30 -0700)

t2300: run git-sh-setup in an environment that better mimics the real life

When we run scripted Porcelains, "git" potty has set up the $PATH by
prepending $GIT_EXEC_PATH, the path given by "git --exec-path=$there
$cmd", etc. already. Because of this, scripted Porcelains can
dot-source shell script library like git-sh-setup with simple dot
without specifying any path.

t2300 however dot-sources git-sh-setup without adjusting $PATH like
the real "git" potty does. This has not been a problem so far, but
once git-sh-setup wants to rely on the $PATH adjustment, just like
any scripted Porcelains already do, it would become one. It cannot
for example dot-source another shell library without specifying the
full path to it by prefixing $(git --exec-path).

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

t5500 & t7403: lose bash-ism "local"Junio C Hamano Wed, 1 Jun 2016 20:56:08 +0000 (13:56 -0700)

t5500 & t7403: lose bash-ism "local"

In t5500::check_prot_host_port_path(), diagport is not a variable
used elsewhere and the function is not recursively called so this
can simply lose the "local", which may not be supported by shell
(besides, the function liberally clobbers other variables without
making them "local").

t7403::reset_submodule_urls() overrides the "root" variable used
in the test framework for no good reason; its use is not about
temporarily relocating where the test repositories are created.
This assignment can be made not to clobber the variable by moving
them into the subshells it already uses. Its value is always
$TRASH_DIRECTORY, so we could use it instead there, and this
function that is called only once and its two subshells may not be
necessary (instead, the caller can use "git -C $there config" and
set a value that is derived from $TRASH_DIRECTORY), but this is a
minimum fix that is needed to lose "local".

Helped-by: John Keeping <john@keeping.me.uk>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: remove bashism from shell scriptStefan Beller Wed, 1 Jun 2016 00:27:59 +0000 (17:27 -0700)

submodule: remove bashism from shell script

Junio pointed out `relative_path` was using bashisms via the
local variables. As the longer term goal is to rewrite most of the
submodule code in C, do it now.

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

submodule--helper: offer a consistent APIStefan Beller Tue, 31 May 2016 23:59:33 +0000 (16:59 -0700)

submodule--helper: offer a consistent API

In 48308681 (2016-02-29, git submodule update: have a dedicated helper
for cloning), the helper communicated errors back only via exit code,
and dance with printing '#unmatched' in case of error was left to
git-submodule.sh as it uses the output of the helper and pipes it into
shell commands. This change makes the helper consistent by never
printing '#unmatched' in the helper but always handling these piping
issues in the actual shell script.

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

builtin/apply: move applying patches into apply_all_pat... Christian Couder Tue, 24 May 2016 08:11:24 +0000 (10:11 +0200)

builtin/apply: move applying patches into apply_all_patches()

To libify the apply functionality we should provide a function to
apply many patches. Let's move the code to do that into a new
apply_all_patches() function.

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

builtin/apply: move 'state' check into check_apply_state()Christian Couder Tue, 24 May 2016 08:11:23 +0000 (10:11 +0200)

builtin/apply: move 'state' check into check_apply_state()

To libify the apply functionality we should provide a function
to check that the values in a 'struct apply_state' instance are
coherent. Let's move the code to do that into a new
check_apply_state() function.

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

builtin/apply: move 'symlink_changes' global into ... Christian Couder Tue, 24 May 2016 08:11:22 +0000 (10:11 +0200)

builtin/apply: move 'symlink_changes' global into 'struct apply_state'

To libify the apply functionality the 'symlink_changes' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'fn_table' global into 'struct... Christian Couder Tue, 24 May 2016 08:11:21 +0000 (10:11 +0200)

builtin/apply: move 'fn_table' global into 'struct apply_state'

To libify the apply functionality the 'fn_table' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

As fn_table is cleared at the end of apply_patch(), it is not
necessary to clear it in clear_apply_state().

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

builtin/apply: move 'state_linenr' global into 'struct... Christian Couder Tue, 24 May 2016 08:11:20 +0000 (10:11 +0200)

builtin/apply: move 'state_linenr' global into 'struct apply_state'

To libify the apply functionality the 'state_linenr' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'max_change' and 'max_len' into... Christian Couder Tue, 24 May 2016 08:11:19 +0000 (10:11 +0200)

builtin/apply: move 'max_change' and 'max_len' into 'struct apply_state'

To libify the apply functionality the 'max_change' and 'max_len'
variables should not be static and global to the file. Let's move
them into 'struct apply_state'.

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

builtin/apply: move 'ws_ignore_action' into 'struct... Christian Couder Tue, 24 May 2016 08:11:18 +0000 (10:11 +0200)

builtin/apply: move 'ws_ignore_action' into 'struct apply_state'

To libify the apply functionality the 'ws_ignore_action' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'ws_error_action' into 'struct... Christian Couder Tue, 24 May 2016 08:11:17 +0000 (10:11 +0200)

builtin/apply: move 'ws_error_action' into 'struct apply_state'

To libify the apply functionality the 'ws_error_action' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'applied_after_fixing_ws' into... Christian Couder Tue, 24 May 2016 08:11:16 +0000 (10:11 +0200)

builtin/apply: move 'applied_after_fixing_ws' into 'struct apply_state'

To libify the apply functionality the 'applied_after_fixing_ws' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'squelch_whitespace_errors' into... Christian Couder Tue, 24 May 2016 08:11:15 +0000 (10:11 +0200)

builtin/apply: move 'squelch_whitespace_errors' into 'struct apply_state'

To libify the apply functionality the 'squelch_whitespace_errors' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: remove whitespace_option arg from set_de... Christian Couder Tue, 24 May 2016 08:11:14 +0000 (10:11 +0200)

builtin/apply: remove whitespace_option arg from set_default_whitespace_mode()

A previous change has move the whitespace_option variable from cmd_apply
into 'struct apply_state', so that we can now avoid passing it separately
to set_default_whitespace_mode().

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

builtin/apply: move 'whitespace_option' into 'struct... Christian Couder Tue, 24 May 2016 08:11:13 +0000 (10:11 +0200)

builtin/apply: move 'whitespace_option' into 'struct apply_state'

This will enable further refactoring, and it is more coherent and
simpler if all the option_parse_*() functions are passed a
'struct apply_state' instance in opt->value.

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

builtin/apply: move 'whitespace_error' global into... Christian Couder Tue, 24 May 2016 08:11:12 +0000 (10:11 +0200)

builtin/apply: move 'whitespace_error' global into 'struct apply_state'

To libify the apply functionality the 'whitespace_error' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'root' global into 'struct apply_state'Christian Couder Tue, 24 May 2016 08:11:11 +0000 (10:11 +0200)

builtin/apply: move 'root' global into 'struct apply_state'

To libify the apply functionality the 'root' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'p_value_known' global into 'struct... Christian Couder Tue, 24 May 2016 08:11:10 +0000 (10:11 +0200)

builtin/apply: move 'p_value_known' global into 'struct apply_state'

To libify the apply functionality the 'p_value_known' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'p_value' global into 'struct apply... Christian Couder Tue, 24 May 2016 08:11:09 +0000 (10:11 +0200)

builtin/apply: move 'p_value' global into 'struct apply_state'

To libify the apply functionality the 'p_value' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'has_include' global into 'struct... Christian Couder Tue, 24 May 2016 08:11:08 +0000 (10:11 +0200)

builtin/apply: move 'has_include' global into 'struct apply_state'

To libify the apply functionality the 'has_include' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'limit_by_name' global into 'struct... Christian Couder Tue, 24 May 2016 08:11:07 +0000 (10:11 +0200)

builtin/apply: move 'limit_by_name' global into 'struct apply_state'

To libify the apply functionality the 'limit_by_name' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'patch_input_file' global into... Christian Couder Tue, 24 May 2016 08:11:06 +0000 (10:11 +0200)

builtin/apply: move 'patch_input_file' global into 'struct apply_state'

To libify the apply functionality the 'patch_input_file' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'apply' global into 'struct apply_s... Christian Couder Tue, 24 May 2016 08:11:05 +0000 (10:11 +0200)

builtin/apply: move 'apply' global into 'struct apply_state'

To libify the apply functionality the 'apply' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'p_context' global into 'struct... Christian Couder Tue, 24 May 2016 08:11:04 +0000 (10:11 +0200)

builtin/apply: move 'p_context' global into 'struct apply_state'

To libify the apply functionality the 'p_context' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'fake_ancestor' global into 'struct... Christian Couder Tue, 24 May 2016 08:11:03 +0000 (10:11 +0200)

builtin/apply: move 'fake_ancestor' global into 'struct apply_state'

To libify the apply functionality the 'fake_ancestor' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

By the way remove a comment about '--index-info' that was renamed
'--build-fake-ancestor' in commit 26b28007689d27a921ea90e5a29fc8eb74b0d297
(apply: get rid of --index-info in favor of --build-fake-ancestor,
Sep 17 2007).

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

builtin/apply: move 'line_termination' global into... Christian Couder Tue, 24 May 2016 08:11:02 +0000 (10:11 +0200)

builtin/apply: move 'line_termination' global into 'struct apply_state'

To libify the apply functionality the 'line_termination' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'unsafe_paths' global into 'struct... Christian Couder Tue, 24 May 2016 08:11:01 +0000 (10:11 +0200)

builtin/apply: move 'unsafe_paths' global into 'struct apply_state'

To libify the apply functionality the 'unsafe_paths' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'no_add' global into 'struct apply_... Christian Couder Tue, 24 May 2016 08:11:00 +0000 (10:11 +0200)

builtin/apply: move 'no_add' global into 'struct apply_state'

To libify the apply functionality the 'no_add' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'threeway' global into 'struct... Christian Couder Tue, 24 May 2016 08:10:59 +0000 (10:10 +0200)

builtin/apply: move 'threeway' global into 'struct apply_state'

To libify the apply functionality the 'threeway' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'summary' global into 'struct apply... Christian Couder Tue, 24 May 2016 08:10:58 +0000 (10:10 +0200)

builtin/apply: move 'summary' global into 'struct apply_state'

To libify the apply functionality the 'summary' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'numstat' global into 'struct apply... Christian Couder Tue, 24 May 2016 08:10:57 +0000 (10:10 +0200)

builtin/apply: move 'numstat' global into 'struct apply_state'

To libify the apply functionality the 'numstat' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'diffstat' global into 'struct... Christian Couder Tue, 24 May 2016 08:10:56 +0000 (10:10 +0200)

builtin/apply: move 'diffstat' global into 'struct apply_state'

To libify the apply functionality the 'diffstat' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'cached' global into 'struct apply_... Christian Couder Tue, 24 May 2016 08:10:55 +0000 (10:10 +0200)

builtin/apply: move 'cached' global into 'struct apply_state'

To libify the apply functionality the 'cached' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'allow_overlap' global into 'struct... Christian Couder Tue, 24 May 2016 08:10:54 +0000 (10:10 +0200)

builtin/apply: move 'allow_overlap' global into 'struct apply_state'

To libify the apply functionality the 'allow_overlap' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'update_index' global into 'struct... Christian Couder Tue, 24 May 2016 08:10:53 +0000 (10:10 +0200)

builtin/apply: move 'update_index' global into 'struct apply_state'

To libify the apply functionality the 'update_index' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'apply_verbosely' global into ... Christian Couder Tue, 24 May 2016 08:10:52 +0000 (10:10 +0200)

builtin/apply: move 'apply_verbosely' global into 'struct apply_state'

To libify the apply functionality the 'apply_verbosely' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'apply_with_reject' global into... Christian Couder Tue, 24 May 2016 08:10:51 +0000 (10:10 +0200)

builtin/apply: move 'apply_with_reject' global into 'struct apply_state'

To libify the apply functionality the 'apply_with_reject' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'apply_in_reverse' global into... Christian Couder Tue, 24 May 2016 08:10:50 +0000 (10:10 +0200)

builtin/apply: move 'apply_in_reverse' global into 'struct apply_state'

To libify the apply functionality the 'apply_in_reverse' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'check_index' global into 'struct... Christian Couder Tue, 24 May 2016 08:10:49 +0000 (10:10 +0200)

builtin/apply: move 'check_index' global into 'struct apply_state'

To libify the apply functionality the 'check_index' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'check' global into 'struct apply_s... Christian Couder Tue, 24 May 2016 08:10:48 +0000 (10:10 +0200)

builtin/apply: move 'check' global into 'struct apply_state'

To libify the apply functionality the 'check' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'unidiff_zero' global into 'struct... Christian Couder Tue, 24 May 2016 08:10:47 +0000 (10:10 +0200)

builtin/apply: move 'unidiff_zero' global into 'struct apply_state'

To libify the apply functionality the 'unidiff_zero' variable should
not be static and global to the file. Let's move it into
'struct apply_state'.

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

builtin/apply: move 'state' init into init_apply_state()Christian Couder Tue, 24 May 2016 08:10:46 +0000 (10:10 +0200)

builtin/apply: move 'state' init into init_apply_state()

When the apply functionality will be libified, the 'struct apply_state'
will be used by different pieces of code.

To properly initialize a 'struct apply_state', let's provide a nice
and easy to use init_apply_state() function.

Let's also provide clear_apply_state() to release memory used by
'struct apply_state' members, so that a 'struct apply_state' instance
can be easily reused without leaking memory.

Note that clear_apply_state() does nothing for now, but it will later.

While at it, let's rename 'prefix_' parameter to 'prefix'.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: add $(DEVELOPER_CFLAGS) variableMatthieu Moy Wed, 1 Jun 2016 08:00:08 +0000 (10:00 +0200)

Makefile: add $(DEVELOPER_CFLAGS) variable

This does not change the behavior, but allows the user to tweak
DEVELOPER_CFLAGS on the command-line or in a config.mak* file if
needed.

This also makes the code somewhat cleaner as it follows the pattern

<initialisation of variables>
<include statements>
<actual build logic>

by specifying which flags to activate in the first part, and actually
activating them in the last one.

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

test-lib: add in-shell "env" replacementJeff King Wed, 1 Jun 2016 07:04:26 +0000 (03:04 -0400)

test-lib: add in-shell "env" replacement

The one-shot environment variable syntax:

FOO=BAR some-program

is unportable when some-program is actually a shell
function, like test_must_fail (on some shells FOO remains
set after the function returns, and on others it does not).

We sometimes get around this by using env, like:

test_must_fail env FOO=BAR some-program

But that only works because test_must_fail's arguments are
themselves a command which can be run. You can't run:

env FOO=BAR test_must_fail some-program

because env does not know about our shell functions. So
there is no equivalent for test_commit, for example, and one
must resort to:

(
FOO=BAR
export FOO
test_commit
)

which is a bit verbose. Let's add a version of "env" that
works _inside_ the shell, by creating a subshell, exporting
variables from its argument list, and running the command.

Its use is demonstrated on a currently-unportable case in
t4014.

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

Git 2.9-rc1 v2.9.0-rc1Junio C Hamano Tue, 31 May 2016 21:07:08 +0000 (14:07 -0700)

Git 2.9-rc1

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

Merge branch 'maint'Junio C Hamano Tue, 31 May 2016 21:12:08 +0000 (14:12 -0700)

Merge branch 'maint'

* maint:
More topics for 2.8.4

More topics for 2.8.4Junio C Hamano Tue, 31 May 2016 21:11:38 +0000 (14:11 -0700)

More topics for 2.8.4

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

Merge branch 'sb/submodule-deinit-all' into maintJunio C Hamano Tue, 31 May 2016 21:09:46 +0000 (14:09 -0700)

Merge branch 'sb/submodule-deinit-all' into maint

Correct faulty recommendation to use "git submodule deinit ." when
de-initialising all submodules, which would result in a strange
error message in a pathological corner case.

* sb/submodule-deinit-all:
submodule deinit: require '--all' instead of '.' for all submodules

Merge branch 'bn/http-cookiefile-config' into maintJunio C Hamano Tue, 31 May 2016 21:08:28 +0000 (14:08 -0700)

Merge branch 'bn/http-cookiefile-config' into maint

"http.cookieFile" configuration variable clearly wants a pathname,
but we forgot to treat it as such by e.g. applying tilde expansion.

* bn/http-cookiefile-config:
http: expand http.cookieFile as a path
Documentation: config: improve word ordering for http.cookieFile

Merge branch 'jk/test-send-sh-x-trace-elsewhere' into... Junio C Hamano Tue, 31 May 2016 21:08:27 +0000 (14:08 -0700)

Merge branch 'jk/test-send-sh-x-trace-elsewhere' into maint

Running tests with '-x' option to trace the individual command
executions is a useful way to debug test scripts, but some tests
that capture the standard error stream and check what the command
said can be broken with the trace output mixed in. When running
our tests under "bash", however, we can redirect the trace output
to another file descriptor to keep the standard error of programs
being tested intact.

* jk/test-send-sh-x-trace-elsewhere:
test-lib: set BASH_XTRACEFD automatically

Merge branch 'js/name-rev-use-oldest-ref' into maintJunio C Hamano Tue, 31 May 2016 21:08:26 +0000 (14:08 -0700)

Merge branch 'js/name-rev-use-oldest-ref' into maint

"git describe --contains" often made a hard-to-justify choice of
tag to give name to a given commit, because it tried to come up
with a name with smallest number of hops from a tag, causing an old
commit whose close descendant that is recently tagged were not
described with respect to an old tag but with a newer tag. It did
not help that its computation of "hop" count was further tweaked to
penalize being on a side branch of a merge. The logic has been
updated to favor using the tag with the oldest tagger date, which
is a lot easier to explain to the end users: "We describe a commit
in terms of the (chronologically) oldest tag that contains the
commit."

* js/name-rev-use-oldest-ref:
name-rev: include taggerdate in considering the best name

rebase -i: remove an unnecessary 'rerere' invocationJohannes Sixt Fri, 27 May 2016 16:28:21 +0000 (18:28 +0200)

rebase -i: remove an unnecessary 'rerere' invocation

Interactive rebase uses 'git cherry-pick' and 'git merge' to replay
commits. Both invoke the 'rerere' machinery when they fail due to merge
conflicts. Note that all code paths with these two commands also invoke
the shell function die_with_patch when the commands fail.

Since commit 629716d2 ("rerere: do use multiple variants") the second
operation of the rerere machinery can be observed by a duplicated
message "Recorded preimage for 'file'". This second operation records
the same preimage as the first one and, hence, only wastes cycles.
Remove the 'git rerere' invocation from die_with_patch.

Shell function die_with_patch can be called after the failure of
"git commit", too, which also calls into the rerere machinery, but it
does so only after a successful commit to record the resolution.
Therefore, it is wrong to call 'git rerere' from die_with_patch after
"git commit" fails.

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

perf: make the tests work without a worktreeRené Scharfe Sun, 29 May 2016 16:43:41 +0000 (18:43 +0200)

perf: make the tests work without a worktree

In regular repositories $source_git and $objects_dir contain relative
paths based on $source. Go there to allow cp to resolve them.

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

grep: -W: don't extend context to trailing empty linesRené Scharfe Sat, 28 May 2016 15:06:19 +0000 (17:06 +0200)

grep: -W: don't extend context to trailing empty lines

Empty lines between functions are shown by grep -W, as it considers them
to be part of the function preceding them. They are not interesting in
most languages. The previous patches stopped showing them for diff -W.

Stop showing empty lines trailing a function with grep -W. Grep scans
the lines of a buffer from top to bottom and prints matching lines
immediately. Thus we need to peek ahead in order to determine if an
empty line is part of a function body and worth showing or not.

Remember how far ahead we peeked in order to avoid having to do so
repeatedly when handling multiple consecutive empty lines.

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

t7810: add test for grep -W and trailing empty context... René Scharfe Sat, 28 May 2016 15:05:41 +0000 (17:05 +0200)

t7810: add test for grep -W and trailing empty context lines

Add a test demonstrating that git grep -W prints empty lines following
the function context we're actually interested in. The modified test
file makes it necessary to adjust three unrelated test cases.

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

xdiff: don't trim common tail with -WRené Scharfe Sat, 28 May 2016 15:04:31 +0000 (17:04 +0200)

xdiff: don't trim common tail with -W

The function trim_common_tail() exits early if context lines are
requested. If -U0 and -W are specified together then it can still trim
context lines that might belong to a changed function. As a result
that function is shown incompletely.

Fix that by calling trim_common_tail() only if no function context or
fixed context is requested. The parameter ctx is no longer needed now;
remove it.

While at it fix an outdated comment as well.

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

xdiff: -W: don't include common trailing empty lines... René Scharfe Sat, 28 May 2016 15:03:16 +0000 (17:03 +0200)

xdiff: -W: don't include common trailing empty lines in context

Empty lines between functions are shown by diff -W, as it considers them
to be part of the function preceding them. They are not interesting in
most languages. The previous patch stopped showing them in the special
case of a function added at the end of a file.

Stop extending context to those empty lines by skipping back over them
from the start of the next function.

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

xdiff: ignore empty lines before added functions with -WRené Scharfe Sat, 28 May 2016 15:02:24 +0000 (17:02 +0200)

xdiff: ignore empty lines before added functions with -W

If a new function and a preceding empty line is appended, diff -W shows
the previous function in full in order to provide context for that empty
line. In most languages empty lines between sections are not
interesting in and off themselves and showing a whole extra function for
them is not what we want.

Skip empty lines when checking of the appended chunk starts with a
function line, thereby avoiding to extend the context just for them.

Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdiff: handle appended chunks better with -WRené Scharfe Sat, 28 May 2016 15:00:28 +0000 (17:00 +0200)

xdiff: handle appended chunks better with -W

If lines are added at the end of a file, diff -W shows the whole file.
That's because get_func_line() only considers the pre-image and gives up
if it sees a record index beyond its end.

Consider the post-image as well to see if the added lines already make
up a full function. If it doesn't then search for the previous function
line by starting from the bottom of the pre-image, thereby avoiding to
confuse get_func_line().

Reuse the existing label called "again", as it's exactly where we need
to jump to when we're done handling the pre-context, but rename it to
"post_context_calculation" in order to document its new purpose better.

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

xdiff: factor out match_func_rec()René Scharfe Sat, 28 May 2016 14:58:47 +0000 (16:58 +0200)

xdiff: factor out match_func_rec()

Add match_func_rec(), a helper that wraps accessing a record and calling
the appropriate function for checking if it contains a function line.

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

t4051: rewrite, add more testsRené Scharfe Tue, 31 May 2016 20:00:38 +0000 (22:00 +0200)

t4051: rewrite, add more tests

Remove the tests that checked against a fixed result and replace them
with more focused checks of desired properties of the created diffs.
That way we get more detailed and meaningful diagnostics.

Store test file contents in files in a subdirectory in order to avoid
cluttering the test script with them.

Use tagged commits to store the changes to test diff -W against instead
of using changes to the worktree. Use the worktree instead to try and
apply the generated patch in order to validate it.

Document unwanted features: trailing empty lines, too much context for
appended functions, insufficient context at the end with -U0.

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

Merge branch 'es/t1500-modernize'Junio C Hamano Tue, 31 May 2016 19:40:55 +0000 (12:40 -0700)

Merge branch 'es/t1500-modernize'

test updates to make it more readable and maintainable.

* es/t1500-modernize:
t1500: avoid setting environment variables outside of tests
t1500: avoid setting configuration options outside of tests
t1500: avoid changing working directory outside of tests
t1500: test_rev_parse: facilitate future test enhancements
t1500: be considerate to future potential tests

Merge branch 'jk/cat-file-buffered-batch-all'Junio C Hamano Tue, 31 May 2016 19:40:54 +0000 (12:40 -0700)

Merge branch 'jk/cat-file-buffered-batch-all'

"git cat-file --batch-all" has been sped up, by taking advantage
of the fact that it does not have to read a list of objects, in two
ways.

* jk/cat-file-buffered-batch-all:
cat-file: default to --buffer when --batch-all-objects is used
cat-file: avoid noop calls to sha1_object_info_extended

Merge branch 'fc/fast-import-broken-marks-file'Junio C Hamano Tue, 31 May 2016 19:40:53 +0000 (12:40 -0700)

Merge branch 'fc/fast-import-broken-marks-file'

"git fast-import --export-marks" would overwrite the existing marks
file even when it makes a dump from its custom die routine.
Prevent it from doing so when we have an import-marks file but
haven't finished reading it.

* fc/fast-import-broken-marks-file:
fast-import: do not truncate exported marks file

worktree: allow "-" short-hand for @{-1} in add commandJordan DE GEA Fri, 27 May 2016 13:17:08 +0000 (15:17 +0200)

worktree: allow "-" short-hand for @{-1} in add command

Since `git worktree add` uses `git checkout` when `[<branch>]` is used,
and `git checkout -` is already supported, it makes sense to allow the
same shortcut in `git worktree add`.

Signed-off-by: Jordan DE GEA <jordan.de-gea@grenoble-inp.org>
Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: bold literals in manErwan Mathoniere Tue, 31 May 2016 16:20:33 +0000 (18:20 +0200)

Documentation: bold literals in man

Backticks are emphasized through monospaced styling in the HTML
version of Git documentation. But they were left unstyled in the
manual pages.

To make the man pages more comfortably read, `MAN_BOLD_LITERAL` was
added by 5121a6d (Documentation: option to render literal text as
bold for manpages, 2009-03-27). It allowed the user to build the
manpages with literals in bold style.

For precaution it was not set by default back then.

Since 79c461d (docs: default to more modern toolset, 2010-11-19), it
is assumed ASCIIDOC 8 and at least docbook-xsl 1.73 are used, so the
need for compatibility concern is much lessor now.

Remove `MAN_BOLD_LITERAL`, and typeset literals as bold by default .
Add `NO_MAN_BOLD_LITERAL`, a new Makefile option, disabling this
feature when defined.

Signed-off-by: Erwan MATHONIERE <erwan.mathoniere@grenoble-inp.org>
Signed-off-by: Samuel GROOT <samuel.groot@grenoble-inp.org>
Signed-off-by: Tom RUSSELLO <tom.russello@grenoble-inp.org>
Signed-off-by: Matthieu MOY <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: pt_PT: update Portuguese translationVasco Almeida Fri, 27 May 2016 19:17:32 +0000 (19:17 +0000)

l10n: pt_PT: update Portuguese translation

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>

l10n: pt_PT: update according to git-gui glossaryVasco Almeida Fri, 27 May 2016 15:09:29 +0000 (15:09 +0000)

l10n: pt_PT: update according to git-gui glossary

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>

l10n: pt_PT: merge git.pot fileVasco Almeida Sat, 28 May 2016 17:14:12 +0000 (17:14 +0000)

l10n: pt_PT: merge git.pot file

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>

upload-pack.c: use parse-options APIAntoine Queru Tue, 31 May 2016 09:57:08 +0000 (11:57 +0200)

upload-pack.c: use parse-options API

Use the parse-options API rather than a hand-rolled option parser.

Description for --stateless-rpc and --advertise-refs come from
42526b4 (Add stateless RPC options to upload-pack,
receive-pack, 2009-10-30).

Signed-off-by: Antoine Queru <antoine.queru@grenoble-inp.org>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: move 'ifdef DEVELOPER' after config.mak*... Matthieu Moy Tue, 31 May 2016 13:24:43 +0000 (15:24 +0200)

Makefile: move 'ifdef DEVELOPER' after config.mak* inclusion

The DEVELOPER knob was introduced in 658df95 (add DEVELOPER makefile
knob to check for acknowledged warnings, 2016-02-25), and works well
when used as "make DEVELOPER=1", and when the configure script was not
used.

However, the advice given in CodingGuidelines to add DEVELOPER=1 to
config.mak does not: config.mak is included after testing for
DEVELOPER in the Makefile, and at least GNU Make's manual specifies
"Conditional directives are parsed immediately", hence the config.mak
declaration is not visible at the time the conditional is evaluated.

Also, when using the configure script to generate a
config.mak.autogen, the later file contained a "CFLAGS = <flags>"
initialization, which overrode the "CFLAGS += -W..." triggered by
DEVELOPER.

This patch fixes both issues.

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