gitweb.git
ref-filter: add --no-contains option to tag/branch... Ævar Arnfjörð Bjarmason Fri, 24 Mar 2017 18:40:57 +0000 (18:40 +0000)

ref-filter: add --no-contains option to tag/branch/for-each-ref

Change the tag, branch & for-each-ref commands to have a --no-contains
option in addition to their longstanding --contains options.

This allows for finding the last-good rollout tag given a known-bad
<commit>. Given a hypothetically bad commit cf5c7253e0, the git
version to revert to can be found with this hacky two-liner:

(git tag -l 'v[0-9]*'; git tag -l --contains cf5c7253e0 'v[0-9]*') |
sort | uniq -c | grep -E '^ *1 ' | awk '{print $2}' | tail -n 10

With this new --no-contains option the same can be achieved with:

git tag -l --no-contains cf5c7253e0 'v[0-9]*' | sort | tail -n 10

As the filtering machinery is shared between the tag, branch &
for-each-ref commands, implement this for those commands too. A
practical use for this with "branch" is e.g. finding branches which
were branched off between v2.8.0 and v2.10.0:

git branch --contains v2.8.0 --no-contains v2.10.0

The "describe" command also has a --contains option, but its semantics
are unrelated to what tag/branch/for-each-ref use --contains for. A
--no-contains option for "describe" wouldn't make any sense, other
than being exactly equivalent to not supplying --contains at all,
which would be confusing at best.

Add a --without option to "tag" as an alias for --no-contains, for
consistency with --with and --contains. The --with option is
undocumented, and possibly the only user of it is
Junio (<xmqqefy71iej.fsf@gitster.mtv.corp.google.com>). But it's
trivial to support, so let's do that.

The additions to the the test suite are inverse copies of the
corresponding --contains tests. With this change --no-contains for
tag, branch & for-each-ref is just as well tested as the existing
--contains option.

In addition to those tests, add a test for "tag" which asserts that
--no-contains won't find tree/blob tags, which is slightly
unintuitive, but consistent with how --contains works & is documented.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag: change --point-at to default to HEADÆvar Arnfjörð Bjarmason Fri, 24 Mar 2017 18:40:56 +0000 (18:40 +0000)

tag: change --point-at to default to HEAD

Change the --points-at option to default to HEAD for consistency with
its siblings --contains, --merged etc. which default to
HEAD. Previously we'd get:

$ git tag --points-at 2>&1 | head -n 1
error: option `points-at' requires a value

This changes behavior added in commit ae7706b9ac (tag: add --points-at
list option, 2012-02-08).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag: implicitly supply --list given another list-like... Ævar Arnfjörð Bjarmason Fri, 24 Mar 2017 18:40:55 +0000 (18:40 +0000)

tag: implicitly supply --list given another list-like option

Change the "tag" command to implicitly turn on its --list mode when
provided with a list-like option such as --contains, --points-at etc.

This is for consistency with how "branch" works. When "branch" is
given a list-like option, such as --contains, it implicitly provides
--list. Before this change "tag" would error out on those sorts of
invocations. I.e. while both of these worked for "branch":

git branch --contains v2.8.0 <pattern>
git branch --list --contains v2.8.0 <pattern>

Only the latter form worked for "tag":

git tag --contains v2.8.0 '*rc*'
git tag --list --contains v2.8.0 '*rc*'

Now "tag", like "branch", will implicitly supply --list when a
list-like option is provided, and no other conflicting non-list
options (such as -d) are present on the command-line.

Spelunking through the history via:

git log --reverse -p -G'only allowed with' -- '*builtin*tag*c'

Reveals that there was no good reason for not allowing this in the
first place. The --contains option added in 32c35cfb1e ("git-tag: Add
--contains option", 2009-01-26) made this an error. All the other
subsequent list-like options that were added copied its pattern of
making this usage an error.

The only tests that break as a result of this change are tests that
were explicitly checking that this "branch-like" usage wasn't
permitted. Change those failing tests to check that this invocation
mode is permitted, add extra tests for the list-like options we
weren't testing, and tests to ensure that e.g. we don't toggle the
list mode in the presence of other conflicting non-list options.

With this change errors messages such as "--contains option is only
allowed with -l" don't make sense anymore, since options like
--contain turn on -l. Instead we error out when list-like options such
as --contain are used in conjunction with conflicting options such as
-d or -v.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag: change misleading --list <pattern> documentationÆvar Arnfjörð Bjarmason Fri, 24 Mar 2017 18:40:54 +0000 (18:40 +0000)

tag: change misleading --list <pattern> documentation

Change the documentation for --list so that it's described as a
toggle, not as an option that takes a <pattern> as an argument.

Junio initially documented this in b867c7c23a ("git-tag: -l to list
tags (usability).", 2006-02-17), but later Jeff King changed "tag" to
accept multiple patterns in 588d0e834b ("tag: accept multiple patterns
for --list", 2011-06-20).

However, documenting this as "-l <pattern>" was never correct, as
these both worked before Jeff's change:

git tag -l 'v*'
git tag 'v*' -l

One would expect an option that was documented like that to only
accept:

git tag --list
git tag --list 'v*rc*'

And after Jeff's change, one that took multiple patterns:

git tag --list 'v*rc*' --list '*2.8*'

But since it's actually a toggle all of these work as well, and
produce identical output to the last example above:

git tag --list 'v*rc*' '*2.8*'
git tag --list 'v*rc*' '*2.8*' --list --list --list
git tag --list 'v*rc*' '*2.8*' --list -l --list -l --list

Now the documentation is more in tune with how the "branch" command
describes its --list option since commit cddd127b9a ("branch:
introduce --list option", 2011-08-28).

Change the test suite to assert that these invocations work for the
cases that weren't already being tested for.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

parse-options: add OPT_NONEG to the "contains" optionÆvar Arnfjörð Bjarmason Fri, 24 Mar 2017 18:40:53 +0000 (18:40 +0000)

parse-options: add OPT_NONEG to the "contains" option

Add the OPT_NONEG flag to the "contains" option and its hidden synonym
"with". Since this was added in commit 694a577519 ("git-branch
--contains=commit", 2007-11-07) giving --no-{contains,with} hasn't
been an error, but has emitted the help output since
filter.with_commit wouldn't get set.

Now git will emit "error: unknown option `no-{contains,with}'" at the
top of the help output.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag: add more incompatibles mode testsÆvar Arnfjörð Bjarmason Fri, 24 Mar 2017 18:40:52 +0000 (18:40 +0000)

tag: add more incompatibles mode tests

Amend the test suite to test for more invalid uses like "-l -a"
etc.

This change tests the code path in builtin/tag.c between lines:

if (argc == 0 && !cmdmode)

And:

if ((create_tag_object || force) && (cmdmode != 0))

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

for-each-ref: partly change <object> to <commit> in... Ævar Arnfjörð Bjarmason Thu, 23 Mar 2017 13:05:21 +0000 (13:05 +0000)

for-each-ref: partly change <object> to <commit> in help

Change mentions of <object> to <commit> in the help output of
for-each-ref as appropriate.

Both --[no-]merged and --contains only take commits, but --points-at
can take any object, such as a tag pointing to a tree or blob.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag tests: fix a typo in a test descriptionÆvar Arnfjörð Bjarmason Thu, 23 Mar 2017 13:05:20 +0000 (13:05 +0000)

tag tests: fix a typo in a test description

Change "suceed" to "succeed" in a test description. The typo has been
here since the code was originally added in commit ef5a6fb597 ("Add
test-script for git-tag", 2007-06-28).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag: remove a TODO item from the test suiteÆvar Arnfjörð Bjarmason Thu, 23 Mar 2017 13:05:19 +0000 (13:05 +0000)

tag: remove a TODO item from the test suite

Change the test for "git tag -l" to not have an associated TODO
comment saying that it should return non-zero if there's no tags.

This was added in commit ef5a6fb597 ("Add test-script for git-tag",
2007-06-28) when the tests for "tag" were initially added, but at this
point changing this would be inconsistent with how "git tag" is a
synonym for "git tag -l", and would needlessly break external code
that relies on this porcelain command.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: add test for --contains on a non-commitÆvar Arnfjörð Bjarmason Thu, 23 Mar 2017 13:05:18 +0000 (13:05 +0000)

ref-filter: add test for --contains on a non-commit

Change the tag test suite to test for --contains on a tree & blob. It
only accepts commits and will spew out "<object> is a tree, not a
commit".

It's sufficient to test this just for the "tag" and "branch" commands,
because it covers all the machinery shared between "branch" and
"for-each-ref".

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: make combining --merged & --no-merged an... Ævar Arnfjörð Bjarmason Tue, 21 Mar 2017 12:58:49 +0000 (12:58 +0000)

ref-filter: make combining --merged & --no-merged an error

Change the behavior of specifying --merged & --no-merged to be an
error, instead of silently picking the option that was provided last.

Subsequent changes of mine add a --no-contains option in addition to
the existing --contains. Providing both of those isn't an error, and
has actual meaning.

Making its cousins have different behavior in this regard would be
confusing to the user, especially since we'd be silently disregarding
some of their command-line input.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag doc: reword --[no-]merged to talk about commits... Ævar Arnfjörð Bjarmason Tue, 21 Mar 2017 12:58:48 +0000 (12:58 +0000)

tag doc: reword --[no-]merged to talk about commits, not tips

Change the wording for the --merged and --no-merged options to talk
about "commits" instead of "tips".

This phrasing was copied from the "branch" documentation in commit
5242860f54 ("tag.c: implement '--merged' and '--no-merged' options",
2015-09-10). Talking about the "tip" is branch nomenclature, not
something usually associated with tags.

This phrasing might lead the reader to believe that these options
might find tags pointing to trees or blobs, let's instead be explicit
and only talk about commits.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag doc: split up the --[no-]merged documentationÆvar Arnfjörð Bjarmason Tue, 21 Mar 2017 12:58:47 +0000 (12:58 +0000)

tag doc: split up the --[no-]merged documentation

Split up the --[no-]merged documentation into documentation that
documents each option independently. This is in line with how "branch"
and "for-each-ref" are documented, and makes subsequent changes to
discuss the limits & caveats of each option easier to read.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag doc: move the description of --[no-]merged earlierÆvar Arnfjörð Bjarmason Tue, 21 Mar 2017 12:58:46 +0000 (12:58 +0000)

tag doc: move the description of --[no-]merged earlier

Move the documentation for the --merged & --no-merged options earlier
in the documentation, to sit along the other switches, and right next
to the similar --contains and --points-at switches.

It makes more sense to group the options together, not have some
options after the like of <tagname>, <object>, <format> etc.

This was originally put there when the --merged & --no-merged options
were introduced in 5242860f54 ("tag.c: implement '--merged' and
'--no-merged' options", 2015-09-10). It's not apparent from that
commit that the documentation is being placed apart from other
options, rather than along with them, so this was likely missed in the
initial review.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: use separate cache for contains_tag_algoJeff King Thu, 9 Mar 2017 13:29:49 +0000 (08:29 -0500)

ref-filter: use separate cache for contains_tag_algo

The algorithm which powers "tag --contains" uses the
TMP_MARK and UNINTERESTING bits, but never cleans up after
itself. As a result, stale UNINTERESTING bits may impact
later traversals (like "--merged").

We could fix this by clearing the bits after we're done with
the --contains traversal. That would be enough to fix the
existing problem, but it leaves future developers in a bad
spot: they cannot add other traversals that operate
simultaneously with --contains (e.g., if you wanted to add
"--no-contains" and use both filters at the same time).

Instead, we can use a commit slab to store our cached
results, which will store the bits outside of the commit
structs entirely. This adds an extra level of indirection,
but in my tests (running "git tag --contains HEAD" on
linux.git), there was no measurable slowdown.

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

ref-filter: die on parse_commit errorsJeff King Thu, 9 Mar 2017 13:29:04 +0000 (08:29 -0500)

ref-filter: die on parse_commit errors

The tag-contains algorithm quietly returns "does not
contain" when parse_commit() fails. But a parse failure is
an indication that the repository is corrupt. We should die
loudly rather than producing a bogus result.

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

ref-filter: use contains_result enum consistentlyJeff King Thu, 9 Mar 2017 13:28:48 +0000 (08:28 -0500)

ref-filter: use contains_result enum consistently

Commit cbc60b672 (git tag --contains: avoid stack overflow,
2014-04-24) adapted the -1/0/1 contains status into a
tri-state enum. However, some of the code still used the
numeric values, or assumed that no/yes correspond to C's
boolean true/false.

Let's switch to using the symbolic values everywhere, which
will make it easier to change them.

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

ref-filter: move ref_cbdata definition into ref-filter.cJeff King Thu, 9 Mar 2017 13:27:55 +0000 (08:27 -0500)

ref-filter: move ref_cbdata definition into ref-filter.c

This is an implementation detail of how filter_refs() works,
and does not need to be exposed to the outside world. This
will become more important in future patches as we add new
private data types to it.

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

git svn: fix authentication with 'branch'Hiroshi Shirosaki Mon, 6 Mar 2017 05:59:07 +0000 (14:59 +0900)

git svn: fix authentication with 'branch'

Authentication fails with svn branch while svn rebase and
svn dcommit work fine without authentication failures.

$ git svn branch v7_3
Copying https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx at r27519
to https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/v7_3...
Can't create session: Unable to connect to a repository at URL
'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': No more
credentials or we tried too many times.
Authentication failed at
C:\Program Files\Git\mingw64/libexec/git-core\git-svn line 1200.

We add auth configuration to SVN::Client->new() to fix the issue.

Signed-off-by: Hiroshi Shirosaki <h.shirosaki@gmail.com>
Signed-off-by: Eric Wong <e@80x24.org>

First batch after 2.12Junio C Hamano Mon, 27 Feb 2017 22:04:24 +0000 (14:04 -0800)

First batch after 2.12

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

Merge branch 'rl/remote-allow-missing-branch-name-merge'Junio C Hamano Mon, 27 Feb 2017 21:57:18 +0000 (13:57 -0800)

Merge branch 'rl/remote-allow-missing-branch-name-merge'

"git remote rm X", when a branch has remote X configured as the
value of its branch.*.remote, tried to remove branch.*.remote and
branch.*.merge and failed if either is unset.

* rl/remote-allow-missing-branch-name-merge:
remote: ignore failure to remove missing branch.<name>.merge

Merge branch 'km/delete-ref-reflog-message'Junio C Hamano Mon, 27 Feb 2017 21:57:18 +0000 (13:57 -0800)

Merge branch 'km/delete-ref-reflog-message'

"git update-ref -d" and other operations to delete references did
not leave any entry in HEAD's reflog when the reference being
deleted was the current branch. This is not a problem in practice
because you do not want to delete the branch you are currently on,
but caused renaming of the current branch to something else not to
be logged in a useful way.

* km/delete-ref-reflog-message:
branch: record creation of renamed branch in HEAD's log
rename_ref: replace empty message in HEAD's log
update-ref: pass reflog message to delete_ref()
delete_ref: accept a reflog message argument

Merge branch 'jk/tempfile-ferror-fclose-confusion'Junio C Hamano Mon, 27 Feb 2017 21:57:18 +0000 (13:57 -0800)

Merge branch 'jk/tempfile-ferror-fclose-confusion'

A caller of tempfile API that uses stdio interface to write to
files may ignore errors while writing, which is detected when
tempfile is closed (with a call to ferror()). By that time, the
original errno that may have told us what went wrong is likely to
be long gone and was overwritten by an irrelevant value.
close_tempfile() now resets errno to EIO to make errno at least
predictable.

* jk/tempfile-ferror-fclose-confusion:
tempfile: set errno to a known value before calling ferror()

Merge branch 'vn/xdiff-func-context'Junio C Hamano Mon, 27 Feb 2017 21:57:17 +0000 (13:57 -0800)

Merge branch 'vn/xdiff-func-context'

"git diff -W" has been taught to handle the case where a new
function is added at the end of the file better.

* vn/xdiff-func-context:
xdiff -W: relax end-of-file function detection

Merge branch 'js/git-path-in-subdir'Junio C Hamano Mon, 27 Feb 2017 21:57:17 +0000 (13:57 -0800)

Merge branch 'js/git-path-in-subdir'

The "--git-path", "--git-common-dir", and "--shared-index-path"
options of "git rev-parse" did not produce usable output. They are
now updated to show the path to the correct file, relative to where
the caller is.

* js/git-path-in-subdir:
rev-parse: fix several options when running in a subdirectory
rev-parse tests: add tests executed from a subdirectory

Merge branch 'mm/two-more-xstrfmt'Junio C Hamano Mon, 27 Feb 2017 21:57:17 +0000 (13:57 -0800)

Merge branch 'mm/two-more-xstrfmt'

Code clean-up and a string truncation fix.

* mm/two-more-xstrfmt:
bisect_next_all: convert xsnprintf to xstrfmt
stop_progress_msg: convert xsnprintf to xstrfmt

Merge branch 'nd/clean-preserve-errno-in-warning'Junio C Hamano Mon, 27 Feb 2017 21:57:16 +0000 (13:57 -0800)

Merge branch 'nd/clean-preserve-errno-in-warning'

Some warning() messages from "git clean" were updated to show the
errno from failed system calls.

* nd/clean-preserve-errno-in-warning:
clean: use warning_errno() when appropriate

Merge branch 'jk/show-branch-lift-name-len-limit'Junio C Hamano Mon, 27 Feb 2017 21:57:16 +0000 (13:57 -0800)

Merge branch 'jk/show-branch-lift-name-len-limit'

"git show-branch" expected there were only very short branch names
in the repository and used a fixed-length buffer to hold them
without checking for overflow.

* jk/show-branch-lift-name-len-limit:
show-branch: use skip_prefix to drop magic numbers
show-branch: store resolved head in heap buffer
show-branch: drop head_len variable

Merge branch 'jn/remote-helpers-with-git-dir'Junio C Hamano Mon, 27 Feb 2017 21:57:16 +0000 (13:57 -0800)

Merge branch 'jn/remote-helpers-with-git-dir'

"git ls-remote" and "git archive --remote" are designed to work
without being in a directory under Git's control. However, recent
updates revealed that we randomly look into a directory called
.git/ without actually doing necessary set-up when working in a
repository. Stop doing so.

* jn/remote-helpers-with-git-dir:
remote helpers: avoid blind fall-back to ".git" when setting GIT_DIR
remote: avoid reading $GIT_DIR config in non-repo

Merge branch 'jk/grep-no-index-fix'Junio C Hamano Mon, 27 Feb 2017 21:57:15 +0000 (13:57 -0800)

Merge branch 'jk/grep-no-index-fix'

The code to parse the command line "git grep <patterns>... <rev>
[[--] <pathspec>...]" has been cleaned up, and a handful of bugs
have been fixed (e.g. we used to check "--" if it is a rev).

* jk/grep-no-index-fix:
grep: treat revs the same for --untracked as for --no-index
grep: do not diagnose misspelt revs with --no-index
grep: avoid resolving revision names in --no-index case
grep: fix "--" rev/pathspec disambiguation
grep: re-order rev-parsing loop
grep: do not unnecessarily query repo for "--"
grep: move thread initialization a little lower

Merge branch 'dt/gc-ignore-old-gc-logs'Junio C Hamano Mon, 27 Feb 2017 21:57:15 +0000 (13:57 -0800)

Merge branch 'dt/gc-ignore-old-gc-logs'

A "gc.log" file left by a backgrounded "gc --auto" disables further
automatic gc; it has been taught to run at least once a day (by
default) by ignoring a stale "gc.log" file that is too old.

* dt/gc-ignore-old-gc-logs:
gc: ignore old gc.log files

Merge branch 'jh/preload-index-skip-skip'Junio C Hamano Mon, 27 Feb 2017 21:57:15 +0000 (13:57 -0800)

Merge branch 'jh/preload-index-skip-skip'

The preload-index code has been taught not to bother with the index
entries that are paths that are not checked out by "sparse checkout".

* jh/preload-index-skip-skip:
preload-index: avoid lstat for skip-worktree items

Merge branch 'mh/submodule-hash'Junio C Hamano Mon, 27 Feb 2017 21:57:15 +0000 (13:57 -0800)

Merge branch 'mh/submodule-hash'

Code and design clean-up for the refs API.

* mh/submodule-hash:
read_loose_refs(): read refs using resolve_ref_recursively()
files_ref_store::submodule: use NULL for the main repository
base_ref_store_init(): remove submodule argument
refs: push the submodule attribute down
refs: store submodule ref stores in a hashmap
register_ref_store(): new function
refs: remove some unnecessary handling of submodule == ""
refs: make some ref_store lookup functions private
refs: reorder some function definitions

Merge branch 'sf/putty-w-args'Junio C Hamano Mon, 27 Feb 2017 21:57:14 +0000 (13:57 -0800)

Merge branch 'sf/putty-w-args'

The command line options for ssh invocation needs to be tweaked for
some implementations of SSH (e.g. PuTTY plink wants "-P <port>"
while OpenSSH wants "-p <port>" to specify port to connect to), and
the variant was guessed when GIT_SSH environment variable is used
to specify it. The logic to guess now applies to the command
specified by the newer GIT_SSH_COMMAND and also core.sshcommand
configuration variable, and comes with an escape hatch for users to
deal with misdetected cases.

* sf/putty-w-args:
connect.c: stop conflating ssh command names and overrides
connect: Add the envvar GIT_SSH_VARIANT and ssh.variant config
git_connect(): factor out SSH variant handling
connect: rename tortoiseplink and putty variables
connect: handle putty/plink also in GIT_SSH_COMMAND

Merge branch 'js/rebase-helper'Junio C Hamano Mon, 27 Feb 2017 21:57:14 +0000 (13:57 -0800)

Merge branch 'js/rebase-helper'

"git rebase -i" starts using the recently updated "sequencer" code.

* js/rebase-helper:
rebase -i: use the rebase--helper builtin
rebase--helper: add a builtin helper for interactive rebases

Merge branch 'bw/attr'Junio C Hamano Mon, 27 Feb 2017 21:57:14 +0000 (13:57 -0800)

Merge branch 'bw/attr'

The gitattributes machinery is being taught to work better in a
multi-threaded environment.

* bw/attr: (27 commits)
attr: reformat git_attr_set_direction() function
attr: push the bare repo check into read_attr()
attr: store attribute stack in attr_check structure
attr: tighten const correctness with git_attr and match_attr
attr: remove maybe-real, maybe-macro from git_attr
attr: eliminate global check_all_attr array
attr: use hashmap for attribute dictionary
attr: change validity check for attribute names to use positive logic
attr: pass struct attr_check to collect_some_attrs
attr: retire git_check_attrs() API
attr: convert git_check_attrs() callers to use the new API
attr: convert git_all_attrs() to use "struct attr_check"
attr: (re)introduce git_check_attr() and struct attr_check
attr: rename function and struct related to checking attributes
attr.c: outline the future plans by heavily commenting
Documentation: fix a typo
attr.c: add push_stack() helper
attr: support quoting pathname patterns in C style
attr.c: plug small leak in parse_attr_line()
attr.c: tighten constness around "git_attr" structure
...

Merge branch 'sg/completion'Junio C Hamano Mon, 27 Feb 2017 21:57:14 +0000 (13:57 -0800)

Merge branch 'sg/completion'

Clean-up and updates to command line completion (in contrib/).

* sg/completion: (22 commits)
completion: restore removed line continuating backslash
completion: cache the path to the repository
completion: extract repository discovery from __gitdir()
completion: don't guard git executions with __gitdir()
completion: consolidate silencing errors from git commands
completion: don't use __gitdir() for git commands
completion: respect 'git -C <path>'
rev-parse: add '--absolute-git-dir' option
completion: fix completion after 'git -C <path>'
completion: don't offer commands when 'git --opt' needs an argument
completion: list short refs from a remote given as a URL
completion: don't list 'HEAD' when trying refs completion outside of a repo
completion: list refs from remote when remote's name matches a directory
completion: respect 'git --git-dir=<path>' when listing remote refs
completion: fix most spots not respecting 'git --git-dir=<path>'
completion: ensure that the repository path given on the command line exists
completion tests: add tests for the __git_refs() helper function
completion tests: check __gitdir()'s output in the error cases
completion tests: consolidate getting path of current working directory
completion tests: make the $cur variable local to the test helper functions
...

Merge branch 'lt/pathspec-negative'Junio C Hamano Mon, 27 Feb 2017 21:57:13 +0000 (13:57 -0800)

Merge branch 'lt/pathspec-negative'

The "negative" pathspec feature was somewhat more cumbersome to use
than necessary in that its short-hand used "!" which needed to be
escaped from shells, and it required "exclude from what?" specified.

* lt/pathspec-negative:
pathspec: don't error out on all-exclusionary pathspec patterns
pathspec magic: add '^' as alias for '!'

Merge branch 'cw/tag-reflog-message'Junio C Hamano Mon, 27 Feb 2017 21:57:13 +0000 (13:57 -0800)

Merge branch 'cw/tag-reflog-message'

"git tag" did not leave useful message when adding a new entry to
reflog; this was left unnoticed for a long time because refs/tags/*
doesn't keep reflog by default.

* cw/tag-reflog-message:
tag: generate useful reflog message

Merge branch 'jk/alternate-ref-optim'Junio C Hamano Mon, 27 Feb 2017 21:57:13 +0000 (13:57 -0800)

Merge branch 'jk/alternate-ref-optim'

Optimizes resource usage while enumerating refs from alternate
object store, to help receiving end of "push" that hosts a
repository with many "forks".

* jk/alternate-ref-optim:
receive-pack: avoid duplicates between our refs and alternates
receive-pack: treat namespace .have lines like alternates
receive-pack: fix misleading namespace/.have comment
receive-pack: use oidset to de-duplicate .have lines
add oidset API
fetch-pack: cache results of for_each_alternate_ref
for_each_alternate_ref: replace transport code with for-each-ref
for_each_alternate_ref: pass name/oid instead of ref struct
for_each_alternate_ref: use strbuf for path allocation
for_each_alternate_ref: stop trimming trailing slashes
for_each_alternate_ref: handle failure from real_pathdup()

Merge branch 'kn/ref-filter-branch-list'Junio C Hamano Mon, 27 Feb 2017 21:57:13 +0000 (13:57 -0800)

Merge branch 'kn/ref-filter-branch-list'

The code to list branches in "git branch" has been consolidated
with the more generic ref-filter API.

* kn/ref-filter-branch-list: (21 commits)
ref-filter: resurrect "strip" as a synonym to "lstrip"
branch: implement '--format' option
branch: use ref-filter printing APIs
branch, tag: use porcelain output
ref-filter: allow porcelain to translate messages in the output
ref-filter: add an 'rstrip=<N>' option to atoms which deal with refnames
ref-filter: modify the 'lstrip=<N>' option to work with negative '<N>'
ref-filter: Do not abruptly die when using the 'lstrip=<N>' option
ref-filter: rename the 'strip' option to 'lstrip'
ref-filter: make remote_ref_atom_parser() use refname_atom_parser_internal()
ref-filter: introduce refname_atom_parser()
ref-filter: introduce refname_atom_parser_internal()
ref-filter: make "%(symref)" atom work with the ':short' modifier
ref-filter: add support for %(upstream:track,nobracket)
ref-filter: make %(upstream:track) prints "[gone]" for invalid upstreams
ref-filter: introduce format_ref_array_item()
ref-filter: move get_head_description() from branch.c
ref-filter: modify "%(objectname:short)" to take length
ref-filter: implement %(if:equals=<string>) and %(if:notequals=<string>)
ref-filter: include reference to 'used_atom' within 'atom_value'
...

Merge branch 'ps/urlmatch-wildcard'Junio C Hamano Mon, 27 Feb 2017 21:57:12 +0000 (13:57 -0800)

Merge branch 'ps/urlmatch-wildcard'

The <url> part in "http.<url>.<variable>" configuration variable
can now be spelled with '*' that serves as wildcard.
E.g. "http.https://*.example.com.proxy" can be used to specify the
proxy used for https://a.example.com, https://b.example.com, etc.,
i.e. any host in the example.com domain.

* ps/urlmatch-wildcard:
urlmatch: allow globbing for the URL host part
urlmatch: include host in urlmatch ranking
urlmatch: split host and port fields in `struct url_info`
urlmatch: enable normalization of URLs with globs
mailmap: add Patrick Steinhardt's work address

Merge branch 'mm/merge-rename-delete-message'Junio C Hamano Mon, 27 Feb 2017 21:57:12 +0000 (13:57 -0800)

Merge branch 'mm/merge-rename-delete-message'

When "git merge" detects a path that is renamed in one history
while the other history deleted (or modified) it, it now reports
both paths to help the user understand what is going on in the two
histories being merged.

* mm/merge-rename-delete-message:
merge-recursive: make "CONFLICT (rename/delete)" message show both paths

Merge branch 'mh/ref-remove-empty-directory'Junio C Hamano Mon, 27 Feb 2017 21:57:12 +0000 (13:57 -0800)

Merge branch 'mh/ref-remove-empty-directory'

Deletion of a branch "foo/bar" could remove .git/refs/heads/foo
once there no longer is any other branch whose name begins with
"foo/", but we didn't do so so far. Now we do.

* mh/ref-remove-empty-directory: (23 commits)
files_transaction_commit(): clean up empty directories
try_remove_empty_parents(): teach to remove parents of reflogs, too
try_remove_empty_parents(): don't trash argument contents
try_remove_empty_parents(): rename parameter "name" -> "refname"
delete_ref_loose(): inline function
delete_ref_loose(): derive loose reference path from lock
log_ref_write_1(): inline function
log_ref_setup(): manage the name of the reflog file internally
log_ref_write_1(): don't depend on logfile argument
log_ref_setup(): pass the open file descriptor back to the caller
log_ref_setup(): improve robustness against races
log_ref_setup(): separate code for create vs non-create
log_ref_write(): inline function
rename_tmp_log(): improve error reporting
rename_tmp_log(): use raceproof_create_file()
lock_ref_sha1_basic(): use raceproof_create_file()
lock_ref_sha1_basic(): inline constant
raceproof_create_file(): new function
safe_create_leading_directories(): set errno on SCLD_EXISTS
safe_create_leading_directories_const(): preserve errno
...

Merge branch 'jk/delta-chain-limit'Junio C Hamano Mon, 27 Feb 2017 21:57:11 +0000 (13:57 -0800)

Merge branch 'jk/delta-chain-limit'

"git repack --depth=<n>" for a long time busted the specified depth
when reusing delta from existing packs. This has been corrected.

* jk/delta-chain-limit:
pack-objects: convert recursion to iteration in break_delta_chain()
pack-objects: enforce --depth limit in reused deltas

Merge branch 'jk/describe-omit-some-refs'Junio C Hamano Mon, 27 Feb 2017 21:57:11 +0000 (13:57 -0800)

Merge branch 'jk/describe-omit-some-refs'

"git describe" and "git name-rev" have been taught to take more
than one refname patterns to restrict the set of refs to base their
naming output on, and also learned to take negative patterns to
name refs not to be used for naming via their "--exclude" option.

* jk/describe-omit-some-refs:
describe: teach describe negative pattern matches
describe: teach --match to accept multiple patterns
name-rev: add support to exclude refs by pattern match
name-rev: extend --refs to accept multiple patterns
doc: add documentation for OPT_STRING_LIST

Git 2.12 v2.12.0Junio C Hamano Fri, 24 Feb 2017 18:49:58 +0000 (10:49 -0800)

Git 2.12

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

Merge branch 'ps/doc-gc-aggressive-depth-update'Junio C Hamano Fri, 24 Feb 2017 18:48:10 +0000 (10:48 -0800)

Merge branch 'ps/doc-gc-aggressive-depth-update'

Doc update.

* ps/doc-gc-aggressive-depth-update:
docs/git-gc: fix default value for `--aggressiveDepth`

Merge branch 'bc/worktree-doc-fix-detached'Junio C Hamano Fri, 24 Feb 2017 18:48:10 +0000 (10:48 -0800)

Merge branch 'bc/worktree-doc-fix-detached'

Doc update.

* bc/worktree-doc-fix-detached:
Documentation: correctly spell git worktree --detach

Merge branch 'dr/doc-check-ref-format-normalize'Junio C Hamano Fri, 24 Feb 2017 18:48:09 +0000 (10:48 -0800)

Merge branch 'dr/doc-check-ref-format-normalize'

Doc update.

* dr/doc-check-ref-format-normalize:
git-check-ref-format: clarify documentation for --normalize

Merge branch 'gp/document-dotfiles-in-templates-are... Junio C Hamano Fri, 24 Feb 2017 18:48:09 +0000 (10:48 -0800)

Merge branch 'gp/document-dotfiles-in-templates-are-not-copied'

Doc update.

* gp/document-dotfiles-in-templates-are-not-copied:
init: document dotfiles exclusion on template copy

Merge branch 'rt/align-add-i-help-text'Junio C Hamano Fri, 24 Feb 2017 18:48:08 +0000 (10:48 -0800)

Merge branch 'rt/align-add-i-help-text'

Doc update.

* rt/align-add-i-help-text:
git add -i: replace \t with blanks in the help message

Merge branch 'bc/blame-doc-fix'Junio C Hamano Fri, 24 Feb 2017 18:48:07 +0000 (10:48 -0800)

Merge branch 'bc/blame-doc-fix'

Doc update.

* bc/blame-doc-fix:
Documentation: use brackets for optional arguments

docs/git-gc: fix default value for `--aggressiveDepth`Patrick Steinhardt Fri, 24 Feb 2017 08:46:45 +0000 (09:46 +0100)

docs/git-gc: fix default value for `--aggressiveDepth`

In commit 07e7dbf0d (gc: default aggressive depth to 50, 2016-08-11),
the default aggressive depth of git-gc has been changed to 50. While
git-config(1) has been updated to represent the new default value,
git-gc(1) still mentions the old value. This patch fixes it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge tag 'l10n-2.12.0-rnd2' of git://github.com/git... Junio C Hamano Fri, 24 Feb 2017 17:55:41 +0000 (09:55 -0800)

Merge tag 'l10n-2.12.0-rnd2' of git://github.com/git-l10n/git-po

l10n-2.12.0-rnd2

* tag 'l10n-2.12.0-rnd2' of git://github.com/git-l10n/git-po: (22 commits)
l10n: zh_CN: for git v2.12.0 l10n round 2
l10n: Update Catalan translation
l10n: pt_PT: update Portuguese tranlation
l10n: sv.po: Update Swedish translation (3139t0f0u)
l10n: de.po: translate 241 messages
l10n: ko.po: Update Korean translation
l10n: vi.po (3139t): Updated 2 new messages for rc1
l10n: fr.po: v2.12.0 round 2 3139t
l10n: git.pot: v2.12.0 round 2 (2 new)
l10n: vi.po: Updated Vietnamese translation (3137t)
l10n: update Catalan translation
l10n: sv.po: Update Swedish translation (3137t0f0u)
l10n: fr.po: v2.11-rc0 first round
l10n: ko.po: Update Korean translation
l10n: fr.po: Fix a typo in the French translation
l10n: fr.po: Remove gender specific adjectives
l10n: fr.po: Fix typos
l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)
l10n: bg: Updated Bulgarian translation (2913t+0f+0u)
l10n: fixes to Catalan translation
...

l10n: zh_CN: for git v2.12.0 l10n round 2Jiang Xin Fri, 27 Jan 2017 14:50:57 +0000 (22:50 +0800)

l10n: zh_CN: for git v2.12.0 l10n round 2

Translate 241 messages (3139t0f0u) for git v2.12.0-rc1.

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

l10n: Update Catalan translationJordi Mas Tue, 21 Feb 2017 17:32:29 +0000 (18:32 +0100)

l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>

l10n: pt_PT: update Portuguese tranlationVasco Almeida Sun, 5 Feb 2017 18:43:34 +0000 (17:43 -0100)

l10n: pt_PT: update Portuguese tranlation

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

git add -i: replace \t with blanks in the help messageRalf Thielow Wed, 22 Feb 2017 18:46:27 +0000 (19:46 +0100)

git add -i: replace \t with blanks in the help message

Within the help message of 'git add -i', the 'diff' command uses one
tab character and blanks to create the space between the name and the
description while the others use blanks only. So if the tab size is
not at 4 characters, this description will not be in range.
Replace the tab character with blanks.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: use brackets for optional argumentsbrian m. carlson Wed, 22 Feb 2017 12:25:46 +0000 (12:25 +0000)

Documentation: use brackets for optional arguments

The documentation for git blame used vertical bars for optional
arguments to -M and -C, which is unusual and potentially confusing.
Since most man pages use brackets for optional items, and that's
consistent with how we document the same options for git diff and
friends, use brackets here, too.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: correctly spell git worktree --detachbrian m. carlson Wed, 22 Feb 2017 12:34:42 +0000 (12:34 +0000)

Documentation: correctly spell git worktree --detach

The option is “--detach”, but we accidentally spelled it “--detached” at
one point in the man page.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Reported-by: Casey Rodarmor <casey@rodarmor.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: ignore failure to remove missing branch.<name... Ross Lagerwall Sat, 18 Feb 2017 00:23:41 +0000 (00:23 +0000)

remote: ignore failure to remove missing branch.<name>.merge

It is not all too unusual for a branch to use "branch.<name>.remote"
without "branch.<name>.merge". You may be using the 'push.default'
configuration set to 'current', for example, and do

$ git checkout -b side colleague/side
$ git config branch.side.remote colleague

However, "git remote rm" to remove the remote used in such a manner
fails with

"fatal: could not unset 'branch.<name>.merge'"

because it assumes that a branch that has .remote defined must also
have .merge defined. Detect the "cannot unset because it is not set
to begin with" case and ignore it.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-check-ref-format: clarify documentation for --normalizeDamien Regad Sun, 19 Feb 2017 22:32:32 +0000 (23:32 +0100)

git-check-ref-format: clarify documentation for --normalize

Use of 'iff' may be confusing to people not familiar with this term.

Improving the --normalize option's documentation to remove the use of
'iff', and clearly describe what happens when the condition is not met.

Signed-off-by: Damien Regad <dregad@mantisbt.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'master' of git://github.com/nafmo/git... Jiang Xin Tue, 21 Feb 2017 16:06:44 +0000 (00:06 +0800)

Merge branch 'master' of git://github.com/nafmo/git-l10n-sv

* 'master' of git://github.com/nafmo/git-l10n-sv:
l10n: sv.po: Update Swedish translation (3139t0f0u)

branch: record creation of renamed branch in HEAD's logKyle Meyer Tue, 21 Feb 2017 01:10:35 +0000 (20:10 -0500)

branch: record creation of renamed branch in HEAD's log

Renaming the current branch adds an event to the current branch's log
and to HEAD's log. However, the logged entries differ. The entry in
the branch's log represents the entire renaming operation (the old and
new hash are identical), whereas the entry in HEAD's log represents
the deletion only (the new sha1 is null).

Extend replace_each_worktree_head_symref(), whose only caller is
branch_rename(), to take a reflog message argument. This allows the
creation of the new ref to be recorded in HEAD's log. As a result,
the renaming event is represented by two entries (a deletion and a
creation entry) in HEAD's log.

It's a bit unfortunate that the branch's log and HEAD's log now
represent the renaming event in different ways. Given that the
renaming operation is not atomic, the two-entry form is a more
accurate representation of the operation and is more useful for
debugging purposes if a failure occurs between the deletion and
creation events. It would make sense to move the branch's log to the
two-entry form, but this would involve changes to how the rename is
carried out and to how the update flags and reflogs are processed for
deletions, so it may not be worth the effort.

Based-on-patch-by: Jeff King <peff@peff.net>
Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rename_ref: replace empty message in HEAD's logKyle Meyer Tue, 21 Feb 2017 01:10:34 +0000 (20:10 -0500)

rename_ref: replace empty message in HEAD's log

When the current branch is renamed, the deletion of the old ref is
recorded in HEAD's log with an empty message. Now that delete_ref()
accepts a reflog message, provide a more descriptive message by
passing along the log message that is given to rename_ref().

The next step will be to extend HEAD's log to also include the second
part of the rename, the creation of the new branch.

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

update-ref: pass reflog message to delete_ref()Kyle Meyer Tue, 21 Feb 2017 01:10:33 +0000 (20:10 -0500)

update-ref: pass reflog message to delete_ref()

Now that delete_ref() accepts a reflog message, pass the user-provided
message to delete_ref() rather than silently dropping it.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

delete_ref: accept a reflog message argumentKyle Meyer Tue, 21 Feb 2017 01:10:32 +0000 (20:10 -0500)

delete_ref: accept a reflog message argument

When the current branch is renamed with 'git branch -m/-M' or deleted
with 'git update-ref -m<msg> -d', the event is recorded in HEAD's log
with an empty message. In preparation for adding a more meaningful
message to HEAD's log in these cases, update delete_ref() to take a
message argument and pass it along to ref_transaction_delete().
Modify all callers to pass NULL for the new message argument; no
change in behavior is intended.

Note that this is relevant for HEAD's log but not for the deleted
ref's log, which is currently deleted along with the ref. Even if it
were not, an entry for the deletion wouldn't be present in the deleted
ref's log. files_transaction_commit() writes to the log if
REF_NEEDS_COMMIT or REF_LOG_ONLY are set, but lock_ref_for_update()
doesn't set REF_NEEDS_COMMIT for the deleted ref because REF_DELETING
is set. In contrast, the update for HEAD has REF_LOG_ONLY set by
split_head_update(), resulting in the deletion being logged.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'svn-escape-backslash' of git://bogomips... Junio C Hamano Tue, 21 Feb 2017 06:01:59 +0000 (22:01 -0800)

Merge branch 'svn-escape-backslash' of git://bogomips.org/git-svn

* 'svn-escape-backslash' of git://bogomips.org/git-svn:
git-svn: escape backslashes in refnames

l10n: sv.po: Update Swedish translation (3139t0f0u)Peter Krefting Mon, 20 Feb 2017 18:40:11 +0000 (19:40 +0100)

l10n: sv.po: Update Swedish translation (3139t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>

l10n: de.po: translate 241 messagesRalf Thielow Mon, 20 Feb 2017 17:40:36 +0000 (18:40 +0100)

l10n: de.po: translate 241 messages

Translate 241 messages came from git.pot update in 673bfad09
(l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)) and a4d94835a
(l10n: git.pot: v2.12.0 round 2 (2 new)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Phillip Sz <phillip.szelat@gmail.com>

Merge branch 'ko/merge-l10n' of https://github.com... Jiang Xin Sun, 19 Feb 2017 14:08:05 +0000 (22:08 +0800)

Merge branch 'ko/merge-l10n' of https://github.com/changwoo/git-l10n-ko

* 'ko/merge-l10n' of https://github.com/changwoo/git-l10n-ko:
l10n: ko.po: Update Korean translation

Merge branch 'master' of https://github.com/vnwildman/gitJiang Xin Sun, 19 Feb 2017 14:04:41 +0000 (22:04 +0800)

Merge branch 'master' of https://github.com/vnwildman/git

* 'master' of https://github.com/vnwildman/git:
l10n: vi.po (3139t): Updated 2 new messages for rc1

l10n: ko.po: Update Korean translationChangwoo Ryu Sun, 19 Feb 2017 10:34:24 +0000 (19:34 +0900)

l10n: ko.po: Update Korean translation

Signed-off-by: Changwoo Ryu <cwryu@debian.org>

l10n: vi.po (3139t): Updated 2 new messages for rc1Tran Ngoc Quan Sat, 18 Feb 2017 00:18:54 +0000 (07:18 +0700)

l10n: vi.po (3139t): Updated 2 new messages for rc1

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>

init: document dotfiles exclusion on template copyGrégoire Paris Fri, 17 Feb 2017 23:37:00 +0000 (00:37 +0100)

init: document dotfiles exclusion on template copy

Not just . and .., but any path that begins with dot is not copied
when copying the template directory to a new repository. You can
customize the template directory, copying some dotfiles might make
sense, but it's actually a good thing not to, because you would not
want to have your git directory copied in every git directory that
is created should you decide to put your template directory under
version control, for example. Plus, it might be used as a feature
by people who would want to exclude some files.

Signed-off-by: Grégoire Paris <postmaster@greg0ire.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: fr.po: v2.12.0 round 2 3139tJean-Noel Avila Fri, 17 Feb 2017 23:10:04 +0000 (00:10 +0100)

l10n: fr.po: v2.12.0 round 2 3139t

Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>

tempfile: set errno to a known value before calling... Jeff King Fri, 17 Feb 2017 21:07:49 +0000 (16:07 -0500)

tempfile: set errno to a known value before calling ferror()

In close_tempfile(), we return an error if ferror()
indicated a previous failure, or if fclose() failed. In the
latter case, errno is set and it is useful for callers to
report it.

However, if _only_ ferror() triggers, then the value of
errno is based on whatever syscall happened to last fail,
which may not be related to our filehandle at all. A caller
cannot tell the difference between the two cases, and may
use "die_errno()" or similar to report a nonsense errno value.

One solution would be to actually pass back separate return
values for the two cases, so a caller can write a more
appropriate message for each case. But that makes the
interface clunky.

Instead, let's just set errno to the generic EIO in this case.
That's not as descriptive as we'd like, but at least it's
predictable. So it's better than the status quo in all cases
but one: when the last syscall really did involve a failure
on our filehandle, we'll be wiping that out. But that's a
fragile thing for us to rely on.

In any case, we'll let the errno result from fclose() take
precedence over our value, as we know that's recent and
accurate (and many I/O errors will persist through the
fclose anyway).

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

Git 2.12-rc2 v2.12.0-rc2Junio C Hamano Fri, 17 Feb 2017 22:00:19 +0000 (14:00 -0800)

Git 2.12-rc2

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

rev-parse: fix several options when running in a subdir... Johannes Schindelin Fri, 17 Feb 2017 16:59:06 +0000 (17:59 +0100)

rev-parse: fix several options when running in a subdirectory

In addition to making git_path() aware of certain file names that need
to be handled differently e.g. when running in worktrees, the commit
557bd833bb (git_path(): be aware of file relocation in $GIT_DIR,
2014-11-30) also snuck in a new option for `git rev-parse`:
`--git-path`.

On the face of it, there is no obvious bug in that commit's diff: it
faithfully calls git_path() on the argument and prints it out, i.e. `git
rev-parse --git-path <filename>` has the same precise behavior as
calling `git_path("<filename>")` in C.

The problem lies deeper, much deeper. In hindsight (which is always
unfair), implementing the .git/ directory discovery in
`setup_git_directory()` by changing the working directory may have
allowed us to avoid passing around a struct that contains information
about the current repository, but it bought us many, many problems.

In this case, when being called in a subdirectory, `git rev-parse`
changes the working directory to the top-level directory before calling
`git_path()`. In the new working directory, the result is correct. But
in the working directory of the calling script, it is incorrect.

Example: when calling `git rev-parse --git-path HEAD` in, say, the
Documentation/ subdirectory of Git's own source code, the string
`.git/HEAD` is printed.

Side note: that bug is hidden when running in a subdirectory of a
worktree that was added by the `git worktree` command: in that case, the
(correct) absolute path of the `HEAD` file is printed.

In the interest of time, this patch does not go the "correct" route to
introduce a struct with repository information (and removing global
state in the process), instead this patch chooses to detect when the
command was called in a subdirectory and forces the result to be an
absolute path.

While at it, we are also fixing the output of --git-common-dir and
--shared-index-path.

Lastly, please note that we reuse the same strbuf for all of the
relative_path() calls; this avoids frequent allocation (and duplicated
code), and it does not risk memory leaks, for two reasons: 1) the
cmd_rev_parse() function does not return anywhere between the use of
the new strbuf instance and its final release, and 2) git-rev-parse is
one of these "one-shot" programs in Git, i.e. it exits after running
for a very short time, meaning that all allocated memory is released
with the exit() call anyway.

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

rev-parse tests: add tests executed from a subdirectoryMichael Rappazzo Fri, 17 Feb 2017 16:59:02 +0000 (17:59 +0100)

rev-parse tests: add tests executed from a subdirectory

t2027-worktree-list has an incorrect expectation for --git-common-dir
which has been adjusted and marked to expect failure.

Some of the tests added have been marked to expect failure. These
demonstrate a problem with the way that some options to git rev-parse
behave when executed from a subdirectory of the main worktree.

[jes: fixed incorrect assumption that objects/ lives in the
worktree-specific git-dir (it lives in the common dir instead). Also
adjusted t1700 so that the test case does not *need* to be the last
one in that script.]

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

l10n: git.pot: v2.12.0 round 2 (2 new)Jiang Xin Fri, 17 Feb 2017 17:00:54 +0000 (01:00 +0800)

l10n: git.pot: v2.12.0 round 2 (2 new)

Generate po/git.pot from v2.12.0-rc1 for git v2.12.0 l10n round 2.

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

Merge branch 'master' of git://github.com/git-l10n... Jiang Xin Fri, 17 Feb 2017 16:59:51 +0000 (00:59 +0800)

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

* 'master' of git://github.com/git-l10n/git-po:
l10n: vi.po: Updated Vietnamese translation (3137t)
l10n: update Catalan translation
l10n: sv.po: Update Swedish translation (3137t0f0u)
l10n: fr.po: v2.11-rc0 first round
l10n: ko.po: Update Korean translation
l10n: fr.po: Fix a typo in the French translation
l10n: fr.po: Remove gender specific adjectives
l10n: fr.po: Fix typos
l10n: git.pot: v2.12.0 round 1 (239 new, 15 removed)
l10n: bg: Updated Bulgarian translation (2913t+0f+0u)
l10n: fixes to Catalan translation
l10n: zh_CN: review for git v2.11.0 l10n
l10n: New Catalan translation maintainer

Merge branch 'master' of https://github.com/vnwildman/gitJiang Xin Fri, 17 Feb 2017 16:54:49 +0000 (00:54 +0800)

Merge branch 'master' of https://github.com/vnwildman/git

* 'master' of https://github.com/vnwildman/git:
l10n: vi.po: Updated Vietnamese translation (3137t)

Merge branch 'master' of https://github.com/Softcatala... Jiang Xin Fri, 17 Feb 2017 16:49:06 +0000 (00:49 +0800)

Merge branch 'master' of https://github.com/Softcatala/git-po

* 'master' of https://github.com/Softcatala/git-po:
l10n: update Catalan translation

l10n: vi.po: Updated Vietnamese translation (3137t)Tran Ngoc Quan Fri, 17 Feb 2017 06:51:34 +0000 (13:51 +0700)

l10n: vi.po: Updated Vietnamese translation (3137t)

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>

Hopefully the final batch of mini-topics before the... Junio C Hamano Thu, 16 Feb 2017 22:46:35 +0000 (14:46 -0800)

Hopefully the final batch of mini-topics before the final

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

Merge branch 'jk/tempfile-ferror-fclose-confusion'Junio C Hamano Thu, 16 Feb 2017 22:45:15 +0000 (14:45 -0800)

Merge branch 'jk/tempfile-ferror-fclose-confusion'

Code clean-up.

* jk/tempfile-ferror-fclose-confusion:
tempfile: avoid "ferror | fclose" trick

Merge branch 'dp/submodule-doc-markup-fix'Junio C Hamano Thu, 16 Feb 2017 22:45:15 +0000 (14:45 -0800)

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

Doc fix.

* dp/submodule-doc-markup-fix:
config.txt: fix formatting of submodule.alternateErrorStrategy section

Merge branch 'jk/reset-to-break-a-commit-doc-updated'Junio C Hamano Thu, 16 Feb 2017 22:45:14 +0000 (14:45 -0800)

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

Doc update.

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

Merge branch 'jk/reset-to-break-a-commit-doc'Junio C Hamano Thu, 16 Feb 2017 22:45:14 +0000 (14:45 -0800)

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

Doc update.

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

Merge branch 'js/mingw-isatty'Junio C Hamano Thu, 16 Feb 2017 22:45:13 +0000 (14:45 -0800)

Merge branch 'js/mingw-isatty'

A hotfix for a topic already in 'master'.

* js/mingw-isatty:
mingw: make stderr unbuffered again

Merge branch 'rs/strbuf-cleanup-in-rmdir-recursively'Junio C Hamano Thu, 16 Feb 2017 22:45:13 +0000 (14:45 -0800)

Merge branch 'rs/strbuf-cleanup-in-rmdir-recursively'

Code clean-up.

* rs/strbuf-cleanup-in-rmdir-recursively:
rm: reuse strbuf for all remove_dir_recursively() calls, again

Merge branch 'rs/ls-files-partial-optim'Junio C Hamano Thu, 16 Feb 2017 22:45:13 +0000 (14:45 -0800)

Merge branch 'rs/ls-files-partial-optim'

"ls-files" run with pathspec has been micro-optimized to avoid
having to memmove(3) unnecessary bytes.

* rs/ls-files-partial-optim:
ls-files: move only kept cache entries in prune_cache()
ls-files: pass prefix length explicitly to prune_cache()

Merge branch 'rs/cocci-check-free-only-null'Junio C Hamano Thu, 16 Feb 2017 22:45:13 +0000 (14:45 -0800)

Merge branch 'rs/cocci-check-free-only-null'

A new coccinelle rule that catches a check of !pointer before the
pointer is free(3)d, which most likely is a bug.

* rs/cocci-check-free-only-null:
cocci: detect useless free(3) calls

Merge branch 'ls/p4-path-encoding'Junio C Hamano Thu, 16 Feb 2017 22:45:12 +0000 (14:45 -0800)

Merge branch 'ls/p4-path-encoding'

When "git p4" imports changelist that removes paths, it failed to
convert pathnames when the p4 used encoding different from the one
used on the Git side. This has been corrected.

* ls/p4-path-encoding:
git-p4: fix git-p4.pathEncoding for removed files

tempfile: avoid "ferror | fclose" trickJeff King Thu, 16 Feb 2017 21:31:40 +0000 (16:31 -0500)

tempfile: avoid "ferror | fclose" trick

The current code wants to record an error condition from
either ferror() or fclose(), but makes sure that we always
call both functions. So it can't use logical-OR "||", which
would short-circuit when ferror() is true. Instead, it uses
bitwise-OR "|" to evaluate both functions and set one or
more bits in the "err" flag if they reported a failure.

Unlike logical-OR, though, bitwise-OR does not introduce a
sequence point, and the order of evaluation for its operands
is unspecified. So a compiler would be free to generate code
which calls fclose() first, and then ferror() on the
now-freed filehandle.

There's no indication that this has happened in practice,
but let's write it out in a way that follows the standard.

Noticed-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config.txt: fix formatting of submodule.alternateErrorS... David Pursehouse Thu, 16 Feb 2017 05:05:35 +0000 (14:05 +0900)

config.txt: fix formatting of submodule.alternateErrorStrategy section

Add missing `::` after the title.

Signed-off-by: David Pursehouse <dpursehouse@collab.net>
Acked-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clean: use warning_errno() when appropriateNguyễn Thái Ngọc Duy Tue, 14 Feb 2017 09:54:49 +0000 (16:54 +0700)

clean: use warning_errno() when appropriate

All these warning() calls are preceded by a system call. Report the
actual error to help the user understand why we fail to remove
something.

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

reset: add an example of how to split a commit into twoJacob Keller Thu, 16 Feb 2017 00:22:12 +0000 (16:22 -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>