gitweb.git
entry.c: create submodules when interestingStefan Beller Tue, 14 Mar 2017 21:46:40 +0000 (14:46 -0700)

entry.c: create submodules when interesting

When a submodule is introduced with a new revision
we need to create the submodule in the worktree as well.
As 'submodule_move_head' handles edge cases, all we have
to do is call it from within the function that creates
new files in the working tree for workingtree operations.

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

unpack-trees: check if we can perform the operation... Stefan Beller Tue, 14 Mar 2017 21:46:39 +0000 (14:46 -0700)

unpack-trees: check if we can perform the operation for submodules

In a later patch we'll support submodule entries to be
in sync with the tree in working tree changing commands,
such as checkout or read-tree.

When a new submodule entry changes in the tree, we need to
check if there are conflicts (directory/file conflicts)
for the tree. Add this check for submodules to be
performed before the working tree is touched.

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

unpack-trees: pass old oid to verify_clean_submoduleStefan Beller Tue, 14 Mar 2017 21:46:38 +0000 (14:46 -0700)

unpack-trees: pass old oid to verify_clean_submodule

The check (which uses the old oid) is yet to be implemented, but this part
is just a refactor, so it can go separately first.

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

update submodules: add submodule_move_headStefan Beller Tue, 14 Mar 2017 21:46:37 +0000 (14:46 -0700)

update submodules: add submodule_move_head

In later patches we introduce the options and flag for commands
that modify the working directory, e.g. git-checkout.

This piece of code will be used universally for
all these working tree modifications as it
* supports dry run to answer the question:
"Is it safe to change the submodule to this new state?"
e.g. is it overwriting untracked files or are there local
changes that would be overwritten?
* supports a force flag that can be used for resetting
the tree.

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

submodule.c: get_super_prefix_or_emptyStefan Beller Tue, 14 Mar 2017 21:46:36 +0000 (14:46 -0700)

submodule.c: get_super_prefix_or_empty

In a later patch we need to use the super_prefix, and
in case it is NULL we can just assume it is empty.
Create a helper function for this.

We already have some use cases for this helper function,
convert them, too.

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

update submodules: move up prepare_submodule_repo_envStefan Beller Tue, 14 Mar 2017 21:46:35 +0000 (14:46 -0700)

update submodules: move up prepare_submodule_repo_env

In a later patch we need to prepare the submodule environment with
another git directory, so split up the function.

Also move it up in the file such that we do not need to declare the
function later before using it.

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

submodules: introduce check to see whether to touch... Stefan Beller Tue, 14 Mar 2017 21:46:34 +0000 (14:46 -0700)

submodules: introduce check to see whether to touch a submodule

In later patches we introduce the --recurse-submodule flag for commands
that modify the working directory, e.g. git-checkout.

It is potentially expensive to check if a submodule needs an update,
because a common theme to interact with submodules is to spawn a child
process for each interaction.

So let's introduce a function that checks if a submodule needs
to be checked for an update before attempting the update.

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

update submodules: add a config option to determine... Stefan Beller Tue, 14 Mar 2017 21:46:33 +0000 (14:46 -0700)

update submodules: add a config option to determine if submodules are updated

In later patches we introduce the options and flag for commands
that modify the working directory, e.g. git-checkout.

Have a central place to store such settings whether we want to update
a submodule.

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

update submodules: add submodule config parsingStefan Beller Tue, 14 Mar 2017 21:46:32 +0000 (14:46 -0700)

update submodules: add submodule config parsing

Similar to b33a15b08 (push: add recurseSubmodules config option,
2015-11-17) and 027771fcb1 (submodule: allow erroneous values for the
fetchRecurseSubmodules option, 2015-08-17), we add submodule-config code
that is later used to parse whether we are interested in updating
submodules.

We need the `die_on_error` parameter to be able to call this parsing
function for the config file as well, which if incorrect lets Git die.

As we're just touching the header file, also mark all functions extern.

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

make is_submodule_populated gentlyStefan Beller Tue, 14 Mar 2017 21:46:31 +0000 (14:46 -0700)

make is_submodule_populated gently

We need the gentle version in a later patch. As we have just one caller,
migrate the caller.

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

lib-submodule-update.sh: define tests for recursing... Stefan Beller Tue, 14 Mar 2017 21:46:30 +0000 (14:46 -0700)

lib-submodule-update.sh: define tests for recursing into submodules

Currently lib-submodule-update.sh provides 2 functions
test_submodule_switch and test_submodule_forced_switch that are used by a
variety of tests to ensure that submodules behave as expected. The current
expected behavior is that submodules are not touched at all (see
42639d2317a for the exact setup).

In the future we want to teach all these commands to recurse
into submodules. To do that, we'll add two testing functions to
submodule-update-lib.sh: test_submodule_switch_recursing and
test_submodule_forced_switch_recursing.

These two functions behave in analogy to the already existing functions
just with a different expectation on submodule behavior. The submodule
in the working tree is expected to be updated to the recorded submodule
version. The behavior is analogous to e.g. the behavior of files in a
nested directory in the working tree, where a change to the working tree
handles any arising directory/file conflicts just fine.

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

lib-submodule-update.sh: replace sha1 by hashStefan Beller Tue, 14 Mar 2017 21:46:29 +0000 (14:46 -0700)

lib-submodule-update.sh: replace sha1 by hash

Cleaning up code by generalising it.
Currently the mailing list discusses yet again how
to migrate away from sha1.

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

lib-submodule-update: teach test_submodule_content... Stefan Beller Tue, 14 Mar 2017 21:46:28 +0000 (14:46 -0700)

lib-submodule-update: teach test_submodule_content the -C <dir> flag

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

lib-submodule-update.sh: do not use ./. as submodule... Stefan Beller Tue, 14 Mar 2017 21:46:27 +0000 (14:46 -0700)

lib-submodule-update.sh: do not use ./. as submodule remote

Adding the repository itself as a submodule does not make sense in the
real world. In our test suite we used to do that out of convenience in
some tests as the current repository has easiest access for setting up
'just a submodule'.

However this doesn't quite test the real world, so let's do not follow
this pattern any further and actually create an independent repository
that we can use as a submodule.

When using './.' as the remote the superproject and submodule share the
same objects, such that testing if a given sha1 is a valid commit works
in either repository. As running commands in an unpopulated submodule
fall back to the superproject, this happens in `reset_work_tree_to`
to determine if we need to populate the submodule. Fix this bug by
checking in the actual remote now.

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

lib-submodule-update.sh: reorder create_lib_submodule_repoStefan Beller Tue, 14 Mar 2017 21:46:26 +0000 (14:46 -0700)

lib-submodule-update.sh: reorder create_lib_submodule_repo

Redraw the ASCII art describing the setup using more space, such that
it is easier to understand. The leaf commits are now ordered the same
way the actual code is ordered.

Add empty lines to the setup code separating each of the leaf commits,
each starting with a "checkout -b".

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

submodule--helper.c: remove duplicate codeValery Tolstov Tue, 14 Mar 2017 21:46:25 +0000 (14:46 -0700)

submodule--helper.c: remove duplicate code

Remove code fragment from module_clone that duplicates functionality
of connect_work_tree_and_git_dir in dir.c

Signed-off-by: Valery Tolstov <me@vtolstov.org>
Reviewed-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

connect_work_tree_and_git_dir: safely create leading... Stefan Beller Tue, 14 Mar 2017 21:46:24 +0000 (14:46 -0700)

connect_work_tree_and_git_dir: safely create leading directories

In a later patch we'll use connect_work_tree_and_git_dir when the
directory for the gitlink file doesn't exist yet. This patch makes
connect_work_tree_and_git_dir safe to use for both cases of
either the git dir or the working dir missing.

To do so, we need to call safe_create_leading_directories[_const]
on both directories. However this has to happen before we construct
the absolute paths as real_pathdup assumes the directories to
be there already.

So for both the config file in the git dir as well as the .git link
file we need to
a) construct the name
b) call SCLD
c) get the absolute path
d) once a-c is done for both we can consume the absolute path
to compute the relative path to each other and store those
relative paths.

The implementation provided here puts a) and b) for both cases first,
and then performs c and d after.

One of the two users of 'connect_work_tree_and_git_dir' already checked
for the directory being there, so we can loose that check as
connect_work_tree_and_git_dir handles this functionality now.

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

A bit more for -rc2Junio C Hamano Wed, 15 Feb 2017 22:58:25 +0000 (14:58 -0800)

A bit more for -rc2

Merge branch 'tg/stash-doc-cleanup'Junio C Hamano Wed, 15 Feb 2017 22:56:41 +0000 (14:56 -0800)

Merge branch 'tg/stash-doc-cleanup'

The documentation explained what "git stash" does to the working
tree (after stashing away the local changes) in terms of "reset
--hard", which was exposing an unnecessary implementation detail.

* tg/stash-doc-cleanup:
Documentation/stash: remove mention of git reset --hard

Merge branch 'jk/doc-submodule-markup-fix'Junio C Hamano Wed, 15 Feb 2017 22:56:40 +0000 (14:56 -0800)

Merge branch 'jk/doc-submodule-markup-fix'

Doc markup fix.

* jk/doc-submodule-markup-fix:
docs/git-submodule: fix unbalanced quote

Merge branch 'jk/doc-remote-helpers-markup-fix'Junio C Hamano Wed, 15 Feb 2017 22:56:40 +0000 (14:56 -0800)

Merge branch 'jk/doc-remote-helpers-markup-fix'

Doc markup fix.

* jk/doc-remote-helpers-markup-fix:
docs/gitremote-helpers: fix unbalanced quotes

Merge branch 'sb/doc-unify-bottom'Junio C Hamano Wed, 15 Feb 2017 20:54:20 +0000 (12:54 -0800)

Merge branch 'sb/doc-unify-bottom'

Doc clean-up.

* sb/doc-unify-bottom:
Documentation: unify bottom "part of git suite" lines

Merge branch 'sb/push-options-via-transport'Junio C Hamano Wed, 15 Feb 2017 20:54:19 +0000 (12:54 -0800)

Merge branch 'sb/push-options-via-transport'

The push-options given via the "--push-options" option were not
passed through to external remote helpers such as "smart HTTP" that
are invoked via the transport helper.

* sb/push-options-via-transport:
push options: pass push options to the transport helper

Merge branch 'cw/completion'Junio C Hamano Wed, 15 Feb 2017 20:54:19 +0000 (12:54 -0800)

Merge branch 'cw/completion'

More command line completion (in contrib/) for recent additions.

* cw/completion:
completion: recognize more long-options
completion: teach remote subcommands to complete options
completion: teach replace to complete options
completion: teach ls-remote to complete options
completion: improve bash completion for git-add
completion: add subcommand completion for rerere
completion: teach submodule subcommands to complete options

Merge branch 'rs/swap'Junio C Hamano Wed, 15 Feb 2017 20:54:19 +0000 (12:54 -0800)

Merge branch 'rs/swap'

Code clean-up.

* rs/swap:
graph: use SWAP macro
diff: use SWAP macro
use SWAP macro
apply: use SWAP macro
add SWAP macro

Merge branch 'sb/submodule-doc'Junio C Hamano Wed, 15 Feb 2017 20:54:18 +0000 (12:54 -0800)

Merge branch 'sb/submodule-doc'

Doc updates.

* sb/submodule-doc:
submodule update documentation: don't repeat ourselves
submodule documentation: add options to the subcommand

Documentation/stash: remove mention of git reset -... Thomas Gummerer Sun, 12 Feb 2017 21:54:14 +0000 (21:54 +0000)

Documentation/stash: remove mention of git reset --hard

Don't mention git reset --hard in the documentation for git stash save.
It's an implementation detail that doesn't matter to the end user and
thus shouldn't be exposed to them. In addition it's not quite true for
git stash -p, and will not be true when a filename argument to limit the
stash to a few files is introduced.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs/git-submodule: fix unbalanced quoteJeff King Mon, 13 Feb 2017 21:05:49 +0000 (16:05 -0500)

docs/git-submodule: fix unbalanced quote

The documentation gives an example of the submodule foreach
command that uses both backticks and single-quotes. We stick
the whole thing inside "+" markers to make it monospace, but
the inside punctuation still needs escaping. We handle the
backticks with "{backtick}", and use backslash-escaping for
the single-quotes.

But we missed the escaping on the second quote. Fortunately,
asciidoc renders this unbalanced quote as we want (showing
the quote), but asciidoctor does not. We could fix it by
adding the missing backslash.

However, let's take a step back. Even when rendered
correctly, it's hard to read a long command stuck into the
middle of a paragraph, and the important punctuation is hard
to notice. Let's instead bump it into its own single-line
code block. That makes both the source and the rendered
result more readable, and as a bonus we don't have to worry
about quoting at all.

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

docs/gitremote-helpers: fix unbalanced quotesJeff King Mon, 13 Feb 2017 20:38:35 +0000 (15:38 -0500)

docs/gitremote-helpers: fix unbalanced quotes

Each of these options is missing the closing single-quote on
the option name. This understandably confuses asciidoc,
which ends up rendering a stray quote, like:

option cloning {'true|false}

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

Git 2.12-rc1 v2.12.0-rc1Junio C Hamano Fri, 10 Feb 2017 20:54:23 +0000 (12:54 -0800)

Git 2.12-rc1

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

Merge branch 'nd/rev-list-all-includes-HEAD-doc'Junio C Hamano Fri, 10 Feb 2017 20:52:27 +0000 (12:52 -0800)

Merge branch 'nd/rev-list-all-includes-HEAD-doc'

Doc update.

* nd/rev-list-all-includes-HEAD-doc:
rev-list-options.txt: update --all about HEAD

Merge branch 'rs/fill-directory-optim'Junio C Hamano Fri, 10 Feb 2017 20:52:27 +0000 (12:52 -0800)

Merge branch 'rs/fill-directory-optim'

Code clean-up.

* rs/fill-directory-optim:
dir: avoid allocation in fill_directory()

Merge branch 'jk/log-graph-name-only'Junio C Hamano Fri, 10 Feb 2017 20:52:26 +0000 (12:52 -0800)

Merge branch 'jk/log-graph-name-only'

"git log --graph" did not work well with "--name-only", even though
other forms of "diff" output were handled correctly.

* jk/log-graph-name-only:
diff: print line prefix for --name-only output

Merge branch 'da/t7800-cleanup'Junio C Hamano Fri, 10 Feb 2017 20:52:26 +0000 (12:52 -0800)

Merge branch 'da/t7800-cleanup'

Test updates.

* da/t7800-cleanup:
t7800: replace "wc -l" with test_line_count

Merge branch 'dl/difftool-doc-no-gui-option'Junio C Hamano Fri, 10 Feb 2017 20:52:26 +0000 (12:52 -0800)

Merge branch 'dl/difftool-doc-no-gui-option'

Doc update.

* dl/difftool-doc-no-gui-option:
Document the --no-gui option in difftool

Merge branch 'js/difftool-builtin'Junio C Hamano Fri, 10 Feb 2017 20:52:25 +0000 (12:52 -0800)

Merge branch 'js/difftool-builtin'

A few hot-fixes to C-rewrite of "git difftool".

* js/difftool-builtin:
t7800: simplify basic usage test
difftool: fix bug when printing usage

Merge branch 'rs/p5302-create-repositories-before-tests'Junio C Hamano Fri, 10 Feb 2017 20:52:25 +0000 (12:52 -0800)

Merge branch 'rs/p5302-create-repositories-before-tests'

Adjust a perf test to new world order where commands that do
require a repository are really strict about having a repository.

* rs/p5302-create-repositories-before-tests:
p5302: create repositories for index-pack results explicitly

Merge branch 'ps/worktree-prune-help-fix'Junio C Hamano Fri, 10 Feb 2017 20:52:25 +0000 (12:52 -0800)

Merge branch 'ps/worktree-prune-help-fix'

Incorrect usage help message for "git worktree prune" has been fixed.

* ps/worktree-prune-help-fix:
worktree: fix option descriptions for `prune`

Merge branch 'ew/complete-svn-authorship-options'Junio C Hamano Fri, 10 Feb 2017 20:52:24 +0000 (12:52 -0800)

Merge branch 'ew/complete-svn-authorship-options'

Correct command line completion (in contrib/) on "git svn"

* ew/complete-svn-authorship-options:
completion: fix git svn authorship switches

Merge branch 'jk/reset-to-break-a-commit-doc'Junio C Hamano Fri, 10 Feb 2017 20:52:23 +0000 (12:52 -0800)

Merge branch 'jk/reset-to-break-a-commit-doc'

A minor doc update.

* jk/reset-to-break-a-commit-doc:
reset: add an example of how to split a commit into two

Merge branch 'bw/push-submodule-only'Junio C Hamano Fri, 10 Feb 2017 20:52:23 +0000 (12:52 -0800)

Merge branch 'bw/push-submodule-only'

Add missing documentation update to a recent topic.

* bw/push-submodule-only:
completion: add completion for --recurse-submodules=only
doc: add doc for git-push --recurse-submodules=only

Documentation: unify bottom "part of git suite" linesStefan Beller Thu, 9 Feb 2017 01:29:30 +0000 (17:29 -0800)

Documentation: unify bottom "part of git suite" lines

We currently have 168 man pages that mention they are part of Git, you
can check yourself easily via:
$ git grep "Part of the linkgit:git\[1\] suite" |wc -l
168
However some have a trailing period, i.e.
$ git grep "Part of the linkgit:git\[1\] suite." |wc -l
8

Unify the bottom line in all man pages to not end with a period.

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

push options: pass push options to the transport helperStefan Beller Wed, 8 Feb 2017 22:04:00 +0000 (14:04 -0800)

push options: pass push options to the transport helper

When using non-builtin protocols relying on a transport helper
(such as http), push options are not propagated to the helper.

The user could ask for push options and a push would seemingly succeed,
but the push options would never be transported to the server,
misleading the users expectation.

Fix this by propagating the push options to the transport helper.

This is only addressing the first issue of
(1) the helper protocol does not propagate push-option
(2) the http helper is not prepared to handle push-option

Once we fix (2), the http transport helper can make use of push options
as well, but that happens as a follow up. (1) is a bug fix, whereas (2)
is a feature, which is why we only do (1) here.

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

diff: print line prefix for --name-only outputJeff King Wed, 8 Feb 2017 20:31:15 +0000 (15:31 -0500)

diff: print line prefix for --name-only output

If you run "git log --graph --name-only", the pathnames are
not indented to go along with their matching commits (unlike
all of the other diff formats). We need to output the line
prefix for each item before writing it.

The tests cover both --name-status and --name-only. The
former actually gets this right already, because it builds
on the --raw format functions. It's only --name-only which
uses its own code (and this fix mirrors the code in
diff_flush_raw()).

Note that the tests don't follow our usual style of setting
up the "expect" output inside the test block. This matches
the surrounding style, but more importantly it is easier to
read: we don't have to worry about embedded single-quotes,
and the leading indentation is more obvious.

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

dir: avoid allocation in fill_directory()René Scharfe Tue, 7 Feb 2017 22:04:25 +0000 (23:04 +0100)

dir: avoid allocation in fill_directory()

Pass the match member of the first pathspec item directly to
read_directory() instead of using common_prefix() to duplicate it first,
thus avoiding memory duplication, strlen(3) and free(3).

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

rev-list-options.txt: update --all about HEADNguyễn Thái Ngọc Duy Wed, 8 Feb 2017 06:06:41 +0000 (13:06 +0700)

rev-list-options.txt: update --all about HEAD

This is the document patch for f0298cf1c6 (revision walker: include a
detached HEAD in --all - 2009-01-16).

Even though that commit is about detached HEAD, as Jeff pointed out,
always adding HEAD in that case may have subtle differences with
--source or --exclude. So the document mentions nothing about the
detached-ness.

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

t7800: replace "wc -l" with test_line_countDavid Aguilar Tue, 7 Feb 2017 09:17:00 +0000 (01:17 -0800)

t7800: replace "wc -l" with test_line_count

Make t7800 easier to debug by capturing output into temporary files and
using test_line_count to make assertions on those files.

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'da/difftool-dir-diff-fix' into da/t7800... Junio C Hamano Wed, 8 Feb 2017 21:36:03 +0000 (13:36 -0800)

Merge branch 'da/difftool-dir-diff-fix' into da/t7800-cleanup

* da/difftool-dir-diff-fix:
difftool: fix dir-diff index creation when in a subdirectory

t7800: simplify basic usage testDavid Aguilar Tue, 7 Feb 2017 09:16:59 +0000 (01:16 -0800)

t7800: simplify basic usage test

Use "test_line_count" instead of "wc -l", use "git -C" instead of a
subshell, and use test_expect_code when calling difftool. Ease
debugging by capturing output into temporary files.

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

Document the --no-gui option in difftoolDenton Liu Tue, 7 Feb 2017 06:32:07 +0000 (22:32 -0800)

Document the --no-gui option in difftool

Prior to this, the `--no-gui` option was not documented in the manpage.
This commit introduces this into the manpage

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree: fix option descriptions for `prune`Patrick Steinhardt Mon, 6 Feb 2017 13:13:59 +0000 (14:13 +0100)

worktree: fix option descriptions for `prune`

The `verbose` and `expire` options of the `git worktree prune`
subcommand have wrong descriptions in that they pretend to relate to
objects. But as the git-worktree(1) correctly states, these options have
nothing to do with objects but only with worktrees. Fix the description
accordingly.

Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

p5302: create repositories for index-pack results expli... René Scharfe Sun, 5 Feb 2017 11:43:29 +0000 (12:43 +0100)

p5302: create repositories for index-pack results explicitly

Before 7176a314 (index-pack: complain when --stdin is used outside of a
repo) index-pack silently created a non-existing target directory; now
the command refuses to work unless it's used against a valid repository.
That causes p5302 to fail, which relies on the former behavior. Fix it
by setting up the destinations for its performance tests using git init.

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

completion: fix git svn authorship switchesEric Wong Sun, 5 Feb 2017 02:18:57 +0000 (02:18 +0000)

completion: fix git svn authorship switches

--add-author-from and --use-log-author are for "git svn dcommit",
not "git svn (init|clone)"

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

difftool: fix bug when printing usageDavid Aguilar Sun, 5 Feb 2017 21:23:38 +0000 (13:23 -0800)

difftool: fix bug when printing usage

"git difftool -h" reports an error:

fatal: BUG: setup_git_env called without repository

Defer repository setup so that the help option processing happens before
the repository is initialized.

Add tests to ensure that the basic usage works inside and outside of a
repository.

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

reset: add an example of how to split a commit into twoJacob Keller Fri, 3 Feb 2017 20:28:33 +0000 (12:28 -0800)

reset: add an example of how to split a commit into two

It is often useful to break a commit into multiple parts that are more
logical separations. This can be tricky to learn how to do without the
brute-force method if re-writing code or commit messages from scratch.

Add a section to the git-reset documentation which shows an example
process for how to use git add -p and git commit -c HEAD@{1} to
interactively break a commit apart and re-use the original commit
message as a starting point when making the new commit message.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: recognize more long-optionsCornelius Weig Fri, 3 Feb 2017 11:01:59 +0000 (12:01 +0100)

completion: recognize more long-options

Command completion only recognizes a subset of the available options for
the various git commands. The set of recognized options needs to balance
between having all useful options and to not clutter the terminal.

This commit adds all long-options that are mentioned in the man-page
synopsis of the respective git command. Possibly dangerous options are
not included in this set, to avoid accidental data loss. The added
options are:

- apply: --recount --directory=
- archive: --output
- branch: --column --no-column --sort= --points-at
- clone: --no-single-branch --shallow-submodules
- commit: --patch --short --date --allow-empty
- describe: --first-parent
- fetch, pull: --unshallow --update-shallow
- fsck: --name-objects
- grep: --break --heading --show-function --function-context
--untracked --no-index
- mergetool: --prompt --no-prompt
- reset: --keep
- revert: --strategy= --strategy-option=
- shortlog: --email
- tag: --merged --no-merged --create-reflog

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: teach remote subcommands to complete optionsCornelius Weig Fri, 3 Feb 2017 11:01:58 +0000 (12:01 +0100)

completion: teach remote subcommands to complete options

Git-remote needs to complete remote names, its subcommands, and options
thereof. In addition to the existing subcommand and remote name
completion, do also complete the options

- add: --track --master --fetch --tags --no-tags --mirror=
- set-url: --push --add --delete
- get-url: --push --all
- prune: --dry-run

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: teach replace to complete optionsCornelius Weig Fri, 3 Feb 2017 11:01:57 +0000 (12:01 +0100)

completion: teach replace to complete options

Git-replace needs to complete references and its own options. In
addition to the existing references completions, do also complete the
options --edit --graft --format= --list --delete.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: teach ls-remote to complete optionsCornelius Weig Fri, 3 Feb 2017 11:01:56 +0000 (12:01 +0100)

completion: teach ls-remote to complete options

ls-remote needs to complete remote names and its own options. In
addition to the existing remote name completions, do also complete
the options --heads, --tags, --refs, --get-url, and --symref.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: improve bash completion for git-addCornelius Weig Fri, 3 Feb 2017 11:01:55 +0000 (12:01 +0100)

completion: improve bash completion for git-add

Command completion for git-add did not recognize some long-options.
This commits adds completion for all long-options that are mentioned in
the man-page synopsis. In addition, if the user specified `--update` or
`-u`, path completion will only suggest modified tracked files.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: add subcommand completion for rerereCornelius Weig Fri, 3 Feb 2017 11:01:54 +0000 (12:01 +0100)

completion: add subcommand completion for rerere

Managing recorded resolutions requires command-line usage of git-rerere.
Added subcommand completion for rerere and path completion for its
subcommand forget.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: teach submodule subcommands to complete... Cornelius Weig Fri, 3 Feb 2017 11:01:53 +0000 (12:01 +0100)

completion: teach submodule subcommands to complete options

Each submodule subcommand has specific long-options. Therefore, teach
bash completion to support option completion based on the current
subcommand. All long-options that are mentioned in the man-page synopsis
are added.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.12-rc0 v2.12.0-rc0Junio C Hamano Fri, 3 Feb 2017 19:29:52 +0000 (11:29 -0800)

Git 2.12-rc0

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

Merge branch 'cw/log-updates-for-all-refs-really'Junio C Hamano Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)

Merge branch 'cw/log-updates-for-all-refs-really'

The "core.logAllRefUpdates" that used to be boolean has been
enhanced to take 'always' as well, to record ref updates to refs
other than the ones that are expected to be updated (i.e. branches,
remote-tracking branches and notes).

* cw/log-updates-for-all-refs-really:
doc: add note about ignoring '--no-create-reflog'
update-ref: add test cases for bare repository
refs: add option core.logAllRefUpdates = always
config: add markup to core.logAllRefUpdates doc

Merge branch 'pl/complete-diff-submodule-diff'Junio C Hamano Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)

Merge branch 'pl/complete-diff-submodule-diff'

The command line completion (in contrib/) learned that
"git diff --submodule=" can take "diff" as a recently added option.

* pl/complete-diff-submodule-diff:
Completion: Add support for --submodule=diff

Merge branch 'rs/object-id'Junio C Hamano Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)

Merge branch 'rs/object-id'

"uchar [40]" to "struct object_id" conversion continues.

* rs/object-id:
checkout: convert post_checkout_hook() to struct object_id
use oidcpy() for copying hashes between instances of struct object_id
use oid_to_hex_r() for converting struct object_id hashes to hex strings

Merge branch 'js/re-running-failed-tests'Junio C Hamano Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)

Merge branch 'js/re-running-failed-tests'

"make -C t failed" will now run only the tests that failed in the
previous run. This is usable only when prove is not use, and gives
a useless error message when run after "make clean", but otherwise
is serviceable.

* js/re-running-failed-tests:
t/Makefile: add a rule to re-run previously-failed tests

Merge branch 'sb/submodule-update-initial-runs-custom... Junio C Hamano Fri, 3 Feb 2017 19:25:19 +0000 (11:25 -0800)

Merge branch 'sb/submodule-update-initial-runs-custom-script'

The user can specify a custom update method that is run when
"submodule update" updates an already checked out submodule. This
was ignored when checking the submodule out for the first time and
we instead always just checked out the commit that is bound to the
path in the superproject's index.

* sb/submodule-update-initial-runs-custom-script:
submodule update: run custom update script for initial populating as well

Merge branch 'sb/submodule-recursive-absorb'Junio C Hamano Fri, 3 Feb 2017 19:25:18 +0000 (11:25 -0800)

Merge branch 'sb/submodule-recursive-absorb'

When a submodule "A", which has another submodule "B" nested within
it, is "absorbed" into the top-level superproject, the inner
submodule "B" used to be left in a strange state. The logic to
adjust the .git pointers in these submodules has been corrected.

* sb/submodule-recursive-absorb:
submodule absorbing: fix worktree/gitdir pointers recursively for non-moves
cache.h: expose the dying procedure for reading gitlinks
setup: add gentle version of resolve_git_dir

Merge branch 'sb/unpack-trees-super-prefix'Junio C Hamano Fri, 3 Feb 2017 19:25:18 +0000 (11:25 -0800)

Merge branch 'sb/unpack-trees-super-prefix'

"git read-tree" and its underlying unpack_trees() machinery learned
to report problematic paths prefixed with the --super-prefix option.

* sb/unpack-trees-super-prefix:
unpack-trees: support super-prefix option
t1001: modernize style
t1000: modernize style
read-tree: use OPT_BOOL instead of OPT_SET_INT

Sync with v2.11.1Junio C Hamano Thu, 2 Feb 2017 21:43:19 +0000 (13:43 -0800)

Sync with v2.11.1

* maint:
Git 2.11.1

Ninth batch for 2.12; almost ready for -rc0Junio C Hamano Thu, 2 Feb 2017 21:43:10 +0000 (13:43 -0800)

Ninth batch for 2.12; almost ready for -rc0

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

Merge branch 'nd/log-graph-configurable-colors'Junio C Hamano Thu, 2 Feb 2017 21:36:58 +0000 (13:36 -0800)

Merge branch 'nd/log-graph-configurable-colors'

Some people feel the default set of colors used by "git log --graph"
rather limiting. A mechanism to customize the set of colors has
been introduced.

* nd/log-graph-configurable-colors:
document behavior of empty color name
color_parse_mem: allow empty color spec
log --graph: customize the graph lines with config log.graphColors
color.c: trim leading spaces in color_parse_mem()
color.c: fix color_parse_mem() with value_len == 0

Merge branch 'ep/commit-static-buf-cleanup'Junio C Hamano Thu, 2 Feb 2017 21:36:57 +0000 (13:36 -0800)

Merge branch 'ep/commit-static-buf-cleanup'

Code clean-up.

* ep/commit-static-buf-cleanup:
builtin/commit.c: switch to strbuf, instead of snprintf()
builtin/commit.c: remove the PATH_MAX limitation via dynamic allocation

Merge branch 'bc/use-asciidoctor-opt'Junio C Hamano Thu, 2 Feb 2017 21:36:57 +0000 (13:36 -0800)

Merge branch 'bc/use-asciidoctor-opt'

Asciidoctor, an alternative reimplementation of AsciiDoc, still
needs some changes to work with documents meant to be formatted
with AsciiDoc. "make USE_ASCIIDOCTOR=YesPlease" to use it out of
the box to document our pages is getting closer to reality.

* bc/use-asciidoctor-opt:
Documentation: implement linkgit macro for Asciidoctor
Makefile: add a knob to enable the use of Asciidoctor
Documentation: move dblatex arguments into variable
Documentation: add XSLT to fix DocBook for Texinfo
Documentation: sort sources for gitman.texi
Documentation: remove unneeded argument in cat-texi.perl
Documentation: modernize cat-texi.perl
Documentation: fix warning in cat-texi.perl

Merge branch 'sg/mailmap-self'Junio C Hamano Thu, 2 Feb 2017 21:36:57 +0000 (13:36 -0800)

Merge branch 'sg/mailmap-self'

* sg/mailmap-self:
.mailmap: update Gábor Szeder's email address

Merge branch 'js/mingw-hooks-with-exe-suffix'Junio C Hamano Thu, 2 Feb 2017 21:36:57 +0000 (13:36 -0800)

Merge branch 'js/mingw-hooks-with-exe-suffix'

Names of the various hook scripts must be spelled exactly, but on
Windows, an .exe binary must be named with .exe suffix; notice
$GIT_DIR/hooks/<hookname>.exe as a valid <hookname> hook.

* js/mingw-hooks-with-exe-suffix:
mingw: allow hooks to be .exe files

Merge branch 'rs/receive-pack-cleanup'Junio C Hamano Thu, 2 Feb 2017 21:36:56 +0000 (13:36 -0800)

Merge branch 'rs/receive-pack-cleanup'

Code clean-up.

* rs/receive-pack-cleanup:
receive-pack: call string_list_clear() unconditionally

Merge branch 'mm/reset-facl-before-umask-test'Junio C Hamano Thu, 2 Feb 2017 21:36:56 +0000 (13:36 -0800)

Merge branch 'mm/reset-facl-before-umask-test'

Test tweaks for those who have default ACL in their git source tree
that interfere with the umask test.

* mm/reset-facl-before-umask-test:
t0001: don't let a default ACL interfere with the umask test

Merge branch 'hv/mingw-help-is-executable'Junio C Hamano Thu, 2 Feb 2017 21:36:55 +0000 (13:36 -0800)

Merge branch 'hv/mingw-help-is-executable'

"git help" enumerates executable files in $PATH; the implementation
of "is this file executable?" on Windows has been optimized.

* hv/mingw-help-is-executable:
help: improve is_executable() on Windows

Merge branch 'gv/mingw-p4-mapuser'Junio C Hamano Thu, 2 Feb 2017 21:36:55 +0000 (13:36 -0800)

Merge branch 'gv/mingw-p4-mapuser'

"git p4" did not work well with multiple git-p4.mapUser entries on
Windows.

* gv/mingw-p4-mapuser:
git-p4: fix git-p4.mapUser on Windows

Merge branch 'rs/absolute-pathdup'Junio C Hamano Thu, 2 Feb 2017 21:36:55 +0000 (13:36 -0800)

Merge branch 'rs/absolute-pathdup'

Code cleanup.

* rs/absolute-pathdup:
use absolute_pathdup()
abspath: add absolute_pathdup()

Merge branch 'js/unzip-in-usr-bin-workaround'Junio C Hamano Thu, 2 Feb 2017 21:36:55 +0000 (13:36 -0800)

Merge branch 'js/unzip-in-usr-bin-workaround'

Test tweak for FreeBSD where /usr/bin/unzip is unsuitable to run
our tests but /usr/local/bin/unzip is usable.

* js/unzip-in-usr-bin-workaround:
test-lib: on FreeBSD, look for unzip(1) in /usr/local/bin/

Merge branch 'cw/doc-sign-off'Junio C Hamano Thu, 2 Feb 2017 21:36:54 +0000 (13:36 -0800)

Merge branch 'cw/doc-sign-off'

Doc update.

* cw/doc-sign-off:
doc: clarify distinction between sign-off and pgp-signing

Merge branch 'js/status-pre-rebase-i'Junio C Hamano Thu, 2 Feb 2017 21:36:54 +0000 (13:36 -0800)

Merge branch 'js/status-pre-rebase-i'

After starting "git rebase -i", which first opens the user's editor
to edit the series of patches to apply, but before saving the
contents of that file, "git status" failed to show the current
state (i.e. you are in an interactive rebase session, but you have
applied no steps yet) correctly.

* js/status-pre-rebase-i:
status: be prepared for not-yet-started interactive rebase

Merge branch 'js/retire-relink'Junio C Hamano Thu, 2 Feb 2017 21:36:54 +0000 (13:36 -0800)

Merge branch 'js/retire-relink'

Cruft removal.

* js/retire-relink:
relink: really remove the command
relink: retire the command

Merge branch 'sb/submodule-add-force'Junio C Hamano Thu, 2 Feb 2017 21:36:54 +0000 (13:36 -0800)

Merge branch 'sb/submodule-add-force'

"git submodule add" used to be confused and refused to add a
locally created repository; users can now use "--force" option
to add them.

* sb/submodule-add-force:
submodule add: extend force flag to add existing repos

Git 2.11.1 v2.11.1Junio C Hamano Thu, 2 Feb 2017 21:21:27 +0000 (13:21 -0800)

Git 2.11.1

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

Merge branch 'ws/request-pull-code-cleanup' into maintJunio C Hamano Thu, 2 Feb 2017 21:20:30 +0000 (13:20 -0800)

Merge branch 'ws/request-pull-code-cleanup' into maint

Code clean-up.

* ws/request-pull-code-cleanup:
request-pull: drop old USAGE stuff

Merge branch 'jk/execv-dashed-external' into maintJunio C Hamano Thu, 2 Feb 2017 21:20:29 +0000 (13:20 -0800)

Merge branch 'jk/execv-dashed-external' into maint

Typing ^C to pager, which usually does not kill it, killed Git and
took the pager down as a collateral damage in certain process-tree
structure. This has been fixed.

* jk/execv-dashed-external:
execv_dashed_external: wait for child on signal death
execv_dashed_external: stop exiting with negative code
execv_dashed_external: use child_process struct

document behavior of empty color nameJeff King Thu, 2 Feb 2017 12:42:44 +0000 (13:42 +0100)

document behavior of empty color name

Commit 55cccf4bb (color_parse_mem: allow empty color spec,
2017-02-01) clearly defined the behavior of an empty color
config variable. Let's document that, and give a hint about
why it might be useful.

It's important not to say that it makes the item uncolored,
because it doesn't. It just sets no attributes, which means
that any previous attributes continue to take effect.

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

doc: add note about ignoring '--no-create-reflog'Cornelius Weig Wed, 1 Feb 2017 22:07:27 +0000 (23:07 +0100)

doc: add note about ignoring '--no-create-reflog'

The commands git-branch and git-tag accept the '--create-reflog'
option, and create reflog even when core.logallrefupdates
configuration is explicitly set not to.

On the other hand, the negated form '--no-create-reflog' is accepted
as a valid option but has no effect (other than overriding an
earlier '--create-reflog' on the command line). This silent noop may
puzzle users. To communicate that this is a known limitation, add a
short note in the manuals for git-branch and git-tag.

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

completion: add completion for --recurse-submodules... Cornelius Weig Wed, 1 Feb 2017 23:07:53 +0000 (00:07 +0100)

completion: add completion for --recurse-submodules=only

Command completion for 'git-push --recurse-submodules' already knows to
complete some modes. However, the recently added mode 'only' is missing.

Adding 'only' to the recognized modes completes the list of non-trivial
modes.

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: add doc for git-push --recurse-submodules=onlyCornelius Weig Wed, 1 Feb 2017 23:07:52 +0000 (00:07 +0100)

doc: add doc for git-push --recurse-submodules=only

Add documentation for the `--recurse-submodules=only` option of
git-push. The feature was added in commit 225e8bf (add option to
push only submodules).

Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

color_parse_mem: allow empty color specJeff King Wed, 1 Feb 2017 00:21:29 +0000 (01:21 +0100)

color_parse_mem: allow empty color spec

Prior to c2f41bf52 (color.c: fix color_parse_mem() with
value_len == 0, 2017-01-19), the empty string was
interpreted as a color "reset". This was an accidental
outcome, and that commit turned it into an error.

However, scripts may pass the empty string as a default
value to "git config --get-color" to disable color when the
value is not defined. The git-add--interactive script does
this. As a result, the script is unusable since c2f41bf52
unless you have color.diff.plain defined (if it is defined,
then we don't parse the empty default at all).

Our test scripts didn't notice the recent breakage because
they run without a terminal, and thus without color. They
never hit this code path at all. And nobody noticed the
original buggy "reset" behavior, because it was effectively
a noop.

Let's fix the code to have an empty color name produce an
empty sequence of color codes. The tests need a few fixups:

- we'll add a new test in t4026 to cover this case. But
note that we need to tweak the color() helper. While
we're there, let's factor out the literal ANSI ESC
character. Otherwise it makes the diff quite hard to
read.

- we'll add a basic sanity-check in t4026 that "git add
-p" works at all when color is enabled. That would have
caught this bug, as well as any others that are specific
to the color code paths.

- 73c727d69 (log --graph: customize the graph lines with
config log.graphColors, 2017-01-19) added a test to
t4202 that checks some "invalid" graph color config.
Since ",, blue" before yielded only "blue" as valid, and
now yields "empty, empty, blue", we don't match the
expected output.

One way to fix this would be to change the expectation
to the empty color strings. But that makes the test much
less interesting, since we show only two graph lines,
both of which would be colorless.

Since the empty-string case is now covered by t4026,
let's remove them entirely here. They're just in the way
of the primary thing the test is supposed to be
checking.

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

.mailmap: update Gábor Szeder's email addressSZEDER Gábor Tue, 31 Jan 2017 18:42:12 +0000 (19:42 +0100)

.mailmap: update Gábor Szeder's email address

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

Sync with maintJunio C Hamano Tue, 31 Jan 2017 21:34:59 +0000 (13:34 -0800)

Sync with maint

* maint:
Ready for 2.11.1

Ready for 2.11.1Junio C Hamano Tue, 31 Jan 2017 21:34:48 +0000 (13:34 -0800)

Ready for 2.11.1

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

Merge branch 'sb/in-core-index-doc' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:11 +0000 (13:32 -0800)

Merge branch 'sb/in-core-index-doc' into maint

Documentation and in-code comments updates.

* sb/in-core-index-doc:
documentation: retire unfinished documentation
cache.h: document add_[file_]to_index
cache.h: document remove_index_entry_at
cache.h: document index_name_pos

Merge branch 'js/mingw-isatty' into maintJunio C Hamano Tue, 31 Jan 2017 21:32:11 +0000 (13:32 -0800)

Merge branch 'js/mingw-isatty' into maint

An update to a topic that is already in 'master'.

* js/mingw-isatty:
mingw: follow-up to "replace isatty() hack"