]> Kevux Git Server - rit/log
rit
10 years agosubmodule: remove bashism from shell script
Stefan 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>
10 years agosubmodule--helper: offer a consistent API
Stefan 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>
10 years agobuiltin/apply: move applying patches into apply_all_patches()
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>
10 years agobuiltin/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>
10 years agobuiltin/apply: move 'symlink_changes' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'fn_table' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'state_linenr' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'max_change' and 'max_len' into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'ws_ignore_action' into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'ws_error_action' into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'applied_after_fixing_ws' into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'squelch_whitespace_errors' into 'struct apply_state'
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>
10 years agobuiltin/apply: remove whitespace_option arg from set_default_whitespace_mode()
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>
10 years agobuiltin/apply: move 'whitespace_option' into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'whitespace_error' global into 'struct apply_state'
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>
10 years agobuiltin/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>
10 years agobuiltin/apply: move 'p_value_known' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'p_value' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'has_include' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'limit_by_name' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'patch_input_file' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'apply' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'p_context' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'fake_ancestor' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'line_termination' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'unsafe_paths' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'no_add' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'threeway' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'summary' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'numstat' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'diffstat' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'cached' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'allow_overlap' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'update_index' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'apply_verbosely' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'apply_with_reject' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'apply_in_reverse' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'check_index' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'check' global into 'struct apply_state'
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>
10 years agobuiltin/apply: move 'unidiff_zero' global into 'struct apply_state'
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>
10 years agobuiltin/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>
10 years agoMakefile: add $(DEVELOPER_CFLAGS) variable
Matthieu 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>
10 years agotest-lib: add in-shell "env" replacement
Jeff 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>
10 years agoGit 2.9-rc1
Junio 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>
10 years agoMerge 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

10 years agoMore topics for 2.8.4
Junio 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>
10 years agoMerge branch 'sb/submodule-deinit-all' into maint
Junio 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

10 years agoMerge branch 'bn/http-cookiefile-config' into maint
Junio 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

10 years agoMerge branch 'jk/test-send-sh-x-trace-elsewhere' into maint
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

10 years agoMerge branch 'js/name-rev-use-oldest-ref' into maint
Junio 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

10 years agorebase -i: remove an unnecessary 'rerere' invocation
Johannes 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>
10 years agoperf: make the tests work without a worktree
René 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>
10 years agogrep: -W: don't extend context to trailing empty lines
René 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>
10 years agot7810: add test for grep -W and trailing empty context lines
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>
10 years agoxdiff: don't trim common tail with -W
René 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>
10 years agoxdiff: -W: don't include common trailing empty lines in context
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>
10 years agoxdiff: ignore empty lines before added functions with -W
René 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>
10 years agoxdiff: handle appended chunks better with -W
René 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>
10 years agoxdiff: 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>
10 years agot4051: rewrite, add more tests
René 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>
10 years agoMerge 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

10 years agoMerge 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

10 years agoMerge 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

10 years agoworktree: allow "-" short-hand for @{-1} in add command
Jordan 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>
10 years agoDocumentation: bold literals in man
Erwan 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>
10 years agol10n: pt_PT: update Portuguese translation
Vasco 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>
10 years agol10n: pt_PT: update according to git-gui glossary
Vasco 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>
10 years agol10n: pt_PT: merge git.pot file
Vasco 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>
10 years agoupload-pack.c: use parse-options API
Antoine 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>
10 years agoMakefile: move 'ifdef DEVELOPER' after config.mak* inclusion
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>
10 years agoREADME.md: format CLI commands with code syntax
Benjamin Dopplinger [Mon, 30 May 2016 03:08:16 +0000 (03:08 +0000)]
README.md: format CLI commands with code syntax

CLI commands which are mentioned in the readme are now formatted with
the Markdown code syntax to make the documentation more readable.

Signed-off-by: Benjamin Dopplinger <b.dopplinger@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoFinal batch before 2.9-rc1
Junio C Hamano [Mon, 30 May 2016 01:08:26 +0000 (18:08 -0700)]
Final batch before 2.9-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'ak/t0008-ksh88-workaround'
Junio C Hamano [Mon, 30 May 2016 01:06:44 +0000 (18:06 -0700)]
Merge branch 'ak/t0008-ksh88-workaround'

Test portability workaround.

* ak/t0008-ksh88-workaround:
  t0008: 4 tests fail with ksh88

10 years agoMerge branch 'js/t6044-use-test-seq'
Junio C Hamano [Mon, 30 May 2016 01:06:43 +0000 (18:06 -0700)]
Merge branch 'js/t6044-use-test-seq'

Test portability fix.

* js/t6044-use-test-seq:
  t6044: replace seq by test_seq

10 years agoMerge branch 'ak/t4204-shell-portability'
Junio C Hamano [Mon, 30 May 2016 01:06:43 +0000 (18:06 -0700)]
Merge branch 'ak/t4204-shell-portability'

Update a test to run also under ksh88.

* ak/t4204-shell-portability:
  t4204: do not let $name variable clobbered

10 years agoMerge branch 'rj/log-decorate-auto'
Junio C Hamano [Mon, 30 May 2016 01:06:42 +0000 (18:06 -0700)]
Merge branch 'rj/log-decorate-auto'

We forgot to add "git log --decorate=auto" to documentation when we
added the feature back in v2.1.0 timeframe.

* rj/log-decorate-auto:
  log: document the --decorate=auto option

10 years agoMerge branch 'mr/send-email-doc-gmail-2fa'
Junio C Hamano [Mon, 30 May 2016 01:06:42 +0000 (18:06 -0700)]
Merge branch 'mr/send-email-doc-gmail-2fa'

Give hints to GMail users with two-factor auth enabled that
they need app-specific-password when using send-email.

* mr/send-email-doc-gmail-2fa:
  Documentation: add instructions to help setup gmail 2FA

10 years agoMerge branch 'kb/msys2-tty'
Junio C Hamano [Mon, 30 May 2016 01:06:41 +0000 (18:06 -0700)]
Merge branch 'kb/msys2-tty'

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*)

10 years agofast-import: invalidate pack_id references after loosening
Eric Wong [Wed, 25 May 2016 22:54:02 +0000 (22:54 +0000)]
fast-import: invalidate pack_id references after loosening

When loosening a pack, the current pack_id gets reused when
checkpointing and the import does not terminate.  This causes
problems after checkpointing as the object table, branch, and
tag lists still contains pre-checkpoint references to the
recycled pack_id.

Merely clearing the object_table as suggested by Jeff King in
http://mid.gmane.org/20160517121330.GA7346@sigill.intra.peff.net
is insufficient as the marks set still contains references
to object entries.

Wrong pack_id references branch and tags lists do not cause
errors, but can lead to misleading crash reports and core dumps,
so they are also invalidated.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-cherry-pick.txt: correct a small typo
Pablo Santiago Blum de Aguiar [Sun, 29 May 2016 19:29:29 +0000 (16:29 -0300)]
git-cherry-pick.txt: correct a small typo

Most of the document mentions `behavior` instead of the British
variation, `behaviour`. This change makes it consistent.

Signed-off-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopatch-id: use starts_with() and skip_prefix()
René Scharfe [Sat, 28 May 2016 16:20:23 +0000 (18:20 +0200)]
patch-id: use starts_with() and skip_prefix()

Get rid of magic numbers and avoid running over the end of a NUL
terminated string by using starts_with() and skip_prefix() instead
of memcmp().

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoapply: remove unused parameters from name_terminate()
René Scharfe [Sat, 28 May 2016 16:12:01 +0000 (18:12 +0200)]
apply: remove unused parameters from name_terminate()

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoblame: require 0 context lines while finding moved lines with -M
David Kastrup [Sat, 28 May 2016 09:13:53 +0000 (11:13 +0200)]
blame: require 0 context lines while finding moved lines with -M

The core part of git blame -M required 1 context line, but
there is no rationale to be found in the code; it causes artifacts
like discussed in the thread:

  <http://thread.gmane.org/gmane.comp.version-control.git/255289/>.

<http://permalink.gmane.org/gmane.comp.version-control.git/295795>
sheds some more light on the history of the previous choice.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agol10n: Updated Bulgarian translation of git (2597t,0f,0u)
Alexander Shopov [Sun, 6 Mar 2016 15:19:16 +0000 (07:19 -0800)]
l10n: Updated Bulgarian translation of git (2597t,0f,0u)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
10 years agoMerge branch 'v2.9.0_rnd1_fr' of git://github.com/jnavila/git
Jiang Xin [Sun, 29 May 2016 11:55:26 +0000 (19:55 +0800)]
Merge branch 'v2.9.0_rnd1_fr' of git://github.com/jnavila/git

* 'v2.9.0_rnd1_fr' of git://github.com/jnavila/git:
  l10n: fr.po v2.9.0rnd1

10 years agoDocumentation: add instructions to help setup gmail 2FA
Michael Rappazzo [Fri, 27 May 2016 20:39:57 +0000 (16:39 -0400)]
Documentation: add instructions to help setup gmail 2FA

For those who use two-factor authentication with gmail, git-send-email
will not work unless it is setup with an app-specific password. The
example for setting up git-send-email for use with gmail will now
include information on generating and storing the app-specific password.

Signed-off-by: Michael Rappazzo <rappazzo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agolog: document the --decorate=auto option
Ramsay Jones [Fri, 27 May 2016 15:56:02 +0000 (16:56 +0100)]
log: document the --decorate=auto option

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoformat_commit_message: honor `color=auto` for `%C(auto)`
Edward Thomson [Fri, 27 May 2016 03:46:10 +0000 (22:46 -0500)]
format_commit_message: honor `color=auto` for `%C(auto)`

git-log(1) documents that when specifying the `%C(auto)` format
placeholder will "turn on auto coloring on the next %placeholders
until the color is switched again."

However, when `%C(auto)` is used, the present implementation will turn
colors on unconditionally (even if the color configuration is turned off
for the current context - for example, `--no-color` was specified or the
color is `auto` and the output is not a tty).

Update `format_commit_one` to examine the current context when a format
string of `%C(auto)` is specified, which ensures that we will not
unconditionally write colors.  This brings that behavior in line with
the behavior of `%C(auto,<colorname>)`, and allows the user the ability
to specify that color should be displayed only when the output is a
tty.

Additionally, add a test for `%C(auto)` and update the existing tests
for `%C(auto,...)` as they were misidentified as being applicable to
`%C(auto)`.

Tests from Jeff King.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Edward Thomson <ethomson@edwardthomson.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoconfig: add a notion of "scope"
Jeff King [Wed, 18 May 2016 22:44:23 +0000 (18:44 -0400)]
config: add a notion of "scope"

A config callback passed to git_config() doesn't know very
much about the context in which it sees a variable. It can
ask whether the variable comes from a file, and get the file
name. But without analyzing the filename (which is hard to
do accurately), it cannot tell whether it is in system-level
config, user-level config, or repo-specific config.

Generally this doesn't matter; the point of not passing this
to the callback is that it should treat the config the same
no matter where it comes from. But some programs, like
upload-pack, are a special case: we should be able to run
them in an untrusted repository, which means we cannot use
any "dangerous" config from the repository config file (but
it is OK to use it from system or user config).

This patch teaches the config code to record the "scope" of
each variable, and make it available inside config
callbacks, similar to how we give access to the filename.
The scope is the starting source for a particular parsing
operation, and remains the same even if we include other
files (so a .git/config which includes another file will
remain CONFIG_SCOPE_REPO, as it would be similarly
untrusted).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoconfig: return configset value for current_config_ functions
Jeff King [Fri, 27 May 2016 00:32:23 +0000 (20:32 -0400)]
config: return configset value for current_config_ functions

When 473166b (config: add 'origin_type' to config_source
struct, 2016-02-19) added accessor functions for the origin
type and name, it taught them only to look at the "cf"
struct that is filled in while we are parsing the config.
This is sufficient to make it work with git-config, which
uses git_config_with_options() under the hood. That function
freshly parses the config files and triggers the callback
when it parses each key.

Most git programs, however, use git_config(). This interface
will populate a cache during the actual parse, and then
serve values from the cache. Calling current_config_filename()
in a callback here will find a NULL cf and produce an error.
There are no such callers right now, but let's prepare for
adding some by making this work.

We already record source information in a struct attached to
each value. We just need to make it globally available and
then consult it from the accessor functions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosubmodule update: learn `--[no-]recommend-shallow` option
Stefan Beller [Thu, 26 May 2016 21:59:43 +0000 (14:59 -0700)]
submodule update: learn `--[no-]recommend-shallow` option

Sometimes the history of a submodule is not considered important by
the projects upstream. To make it easier for downstream users, allow
a boolean field 'submodule.<name>.shallow' in .gitmodules, which can
be used to recommend whether upstream considers the history important.

This field is honored in the initial clone by default, it can be
ignored by giving the `--no-recommend-shallow` option.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosubmodule-config: keep shallow recommendation around
Stefan Beller [Thu, 26 May 2016 21:59:42 +0000 (14:59 -0700)]
submodule-config: keep shallow recommendation around

The shallow field will be used in a later patch by `submodule update`.
To differentiate between the actual depth (which may be different),
we name it `recommend_shallow` as the field in the .gitmodules file
is only a recommendation by the project.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agol10n: sv.po: Update Swedish translation (2597t0f0u)
Peter Krefting [Fri, 27 May 2016 13:04:42 +0000 (14:04 +0100)]
l10n: sv.po: Update Swedish translation (2597t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
10 years agol10n: fr.po v2.9.0rnd1
Jean-Noel Avila [Thu, 26 May 2016 20:46:41 +0000 (22:46 +0200)]
l10n: fr.po v2.9.0rnd1

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
10 years agoSync with maint
Junio C Hamano [Thu, 26 May 2016 20:28:24 +0000 (13:28 -0700)]
Sync with maint

* maint:
  Start preparing for 2.8.4
  archive-tar: convert snprintf to xsnprintf

10 years agoStart preparing for 2.8.4
Junio C Hamano [Thu, 26 May 2016 20:21:00 +0000 (13:21 -0700)]
Start preparing for 2.8.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'jc/linkgit-fix' into maint
Junio C Hamano [Thu, 26 May 2016 20:17:26 +0000 (13:17 -0700)]
Merge branch 'jc/linkgit-fix' into maint

Many 'linkgit:<git documentation page>' references were broken,
which are all fixed with this.

* jc/linkgit-fix:
  Documentation: fix linkgit references

10 years agoMerge branch 'ls/travis-build-doc' into maint
Junio C Hamano [Thu, 26 May 2016 20:17:25 +0000 (13:17 -0700)]
Merge branch 'ls/travis-build-doc' into maint

CI test was taught to build documentation pages.

* ls/travis-build-doc:
  travis-ci: build documentation

10 years agoMerge branch 'jc/fsck-nul-in-commit' into maint
Junio C Hamano [Thu, 26 May 2016 20:17:24 +0000 (13:17 -0700)]
Merge branch 'jc/fsck-nul-in-commit' into maint

"git fsck" learned to catch NUL byte in a commit object as
potential error and warn.

* jc/fsck-nul-in-commit:
  fsck: detect and warn a commit with embedded NUL
  fsck_commit_buffer(): do not special case the last validation

10 years agoMerge branch 'jk/rebase-interative-eval-fix' into maint
Junio C Hamano [Thu, 26 May 2016 20:17:24 +0000 (13:17 -0700)]
Merge branch 'jk/rebase-interative-eval-fix' into maint

Portability enhancement for "rebase -i" to help platforms whose
shell does not like "for i in <empty>" (which is not POSIX-kosher).

* jk/rebase-interative-eval-fix:
  rebase--interactive: avoid empty list in shell for-loop