gitweb.git
merge-recursive: rename conflict_rename_*() family... Elijah Newren Sun, 10 Jun 2018 04:16:15 +0000 (21:16 -0700)

merge-recursive: rename conflict_rename_*() family of functions

These functions were added because processing of these conflicts needed
to be deferred until process_entry() in order to get D/F conflicts and
such right. The number of these has grown over time, and now include
some whose name is misleading:
* conflict_rename_normal() is for handling normal file renames; a
typical rename may need content merging, but we expect conflicts
from that to be more the exception than the rule.
* conflict_rename_via_dir() will not be a conflict; it was just an
add that turned into a move due to directory rename detection.
(If there was a file in the way of the move, that would have been
detected and reported earlier.)
* conflict_rename_rename_2to1 and conflict_rename_add (the latter
of which doesn't exist yet but has been submitted before and I
intend to resend) technically might not be conflicts if the
colliding paths happen to match exactly.
Rename this family of functions to handle_rename_*().

Also rename handle_renames() to detect_and_process_renames() both to make
it clearer what it does, and to differentiate it as a pre-processing step
from all the handle_rename_*() functions which are called from
process_entry().

Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: clarify the rename_dir/RENAME_DIR... Elijah Newren Sun, 10 Jun 2018 04:16:14 +0000 (21:16 -0700)

merge-recursive: clarify the rename_dir/RENAME_DIR meaning

We had an enum of rename types which included RENAME_DIR; this name felt
misleading since it was not about an entire directory but was a status for
each individual file add that occurred within a renamed directory.

Since this type is for signifying that the files in question were being
renamed due to directory rename detection, rename this enum value to
RENAME_VIA_DIR.

Make a similar change to the conflict_rename_dir() function, and add a
comment to the top of that function explaining its purpose (it may not be
quite as obvious as for the other conflict_rename_*() functions).

Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: align labels with their respective... Elijah Newren Sun, 10 Jun 2018 04:16:13 +0000 (21:16 -0700)

merge-recursive: align labels with their respective code blocks

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: fix numerous argument alignment issuesElijah Newren Sun, 10 Jun 2018 04:16:12 +0000 (21:16 -0700)

merge-recursive: fix numerous argument alignment issues

Various refactorings throughout the code have left lots of alignment
issues that were driving me crazy; fix them.

Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-recursive: fix miscellaneous grammar error in... Elijah Newren Sun, 10 Jun 2018 04:16:11 +0000 (21:16 -0700)

merge-recursive: fix miscellaneous grammar error in comment

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitworkflows: fix grammar in 'Merge upwards' ruleKyle Meyer Sat, 9 Jun 2018 15:19:43 +0000 (11:19 -0400)

gitworkflows: fix grammar in 'Merge upwards' rule

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: correct zsh detection when run from git... SZEDER Gábor Mon, 11 Jun 2018 18:20:53 +0000 (11:20 -0700)

completion: correct zsh detection when run from git-completion.zsh

v2.18.0-rc0~90^2 (completion: reduce overhead of clearing cached
--options, 2018-04-18) worked around a bug in bash's "set" builtin on
MacOS by using compgen instead. It was careful to avoid breaking zsh
by guarding this workaround with

if [[ -n ${ZSH_VERSION-}} ]]

Alas, this interacts poorly with git-completion.zsh's bash emulation:

ZSH_VERSION='' . "$script"

Correct it by instead using a new GIT_SOURCING_ZSH_COMPLETION shell
variable to detect whether git-completion.bash is being sourced from
git-completion.zsh. This way, the zsh variant is used both when run
from zsh directly and when run via git-completion.zsh.

Reproduction recipe:

1. cd git/contrib/completion && cp git-completion.zsh _git
2. Put the following in a new ~/.zshrc file:

autoload -U compinit; compinit
autoload -U bashcompinit; bashcompinit
fpath=(~/src/git/contrib/completion $fpath)

3. Open zsh and "git <TAB>".

With this patch:
Triggers nice git-completion.bash based tab completion

Without:
contrib/completion/git-completion.bash:354: read-only variable: QISUFFIX
zsh:12: command not found: ___main
zsh:15: _default: function definition file not found
_dispatch:70: bad math expression: operand expected at `/usr/bin/g...'
Segmentation fault

Reported-by: Rick van Hattem <wolph@wol.ph>
Reported-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

l10n: bg.po: Updated Bulgarian translation (3608t)Alexander Shopov Tue, 12 Jun 2018 07:35:27 +0000 (09:35 +0200)

l10n: bg.po: Updated Bulgarian translation (3608t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>

index-pack: correct install_packed_git() argsJunio C Hamano Mon, 11 Jun 2018 22:09:18 +0000 (15:09 -0700)

index-pack: correct install_packed_git() args

The function does not start taking the repository object as a
parameter before v2.18 track. Make the topic mergeable to v2.17
maintenance track by dropping it.

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

diff-options.txt: fix minor typos, font inconsistencies... Robert P. J. Day Mon, 11 Jun 2018 13:56:13 +0000 (09:56 -0400)

diff-options.txt: fix minor typos, font inconsistencies, in docs

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fetch-pack: don't try to fetch peel values with --allJeff King Mon, 11 Jun 2018 05:53:57 +0000 (01:53 -0400)

fetch-pack: don't try to fetch peel values with --all

When "fetch-pack --all" sees a tag-to-blob on the remote, it
tries to fetch both the tag itself ("refs/tags/foo") and the
peeled value that the remote advertises ("refs/tags/foo^{}").
Asking for the object pointed to by the latter can cause
upload-pack to complain with "not our ref", since it does
not mark the peeled objects with the OUR_REF (unless they
were at the tip of some other ref).

Arguably upload-pack _should_ be marking those peeled
objects. But it never has in the past, since clients would
generally just ask for the tag and expect to get the peeled
value along with it. And that's how "git fetch" works, as
well as older versions of "fetch-pack --all".

The problem was introduced by 5f0fc64513 (fetch-pack:
eliminate spurious error messages, 2012-09-09). Before then,
the matching logic was something like:

if (refname is ill-formed)
do nothing
else if (doing --all)
always consider it matched
else
look through list of sought refs for a match

That commit wanted to flip the order of the second two arms
of that conditional. But we ended up with:

if (refname is ill-formed)
do nothing
else
look through list of sought refs for a match

if (--all and no match so far)
always consider it matched

That means tha an ill-formed ref will trigger the --all
conditional block, even though we should just be ignoring
it. We can fix that by having a single "else" with all of
the well-formed logic, that checks the sought refs and
"--all" in the correct order.

Reported-by: Kirill Smelkov <kirr@nexedi.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge-submodule: reduce output verbosityLeif Middelschulte Mon, 11 Jun 2018 17:31:28 +0000 (19:31 +0200)

merge-submodule: reduce output verbosity

The output shall behave more similar to ordinary file merges' output to provide
a more consistent user experience.

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

fsck: avoid looking at NULL blob->objectJeff King Mon, 11 Jun 2018 08:35:45 +0000 (04:35 -0400)

fsck: avoid looking at NULL blob->object

Commit 159e7b080b (fsck: detect gitmodules files,
2018-05-02) taught fsck to look at the content of
.gitmodules files. If the object turns out not to be a blob
at all, we just complain and punt on checking the content.
And since this was such an obvious and trivial code path, I
didn't even bother to add a test.

Except it _does_ do one non-trivial thing, which is call the
report() function, which wants us to pass a pointer to a
"struct object". Which we don't have (we have only a "struct
object_id"). So we erroneously pass a NULL object to
report(), which gets dereferenced and causes a segfault.

It seems like we could refactor report() to just take the
object_id itself. But we pass the object pointer along to
a callback function, and indeed this ends up in
builtin/fsck.c's objreport() which does want to look at
other parts of the object (like the type).

So instead, let's just use lookup_unknown_object() to get
the real "struct object", and pass that.

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

t7415: don't bother creating commit for symlink testJeff King Mon, 11 Jun 2018 08:35:40 +0000 (04:35 -0400)

t7415: don't bother creating commit for symlink test

Early versions of the fsck .gitmodules detection code
actually required a tree to be at the root of a commit for
it to be checked for .gitmodules. What we ended up with in
159e7b080b (fsck: detect gitmodules files, 2018-05-02),
though, finds a .gitmodules file in _any_ tree (see that
commit for more discussion).

As a result, there's no need to create a commit in our
tests. Let's drop it in the name of simplicity. And since
that was the only thing referencing $tree, we can pull our
tree creation out of a command substitution.

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

completion: collapse extra --no-.. optionsNguyễn Thái Ngọc Duy Wed, 6 Jun 2018 09:41:39 +0000 (11:41 +0200)

completion: collapse extra --no-.. options

The commands that make use of --git-completion-helper feature could
now produce a lot of --no-xxx options that a command can take. This in
many case could nearly double the amount of completable options, using
more screen estate and also harder to search for the wanted option.

This patch attempts to mitigate that by collapsing extra --no-
options, the ones that are added by --git-completion-helper and not in
original struct option arrays. The "--no-..." option will be displayed
in this case to hint about more options, e.g.

> ~/w/git $ git clone --
--bare --origin=
--branch= --progress
--checkout --quiet
--config= --recurse-submodules
--depth= --reference=
--dissociate --reference-if-able=
--filter= --separate-git-dir=
--hardlinks --shallow-exclude=
--ipv4 --shallow-since=
--ipv6 --shallow-submodules
--jobs= --shared
--local --single-branch
--mirror --tags
--no-... --template=
--no-checkout --upload-pack=
--no-hardlinks --verbose
--no-tags

and when you complete it with --no-<tab>, all negative options will be
presented:

> ~/w/git $ git clone --no-
--no-bare --no-quiet
--no-branch --no-recurse-submodules
--no-checkout --no-reference
--no-config --no-reference-if-able
--no-depth --no-separate-git-dir
--no-dissociate --no-shallow-exclude
--no-filter --no-shallow-since
--no-hardlinks --no-shallow-submodules
--no-ipv4 --no-shared
--no-ipv6 --no-single-branch
--no-jobs --no-tags
--no-local --no-template
--no-mirror --no-upload-pack
--no-origin --no-verbose
--no-progress

Corner case: to make sure that people will never accidentally complete
the fake option "--no-..." there must be one real --no- in the first
complete listing even if it's not from the original struct option.

PS. This could could be made simpler with ";&" to fall through from
"--no-*" block and share the code but ";&" is not available on bash-3
(i.e. Mac)

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

config.c: fix regression for core.safecrlf falseAnthony Sottile Mon, 4 Jun 2018 20:17:42 +0000 (13:17 -0700)

config.c: fix regression for core.safecrlf false

A regression introduced in 8462ff43 ("convert_to_git():
safe_crlf/checksafe becomes int conv_flags", 2018-01-13) back in Git
2.17 cycle caused autocrlf rewrites to produce a warning message
despite setting safecrlf=false.

Signed-off-by: Anthony Sottile <asottile@umich.edu>
Acked-By: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: make forging GPG signed commits and tags more... SZEDER Gábor Mon, 4 Jun 2018 13:39:26 +0000 (15:39 +0200)

tests: make forging GPG signed commits and tags more robust

A couple of test scripts create forged GPG signed commits or tags to
check that such forgery can't fool various git commands' signature
verification. All but one of those test scripts are prone to
occasional failures because the forgery creates a bogus GPG signature,
and git commands error out with an unexpected error message, e.g.
"Commit deadbeef does not have a GPG signature" instead of "... has a
bad GPG signature".

't5573-pull-verify-signatures.sh', 't7510-signed-commit.sh' and
't7612-merge-verify-signatures.sh' create forged signed commits like
this:

git commit -S -m "bad on side" &&
git cat-file commit side-bad >raw &&
sed -e "s/bad/forged bad/" raw >forged &&
git hash-object -w -t commit forged >forged.commit

On rare occasions the given pattern occurs not only in the commit
message but in the GPG signature as well, and after it's replaced in
the signature the resulting signature becomes invalid, GPG will report
CRC error and that it couldn't find any signature, which will then
ultimately cause the test failure.

Since in all three cases the pattern to be replaced during the forgery
is the first word of the commit message's subject line, and since the
GPG signature in the commit object is indented by a space, let's just
anchor those patterns to the beginning of the line to prevent this
issue.

The test script 't7030-verify-tag.sh' creates a forged signed tag
object in a similar way by replacing the pattern "seventh", but the
GPG signature in tag objects is not indented by a space, so the above
solution is not applicable in this case. However, in the tag object
in question the pattern "seventh" occurs not only in the tag message
but in the 'tag' header as well. To create a forged tag object it's
sufficient to replace only one of the two occurences, so modify the
sed script to limit the pattern to the 'tag' header (i.e. a line
beginning with "tag ", which, because of the space character, can
never occur in the base64-encoded GPG signature).

Note that the forgery in 't7004-tag.sh' is not affected by this issue:
while 't7004' does create a forged signed tag kind of the same way,
it replaces "signed-tag" in the tag object, which, because of the '-'
character, can never occur in the base64-encoded GPG signarute.

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

t7510-signed-commit: use 'test_must_fail'SZEDER Gábor Mon, 4 Jun 2018 13:39:25 +0000 (15:39 +0200)

t7510-signed-commit: use 'test_must_fail'

The two tests 'detect fudged signature' and 'detect fudged signature
with NUL' in 't7510-signed-commit.sh' check that 'git verify-commit'
errors out when encountering a forged commit, but they do so by
running

! git verify-commit ...

Use 'test_must_fail' instead, because that would catch potential
unexpected errors like a segfault as well.

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

refspec: initalize `refspec_item` in `valid_fetch_refsp... Martin Ågren Tue, 5 Jun 2018 19:54:40 +0000 (19:54 +0000)

refspec: initalize `refspec_item` in `valid_fetch_refspec()`

We allocate a `struct refspec_item` on the stack without initializing
it. In particular, its `dst` and `src` members will contain some random
data from the stack. When we later call `refspec_item_clear()`, it will
call `free()` on those pointers. So if the call to `parse_refspec()` did
not assign to them, we will be freeing some random "pointers". This is
undefined behavior.

To the best of my understanding, this cannot currently be triggered by
user-provided data. And for what it's worth, the test-suite does not
trigger this with SANITIZE=address. It can be provoked by calling
`valid_fetch_refspec(":*")`.

Zero the struct, as is done in other users of `struct refspec_item` by
using the refspec_item_init() initialization function.

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

refspec: add back a refspec_item_init() functionÆvar Arnfjörð Bjarmason Tue, 5 Jun 2018 19:54:39 +0000 (19:54 +0000)

refspec: add back a refspec_item_init() function

Re-add the non-fatal version of refspec_item_init_or_die() renamed
away in an earlier change to get a more minimal diff. This should be
used by callers that have their own error handling.

This new function could be marked "static" since nothing outside of
refspec.c uses it, but expecting future use of it, let's make it
available to other users.

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

refspec: s/refspec_item_init/&_or_die/gÆvar Arnfjörð Bjarmason Tue, 5 Jun 2018 19:54:38 +0000 (19:54 +0000)

refspec: s/refspec_item_init/&_or_die/g

Rename the refspec_item_init() function introduced in
6d4c057859 ("refspec: introduce struct refspec", 2018-05-16) to
refspec_item_init_or_die().

This follows the convention of other *_or_die() functions, and is done
in preparation for making it a wrapper for a non-fatal variant.

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

add -p: fix counting empty context lines in edited... Phillip Wood Mon, 11 Jun 2018 09:46:02 +0000 (10:46 +0100)

add -p: fix counting empty context lines in edited patches

recount_edited_hunk() introduced in commit 2b8ea7f3c7 ("add -p:
calculate offset delta for edited patches", 2018-03-05) required all
context lines to start with a space, empty lines are not counted. This
was intended to avoid any recounting problems if the user had
introduced empty lines at the end when editing the patch. However this
introduced a regression into 'git add -p' as it seems it is common for
editors to strip the trailing whitespace from empty context lines when
patches are edited thereby introducing empty lines that should be
counted. 'git apply' knows how to deal with such empty lines and POSIX
states that whether or not there is an space on an empty context line
is implementation defined [1].

Fix the regression by counting lines that consist solely of a newline
as well as lines starting with a space as context lines and add a test
to prevent future regressions.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html

Reported-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net>
Reported-by: Oliver Joseph Ash <oliverjash@gmail.com>
Reported-by: Jeff Felchner <jfelchner1@gmail.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

checkout & worktree: introduce checkout.defaultRemoteÆvar Arnfjörð Bjarmason Tue, 5 Jun 2018 14:40:49 +0000 (14:40 +0000)

checkout & worktree: introduce checkout.defaultRemote

Introduce a checkout.defaultRemote setting which can be used to
designate a remote to prefer (via checkout.defaultRemote=origin) when
running e.g. "git checkout master" to mean origin/master, even though
there's other remotes that have the "master" branch.

I want this because it's very handy to use this workflow to checkout a
repository and create a topic branch, then get back to a "master" as
retrieved from upstream:

(
cd /tmp &&
rm -rf tbdiff &&
git clone git@github.com:trast/tbdiff.git &&
cd tbdiff &&
git branch -m topic &&
git checkout master
)

That will output:

Branch 'master' set up to track remote branch 'master' from 'origin'.
Switched to a new branch 'master'

But as soon as a new remote is added (e.g. just to inspect something
from someone else) the DWIMery goes away:

(
cd /tmp &&
rm -rf tbdiff &&
git clone git@github.com:trast/tbdiff.git &&
cd tbdiff &&
git branch -m topic &&
git remote add avar git@github.com:avar/tbdiff.git &&
git fetch avar &&
git checkout master
)

Will output (without the advice output added earlier in this series):

error: pathspec 'master' did not match any file(s) known to git.

The new checkout.defaultRemote config allows me to say that whenever
that ambiguity comes up I'd like to prefer "origin", and it'll still
work as though the only remote I had was "origin".

Also adjust the advice.checkoutAmbiguousRemoteBranchName message to
mention this new config setting to the user, the full output on my
git.git is now (the last paragraph is new):

$ ./git --exec-path=$PWD checkout master
error: pathspec 'master' did not match any file(s) known to git.
hint: 'master' matched more than one remote tracking branch.
hint: We found 26 remotes with a reference that matched. So we fell back
hint: on trying to resolve the argument as a path, but failed there too!
hint:
hint: If you meant to check out a remote tracking branch on, e.g. 'origin',
hint: you can do so by fully qualifying the name with the --track option:
hint:
hint: git checkout --track origin/<name>
hint:
hint: If you'd like to always have checkouts of an ambiguous <name> prefer
hint: one remote, e.g. the 'origin' remote, consider setting
hint: checkout.defaultRemote=origin in your config.

I considered splitting this into checkout.defaultRemote and
worktree.defaultRemote, but it's probably less confusing to break our
own rules that anything shared between config should live in core.*
than have two config settings, and I couldn't come up with a short
name under core.* that made sense (core.defaultRemoteForCheckout?).

See also 70c9ac2f19 ("DWIM "git checkout frotz" to "git checkout -b
frotz origin/frotz"", 2009-10-18) which introduced this DWIM feature
to begin with, and 4e85333197 ("worktree: make add <path> <branch>
dwim", 2017-11-26) which added it to git-worktree.

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

checkout: add advice for ambiguous "checkout <branch>"Ævar Arnfjörð Bjarmason Tue, 5 Jun 2018 14:40:48 +0000 (14:40 +0000)

checkout: add advice for ambiguous "checkout <branch>"

As the "checkout" documentation describes:

If <branch> is not found but there does exist a tracking branch in
exactly one remote (call it <remote>) with a matching name, treat
as equivalent to [...] <remote>/<branch.

This is a really useful feature. The problem is that when you add
another remote (e.g. a fork), git won't find a unique branch name
anymore, and will instead print this unhelpful message:

$ git checkout master
error: pathspec 'master' did not match any file(s) known to git

Now it will, on my git.git checkout, print:

$ ./git --exec-path=$PWD checkout master
error: pathspec 'master' did not match any file(s) known to git.
hint: 'master' matched more than one remote tracking branch.
hint: We found 26 remotes with a reference that matched. So we fell back
hint: on trying to resolve the argument as a path, but failed there too!
hint:
hint: If you meant to check out a remote tracking branch on, e.g. 'origin',
hint: you can do so by fully qualifying the name with the --track option:
hint:
hint: git checkout --track origin/<name>

Note that the "error: pathspec[...]" message is still printed. This is
because whatever else checkout may have tried earlier, its final
fallback is to try to resolve the argument as a path. E.g. in this
case:

$ ./git --exec-path=$PWD checkout master pu
error: pathspec 'master' did not match any file(s) known to git.
error: pathspec 'pu' did not match any file(s) known to git.

There we don't print the "hint:" implicitly due to earlier logic
around the DWIM fallback. That fallback is only used if it looks like
we have one argument that might be a branch.

I can't think of an intrinsic reason for why we couldn't in some
future change skip printing the "error: pathspec[...]" error. However,
to do so we'd need to pass something down to checkout_paths() to make
it suppress printing an error on its own, and for us to be confident
that we're not silencing cases where those errors are meaningful.

I don't think that's worth it since determining whether that's the
case could easily change due to future changes in the checkout logic.

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

builtin/checkout.c: use "ret" variable for returnÆvar Arnfjörð Bjarmason Tue, 5 Jun 2018 14:40:47 +0000 (14:40 +0000)

builtin/checkout.c: use "ret" variable for return

There is no point in doing this right now, but in later change the
"ret" variable will be inspected. This change makes that meaningful
change smaller.

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

checkout: pass the "num_matches" up to callersÆvar Arnfjörð Bjarmason Tue, 5 Jun 2018 14:40:46 +0000 (14:40 +0000)

checkout: pass the "num_matches" up to callers

Pass the previously added "num_matches" struct value up to the callers
of unique_tracking_name(). This will allow callers to optionally print
better error messages in a later change.

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

checkout.c: change "unique" member to "num_matches"Ævar Arnfjörð Bjarmason Tue, 5 Jun 2018 14:40:45 +0000 (14:40 +0000)

checkout.c: change "unique" member to "num_matches"

Internally track how many matches we find in the check_tracking_name()
callback. Nothing uses this now, but it will be made use of in a later
change.

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

checkout.c: introduce an *_INIT macroÆvar Arnfjörð Bjarmason Tue, 5 Jun 2018 14:40:44 +0000 (14:40 +0000)

checkout.c: introduce an *_INIT macro

Add an *_INIT macro for the tracking_name_data similar to what exists
elsewhere in the codebase, e.g. OID_ARRAY_INIT in sha1-array.h. This
will make it more idiomatic in later changes to add more fields to the
struct & its initialization macro.

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

checkout.h: wrap the arguments to unique_tracking_name()Ævar Arnfjörð Bjarmason Tue, 5 Jun 2018 14:40:43 +0000 (14:40 +0000)

checkout.h: wrap the arguments to unique_tracking_name()

The line was too long already, and will be longer still when a later
change adds another argument.

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

checkout tests: index should be clean after dwim checkoutÆvar Arnfjörð Bjarmason Tue, 5 Jun 2018 14:40:42 +0000 (14:40 +0000)

checkout tests: index should be clean after dwim checkout

Assert that whenever there's a DWIM checkout that the index should be
clean afterwards, in addition to the correct branch being checked-out.

The way the DWIM checkout code in checkout.[ch] works is by looping
over all remotes, and for each remote trying to find if a given
reference name only exists on that remote, or if it exists anywhere
else.

This is done by starting out with a `unique = 1` tracking variable in
a struct shared by the entire loop, which will get set to `0` if the
data reference is not unique.

Thus if we find a match we know the dst_oid member of
tracking_name_data must be correct, since it's associated with the
only reference on the only remote that could have matched our query.

But if there was ever a mismatch there for some reason we might end up
with the correct branch checked out, but at the wrong oid, which would
show whatever the difference between the two staged in the
index (checkout branch A, stage changes from the state of branch B).

So let's amend the tests (mostly added in) 399e4a1c56 ("t2024: Add
tests verifying current DWIM behavior of 'git checkout <branch>'",
2013-04-21) to always assert that "status" is clean after we run
"checkout", that's being done with "-uno" because there's going to be
some untracked files related to the test itself which we don't care
about.

In all these tests (DWIM or otherwise) we start with a clean index, so
these tests are asserting that that's still the case after the
"checkout", failed or otherwise.

Then if we ever run into this sort of regression, either in the
existing code or with a new feature, we'll know.

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

RelNotes 2.18: typofixesJunio C Hamano Mon, 11 Jun 2018 16:15:34 +0000 (09:15 -0700)

RelNotes 2.18: typofixes

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

l10n: es.po: Spanish update for v2.18.0 round 2Christopher Diaz Riveros Sun, 10 Jun 2018 19:08:26 +0000 (14:08 -0500)

l10n: es.po: Spanish update for v2.18.0 round 2

Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>

l10n: sv.po: Update Swedish translation (3608t0f0u)Peter Krefting Fri, 8 Jun 2018 21:53:44 +0000 (22:53 +0100)

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

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

l10n: sv.po: Update Swedish translation (3470t0f0u)Peter Krefting Fri, 1 Jun 2018 13:45:34 +0000 (14:45 +0100)

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

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

l10n: git.pot: v2.18.0 round 2 (144 new, 6 removed)Jiang Xin Fri, 8 Jun 2018 01:17:29 +0000 (09:17 +0800)

l10n: git.pot: v2.18.0 round 2 (144 new, 6 removed)

Generate po/git.pot from v2.18.0-rc1 for git v2.18.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, 8 Jun 2018 01:01:56 +0000 (09:01 +0800)

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

* 'master' of git://github.com/git-l10n/git-po:
l10n: fr.po v2.18 round 1
l10n: vi(3470t): Updated Vietnamese translation for v2.18.0
l10n: es.po: Spanish update for v2.18.0 round 1
l10n: git.pot: v2.18.0 round 1 (108 new, 14 removed)
l10n: TEAMS: remove inactive de team members
l10n: de.po: fix typos
l10n: Update Catalan translation

Git 2.18-rc1 v2.18.0-rc1Junio C Hamano Mon, 4 Jun 2018 12:41:41 +0000 (21:41 +0900)

Git 2.18-rc1

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

Merge branch 'bc/t3430-fixup'Junio C Hamano Mon, 4 Jun 2018 12:39:50 +0000 (21:39 +0900)

Merge branch 'bc/t3430-fixup'

Test fix.

* bc/t3430-fixup:
t3430: test clean-up

Merge branch 'bw/refspec-api'Junio C Hamano Mon, 4 Jun 2018 12:39:50 +0000 (21:39 +0900)

Merge branch 'bw/refspec-api'

Hotfix.

* bw/refspec-api:
refspec-api: avoid uninitialized field in refspec item

Merge branch 'tg/doc-sec-list'Junio C Hamano Mon, 4 Jun 2018 12:39:49 +0000 (21:39 +0900)

Merge branch 'tg/doc-sec-list'

Doc update.

* tg/doc-sec-list:
note git-security@googlegroups.com in more places
SubmittingPatches: replace numbered attributes with names

Merge branch 'rd/p4-doc-markup-env'Junio C Hamano Mon, 4 Jun 2018 12:39:49 +0000 (21:39 +0900)

Merge branch 'rd/p4-doc-markup-env'

Doc markup update.

* rd/p4-doc-markup-env:
p4.txt: Use backquotes for variable names

Merge branch 'nd/remote-update-doc'Junio C Hamano Mon, 4 Jun 2018 12:39:48 +0000 (21:39 +0900)

Merge branch 'nd/remote-update-doc'

"git remote update" can take both a single remote nickname and a
nickname for remote groups, but only one of them was documented.

* nd/remote-update-doc:
remote: doc typofix
remote.txt: update documentation for 'update' command

Merge branch 'jt/submodule-pull-recurse-rebase'Junio C Hamano Mon, 4 Jun 2018 12:39:48 +0000 (21:39 +0900)

Merge branch 'jt/submodule-pull-recurse-rebase'

"git pull -recurse-submodules --rebase", when the submodule
repository's history did not have anything common between ours and
the upstream's, failed to execute. We need to fetch from them to
continue even in such a case.

* jt/submodule-pull-recurse-rebase:
submodule: do not pass null OID to setup_revisions

remote: doc typofixDuy Nguyen Wed, 30 May 2018 15:37:01 +0000 (17:37 +0200)

remote: doc typofix

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

update-ref --stdin: use skip_prefix()SZEDER Gábor Sun, 3 Jun 2018 14:36:51 +0000 (16:36 +0200)

update-ref --stdin: use skip_prefix()

Use skip_prefix() instead of starts_with() and strcmp() when parsing
'git update-ref's stdin to avoid a couple of magic numbers.

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

sha1-file.c: correct $GITDIR to $GIT_DIR in a commentRobert P. J. Day Sun, 3 Jun 2018 14:32:50 +0000 (10:32 -0400)

sha1-file.c: correct $GITDIR to $GIT_DIR in a comment

Fix single misspelling of $GITDIR to correct $GIT_DIR in a comment.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer.c: plug leaks in do_pick_commitStefan Beller Fri, 1 Jun 2018 20:01:45 +0000 (13:01 -0700)

sequencer.c: plug leaks in do_pick_commit

Going to leave, we additionally free the author and commit message
and make sure to call update_abort_safety_file().

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

t9104: kosherly remove remote refsChristian Couder Fri, 1 Jun 2018 05:08:33 +0000 (07:08 +0200)

t9104: kosherly remove remote refs

As there are plans to implement other ref storage systems,
let's use a way to remove remote refs that does not depend
on refs being files.

This makes it clear to readers that this test does not
depend on which ref backend is used.

Suggested-by: Michael Haggerty <mhagger@alum.mit.edu>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3430: test clean-upbrian m. carlson Fri, 1 Jun 2018 17:46:39 +0000 (17:46 +0000)

t3430: test clean-up

Remove unnecessary test_tick etc...

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

upload-pack: reject shallow requests that would return... Nguyễn Thái Ngọc Duy Sat, 26 May 2018 11:35:18 +0000 (13:35 +0200)

upload-pack: reject shallow requests that would return nothing

Shallow clones with --shallow-since or --shalow-exclude work by
running rev-list to get all reachable commits, then draw a boundary
between reachable and unreachable and send "shallow" requests based on
that.

The code does miss one corner case: if rev-list returns nothing, we'll
have no border and we'll send no shallow requests back to the client
(i.e. no history cuts). This essentially means a full clone (or a full
branch if the client requests just one branch). One example is the
oldest commit is older than what is specified by --shallow-since.

To avoid this, if rev-list returns nothing, we abort the clone/fetch.
The user could adjust their request (e.g. --shallow-since further back
in the past) and retry.

Another possible option for this case is to fall back to a default
depth (like depth 1). But I don't like too much magic that way because
we may return something unexpected to the user. If they request
"history since 2008" and we return a single depth at 2000, that might
break stuff for them. It is better to tell them that something is
wrong and let them take the best course of action.

Note that we need to die() in get_shallow_commits_by_rev_list()
instead of just checking for empty result from its caller
deepen_by_rev_list() and handling the error there. The reason is,
empty result could be a valid case: if you have commits in year 2013
and you request --shallow-since=year.2000 then you should get a full
clone (i.e. empty result).

Reported-by: Andreas Krey <a.krey@gmx.de>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'fr_2.18_round1' of git://github.com/jnavi... Jiang Xin Sun, 3 Jun 2018 23:58:22 +0000 (07:58 +0800)

Merge branch 'fr_2.18_round1' of git://github.com/jnavila/git

* 'fr_2.18_round1' of git://github.com/jnavila/git:
l10n: fr.po v2.18 round 1

l10n: fr.po v2.18 round 1Jean-Noël Avila Sun, 3 Jun 2018 14:36:32 +0000 (16:36 +0200)

l10n: fr.po v2.18 round 1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>

l10n: vi(3470t): Updated Vietnamese translation for... Tran Ngoc Quan Sun, 3 Jun 2018 06:43:13 +0000 (13:43 +0700)

l10n: vi(3470t): Updated Vietnamese translation for v2.18.0

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

l10n: es.po: Spanish update for v2.18.0 round 1Christopher Diaz Riveros Fri, 1 Jun 2018 04:10:47 +0000 (23:10 -0500)

l10n: es.po: Spanish update for v2.18.0 round 1

Signed-off-by: Christopher Diaz Riveros <chrisadr@gentoo.org>

A bit more topics before -rc1Junio C Hamano Fri, 1 Jun 2018 06:16:15 +0000 (15:16 +0900)

A bit more topics before -rc1

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

Merge branch 'bw/ref-prefix-for-configured-refspec'Junio C Hamano Fri, 1 Jun 2018 06:15:35 +0000 (15:15 +0900)

Merge branch 'bw/ref-prefix-for-configured-refspec'

* bw/ref-prefix-for-configured-refspec:
fetch: do not pass ref-prefixes for fetch by exact SHA1

fetch: do not pass ref-prefixes for fetch by exact... Jonathan Nieder Thu, 31 May 2018 07:23:39 +0000 (00:23 -0700)

fetch: do not pass ref-prefixes for fetch by exact SHA1

When v2.18.0-rc0~10^2~1 (refspec: consolidate ref-prefix generation
logic, 2018-05-16) factored out the ref-prefix generation code for
reuse, it left out the 'if (!item->exact_sha1)' test in the original
ref-prefix generation code. As a result, fetches by SHA-1 generate
ref-prefixes as though the SHA-1 being fetched were an abbreviated ref
name:

$ GIT_TRACE_PACKET=1 bin-wrappers/git -c protocol.version=2 \
fetch origin 12039e008f9a4e3394f3f94f8ea897785cb09448
[...]
packet: fetch> ref-prefix 12039e008f9a4e3394f3f94f8ea897785cb09448
packet: fetch> ref-prefix refs/12039e008f9a4e3394f3f94f8ea897785cb09448
packet: fetch> ref-prefix refs/tags/12039e008f9a4e3394f3f94f8ea897785cb09448
packet: fetch> ref-prefix refs/heads/12039e008f9a4e3394f3f94f8ea897785cb09448
packet: fetch> ref-prefix refs/remotes/12039e008f9a4e3394f3f94f8ea897785cb09448
packet: fetch> ref-prefix refs/remotes/12039e008f9a4e3394f3f94f8ea897785cb09448/HEAD
packet: fetch> 0000

If there is another ref name on the command line or the object being
fetched is already available locally, then that's mostly harmless.
But otherwise, we error out with

fatal: no matching remote head

since the server did not send any refs we are interested in. Filter
out the exact_sha1 refspecs to avoid this.

This patch adds a test to check this behavior that notices another
behavior difference between protocol v0 and v2 in the process. Add a
NEEDSWORK comment to clear it up.

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

Merge branch 'cc/tests-without-assuming-ref-files-backend'Junio C Hamano Fri, 1 Jun 2018 06:06:41 +0000 (15:06 +0900)

Merge branch 'cc/tests-without-assuming-ref-files-backend'

Quite a many tests assumed that newly created refs are made as
loose refs using the files backend, which have been updated to use
proper plumbing like rev-parse and update-ref, to avoid breakage
once we start using different ref backends.

* cc/tests-without-assuming-ref-files-backend:
t990X: use '.git/objects' as 'deep inside .git' path
t: make many tests depend less on the refs being files

Merge branch 'rd/init-typo'Junio C Hamano Fri, 1 Jun 2018 06:06:40 +0000 (15:06 +0900)

Merge branch 'rd/init-typo'

Message fix.

* rd/init-typo:
init: fix grammar in "templates not found" msg

Merge branch 'js/rebase-recreate-merge'Junio C Hamano Fri, 1 Jun 2018 06:06:40 +0000 (15:06 +0900)

Merge branch 'js/rebase-recreate-merge'

Hotfixes.

* js/rebase-recreate-merge:
sequencer: ensure labels that are object IDs are rewritten
git-rebase--interactive: fix copy-paste mistake

Merge branch 'rd/tag-doc-lightweight'Junio C Hamano Fri, 1 Jun 2018 06:06:39 +0000 (15:06 +0900)

Merge branch 'rd/tag-doc-lightweight'

Docfix.

* rd/tag-doc-lightweight:
tag: clarify in the doc that a tag can refer to a non-commit object

Merge branch 'rd/doc-options-placeholder'Junio C Hamano Fri, 1 Jun 2018 06:06:39 +0000 (15:06 +0900)

Merge branch 'rd/doc-options-placeholder'

Docfix.

* rd/doc-options-placeholder:
Use proper syntax for replaceables in command docs

Merge branch 'en/rev-parse-invalid-range'Junio C Hamano Fri, 1 Jun 2018 06:06:39 +0000 (15:06 +0900)

Merge branch 'en/rev-parse-invalid-range'

"git rev-parse Y..." etc. misbehaved when given endpoints were
not committishes.

* en/rev-parse-invalid-range:
rev-parse: check lookup'ed commit references for NULL

Merge branch 'ld/p4-unshelve'Junio C Hamano Fri, 1 Jun 2018 06:06:38 +0000 (15:06 +0900)

Merge branch 'ld/p4-unshelve'

"git p4" learned to "unshelve" shelved commit from P4.

* ld/p4-unshelve:
git-p4: add unshelve command

Merge branch 'nd/use-opt-int-set-f'Junio C Hamano Fri, 1 Jun 2018 06:06:38 +0000 (15:06 +0900)

Merge branch 'nd/use-opt-int-set-f'

Code simplification.

* nd/use-opt-int-set-f:
Use OPT_SET_INT_F() for cmdline option specification

Merge branch 'pa/import-tars-long-names'Junio C Hamano Fri, 1 Jun 2018 06:06:38 +0000 (15:06 +0900)

Merge branch 'pa/import-tars-long-names'

The import-tars script (in contrib/) has been taught to handle
tarballs with overly long paths that use PAX extended headers.

* pa/import-tars-long-names:
import-tars: read overlong names from pax extended header

Merge branch 'nd/command-list'Junio C Hamano Fri, 1 Jun 2018 06:06:37 +0000 (15:06 +0900)

Merge branch 'nd/command-list'

The list of commands with their various attributes were spread
across a few places in the build procedure, but it now is getting a
bit more consolidated to allow more automation.

* nd/command-list:
completion: allow to customize the completable command list
completion: add and use --list-cmds=alias
completion: add and use --list-cmds=nohelpers
Move declaration for alias.c to alias.h
completion: reduce completable command list
completion: let git provide the completable command list
command-list.txt: documentation and guide line
help: use command-list.txt for the source of guides
help: add "-a --verbose" to list all commands with synopsis
git: support --list-cmds=list-<category>
completion: implement and use --list-cmds=main,others
git --list-cmds: collect command list in a string_list
git.c: convert --list-* to --list-cmds=*
Remove common-cmds.h
help: use command-list.h for common command list
generate-cmds.sh: export all commands to command-list.h
generate-cmds.sh: factor out synopsis extract code

submodule--helper: plug mem leak in print_default_remoteStefan Beller Wed, 30 May 2018 17:03:02 +0000 (10:03 -0700)

submodule--helper: plug mem leak in print_default_remote

Signed-off-by: Stefan Beller <sbeller@google.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
[jc: no need for remote to be const char *]
Signed-off-by: Junio C Hamano <gitster@pobox.com>

index-pack: handle --strict checks of non-repo packsJeff King Thu, 31 May 2018 22:45:31 +0000 (18:45 -0400)

index-pack: handle --strict checks of non-repo packs

Commit 73c3f0f704 (index-pack: check .gitmodules files with
--strict, 2018-05-04) added a call to add_packed_git(), with
the intent that the newly-indexed objects would be available
to the process when we run fsck_finish(). But that's not
what add_packed_git() does. It only allocates the struct,
and you must install_packed_git() on the result. So that
call was effectively doing nothing (except leaking a
struct).

But wait, we passed all of the tests! Does that mean we
don't need the call at all?

For normal cases, no. When we run "index-pack --stdin"
inside a repository, we write the new pack into the object
directory. If fsck_finish() needs to access one of the new
objects, then our initial lookup will fail to find it, but
we'll follow up by running reprepare_packed_git() and
looking again. That logic was meant to handle somebody else
repacking simultaneously, but it ends up working for us
here.

But there is a case that does need this, that we were not
testing. You can run "git index-pack foo.pack" on any file,
even when it is not inside the object directory. Or you may
not even be in a repository at all! This case fails without
doing the proper install_packed_git() call.

We can make this work by adding the install call.

Note that we should be prepared to handle add_packed_git()
failing. We can just silently ignore this case, though. If
fsck_finish() later needs the objects and they're not
available, it will complain itself. And if it doesn't
(because we were able to resolve the whole fsck in the first
pass), then it actually isn't an interesting error at all.

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

prepare_commit_graft: treat non-repository as a noopJeff King Thu, 31 May 2018 22:42:53 +0000 (18:42 -0400)

prepare_commit_graft: treat non-repository as a noop

The parse_commit_buffer() function consults lookup_commit_graft()
to see if we need to rewrite parents. The latter will look
at $GIT_DIR/info/grafts. If you're outside of a repository,
then this will trigger a BUG() as of b1ef400eec (setup_git_env:
avoid blind fall-back to ".git", 2016-10-20).

It's probably uncommon to actually parse a commit outside of
a repository, but you can see it in action with:

cd /not/a/git/repo
git index-pack --strict /some/file.pack

This works fine without --strict, but the fsck checks will
try to parse any commits, triggering the BUG(). We can fix
that by teaching the graft code to behave as if there are no
grafts when we aren't in a repository.

Arguably index-pack (and fsck) are wrong to consider grafts
at all. So another solution is to disable grafts entirely
for those commands. But given that the graft feature is
deprecated anyway, it's not worth even thinking through the
ramifications that might have.

There is one other corner case I considered here. What
should:

cd /not/a/git/repo
export GIT_GRAFT_FILE=/file/with/grafts
git index-pack --strict /some/file.pack

do? We don't have a repository, but the user has pointed us
directly at a graft file, which we could respect. I believe
this case did work that way prior to b1ef400eec. However,
fixing it now would be pretty invasive. Back then we would
just call into setup_git_env() even without a repository.
But these days it actually takes a git_dir argument. So
there would be a fair bit of refactoring of the setup code
involved.

Given the obscurity of this case, plus the fact that grafts
are deprecated and probably shouldn't work under index-pack
anyway, it's not worth pursuing further. This patch at least
un-breaks the common case where you're _not_ using grafts,
but we BUG() anyway trying to even find that out.

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

refspec-api: avoid uninitialized field in refspec itemJunio C Hamano Fri, 1 Jun 2018 02:33:19 +0000 (11:33 +0900)

refspec-api: avoid uninitialized field in refspec item

When parse_refspec() function was created at 3eec3700 ("refspec:
factor out parsing a single refspec", 2018-05-16) to take a caller
supplied piece of memory to fill parsed refspec_item, it forgot that
a refspec without colon must set item->dst to NULL to let the users
of refspec know that the result of the fetch does not get stored in
an ref on our side.

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

refs/packed-backend.c: close fd of empty fileStefan Beller Wed, 30 May 2018 17:03:00 +0000 (10:03 -0700)

refs/packed-backend.c: close fd of empty file

Signed-off-by: Stefan Beller <sbeller@google.com>
Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

p4.txt: Use backquotes for variable namesRobert P. J. Day Wed, 30 May 2018 13:04:00 +0000 (09:04 -0400)

p4.txt: Use backquotes for variable names

For consistency, use backquotes when referring to environment
variables, as is done in other man pages.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote.txt: update documentation for 'update' commandDuy Nguyen Wed, 30 May 2018 15:37:01 +0000 (17:37 +0200)

remote.txt: update documentation for 'update' command

Commit b344e1614b (git remote update: Fallback to remote if group does
not exist - 2009-04-06) lets "git remote update" accept individual
remotes as well. Previously this command only accepted remote
groups. The commit updates the command syntax but not the actual
document of this subcommand. Update it.

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

completion: complete remote names tooŁukasz Stelmach Fri, 25 May 2018 10:48:42 +0000 (12:48 +0200)

completion: complete remote names too

"git remote update" accepts both groups and single remotes.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Reviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

RelNotes: remove duplicate release noteElijah Newren Thu, 31 May 2018 03:24:14 +0000 (20:24 -0700)

RelNotes: remove duplicate release note

In the 2.18 cycle, directory rename detection was merged, then reverted,
then reworked in such a way to fix another prominent bug in addition to
the original problem causing it to be reverted. When the reworked series
was merged, we ended up with two nearly duplicate release notes. Remove
the second copy, but preserve the information about the extra bug fix.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: remove -p code from git-rebase--interactive.shAlban Gruin Mon, 28 May 2018 12:34:22 +0000 (14:34 +0200)

rebase: remove -p code from git-rebase--interactive.sh

All the code specific to preserve-merges was moved to
git-rebase--preserve-merges.sh, and so it’s useless to keep it
here.

The intent of this commit is to clean this script as much as possible to
prepare a peaceful conversion as a builtin written in C.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>

rebase: use the new git-rebase--preserve-merges.shAlban Gruin Mon, 28 May 2018 12:34:21 +0000 (14:34 +0200)

rebase: use the new git-rebase--preserve-merges.sh

Create a new type of rebase, "preserve-merges", used when rebase is
called with -p.

Before that, the type for preserve-merges was "interactive", and some
places of this script compared $type to "interactive". Instead, the code
now checks if $interactive_rebase is empty or not, as it is set to
"explicit" when calling an interactive rebase (and, possibly, one of its
submodes), and "implied" when calling one of its
submodes (eg. preserve-merges) *without* interactive rebase.

It also detects the presence of the directory "$merge_dir"/rewritten
left by the preserve-merges script when calling rebase --continue,
--skip, etc., and, if it exists, sets the rebase mode to
preserve-merges. In this case, interactive_rebase is set to "explicit",
as "implied" would break some tests.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>

rebase: strip unused code in git-rebase--preserve-merges.shAlban Gruin Mon, 28 May 2018 12:34:20 +0000 (14:34 +0200)

rebase: strip unused code in git-rebase--preserve-merges.sh

This removes the code coming from git-rebase--interactive.sh that is not
needed by preserve-merges, and changes the header comment accordingly.

In a following commit, the -p code from git-rebase--interactive.sh will
be stripped out. As preserve-merges’ successor is already in the works,
this will be the only script to be converted.

This also seems to fix a bug where a failure in
`pick_one_preserving_merges()` would fallback to the non-preserve-merges
`pick_one()`.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>

rebase: introduce a dedicated backend for --preserve... Alban Gruin Mon, 28 May 2018 12:34:19 +0000 (14:34 +0200)

rebase: introduce a dedicated backend for --preserve-merges

This duplicates git-rebase--interactive.sh to
git-rebase--preserve-merges.sh. This is done to split -p from -i. No
modifications are made to this file here, but any code that is not used
by -p will be stripped in the next commit.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>

note git-security@googlegroups.com in more placesThomas Gummerer Wed, 30 May 2018 20:52:55 +0000 (21:52 +0100)

note git-security@googlegroups.com in more places

Add a mention of the security mailing list to the README, and to
Documentation/SubmittingPatches.. 2caa7b8d27 ("git manpage: note
git-security@googlegroups.com", 2018-03-08) already added it to the
man page, but for developers either the README, or the documentation
on how to contribute (SubmittingPatches) may be the first place to
look.

Use the same wording as we already have on the git-scm.com website and
in the man page for the README, while the wording is adjusted in
SubmittingPatches to match the surrounding document better.

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

SubmittingPatches: replace numbered attributes with... Thomas Gummerer Wed, 30 May 2018 20:52:54 +0000 (21:52 +0100)

SubmittingPatches: replace numbered attributes with names

Use names instead of numbers for the AsciiDoc attributes that are used
for the footnotes. We will add more footnotes in subsequent commits,
and attributes should ideally all be unique. Having named attributes
will help ensure uniqueness, and we won't have to re-number the
attributes if we add a footnote earlier in the document.

In addition it also clarifies that the attribute name/number is not
related to the number the footnote will get in the output.

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

l10n: git.pot: v2.18.0 round 1 (108 new, 14 removed)Jiang Xin Thu, 31 May 2018 15:35:22 +0000 (23:35 +0800)

l10n: git.pot: v2.18.0 round 1 (108 new, 14 removed)

Generate po/git.pot from v2.18.0-rc0 for git v2.18.0 l10n round 1.

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

Merge remote-tracking branch 'git-po/maint'Jiang Xin Thu, 31 May 2018 15:30:13 +0000 (23:30 +0800)

Merge remote-tracking branch 'git-po/maint'

* git-po/maint:
l10n: TEAMS: remove inactive de team members
l10n: de.po: fix typos
l10n: Update Catalan translation

Git 2.18-rc0 v2.18.0-rc0Junio C Hamano Wed, 30 May 2018 12:51:57 +0000 (21:51 +0900)

Git 2.18-rc0

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

Merge branch 'bw/remote-curl-compressed-responses'Junio C Hamano Wed, 30 May 2018 12:51:29 +0000 (21:51 +0900)

Merge branch 'bw/remote-curl-compressed-responses'

Our HTTP client code used to advertise that we accept gzip encoding
from the other side; instead, just let cURL library to advertise
and negotiate the best one.

* bw/remote-curl-compressed-responses:
remote-curl: accept compressed responses with protocol v2
remote-curl: accept all encodings supported by curl

Merge branch 'ma/unpack-trees-free-msgs'Junio C Hamano Wed, 30 May 2018 12:51:29 +0000 (21:51 +0900)

Merge branch 'ma/unpack-trees-free-msgs'

Leak plugging.

* ma/unpack-trees-free-msgs:
unpack_trees_options: free messages when done
argv-array: return the pushed string from argv_push*()
merge-recursive: provide pair of `unpack_trees_{start,finish}()`
merge: setup `opts` later in `checkout_fast_forward()`

Merge branch 'bc/hash-independent-tests'Junio C Hamano Wed, 30 May 2018 12:51:28 +0000 (21:51 +0900)

Merge branch 'bc/hash-independent-tests'

Many tests hardcode the raw object names, which would change once
we migrate away from SHA-1. While some of them must test against
exact object names, most of them do not have to use hardcoded
constants in the test. The latter kind of tests have been updated
to test the moral equivalent of the original without hardcoding the
actual object names.

* bc/hash-independent-tests: (28 commits)
t5300: abstract away SHA-1-specific constants
t4208: abstract away SHA-1-specific constants
t4045: abstract away SHA-1-specific constants
t4042: abstract away SHA-1-specific constants
t4205: sort log output in a hash-independent way
t/lib-diff-alternative: abstract away SHA-1-specific constants
t4030: abstract away SHA-1-specific constants
t4029: abstract away SHA-1-specific constants
t4029: fix test indentation
t4022: abstract away SHA-1-specific constants
t4020: abstract away SHA-1-specific constants
t4014: abstract away SHA-1-specific constants
t4008: abstract away SHA-1-specific constants
t4007: abstract away SHA-1-specific constants
t3905: abstract away SHA-1-specific constants
t3702: abstract away SHA-1-specific constants
t3103: abstract away SHA-1-specific constants
t2203: abstract away SHA-1-specific constants
t: skip pack tests if not using SHA-1
t4044: skip test if not using SHA-1
...

Merge branch 'ma/regex-no-regfree-after-comp-fail'Junio C Hamano Wed, 30 May 2018 12:51:28 +0000 (21:51 +0900)

Merge branch 'ma/regex-no-regfree-after-comp-fail'

We used to call regfree() after regcomp() failed in some codepaths,
which have been corrected.

* ma/regex-no-regfree-after-comp-fail:
regex: do not call `regfree()` if compilation fails

Merge branch 'ma/config-store-data-clear'Junio C Hamano Wed, 30 May 2018 12:51:28 +0000 (21:51 +0900)

Merge branch 'ma/config-store-data-clear'

Leak plugging.

* ma/config-store-data-clear:
config: let `config_store_data_clear()` handle `key`
config: let `config_store_data_clear()` handle `value_regex`
config: free resources of `struct config_store_data`

Merge branch 'jk/snprintf-truncation'Junio C Hamano Wed, 30 May 2018 12:51:27 +0000 (21:51 +0900)

Merge branch 'jk/snprintf-truncation'

Avoid unchecked snprintf() to make future code auditing easier.

* jk/snprintf-truncation:
fmt_with_err: add a comment that truncation is OK
shorten_unambiguous_ref: use xsnprintf
fsmonitor: use internal argv_array of struct child_process
log_write_email_headers: use strbufs
http: use strbufs instead of fixed buffers

Merge branch 'jk/config-blob-sans-repo'Junio C Hamano Wed, 30 May 2018 12:51:27 +0000 (21:51 +0900)

Merge branch 'jk/config-blob-sans-repo'

Error codepath fix.

* jk/config-blob-sans-repo:
config: die when --blob is used outside a repository

Merge branch 'sb/submodule-merge-in-merge-recursive'Junio C Hamano Wed, 30 May 2018 12:51:27 +0000 (21:51 +0900)

Merge branch 'sb/submodule-merge-in-merge-recursive'

By code restructuring of submodule merge in merge-recursive,
informational messages from the codepath are now given using the
same mechanism as other output, and honor the merge.verbosity
configuration. The code also learned to give a few new messages
when a submodule three-way merge resolves cleanly when one side
records a descendant of the commit chosen by the other side.

* sb/submodule-merge-in-merge-recursive:
merge-recursive: give notice when submodule commit gets fast-forwarded
merge-recursive: i18n submodule merge output and respect verbosity
submodule.c: move submodule merging to merge-recursive.c

Merge branch 'js/empty-config-section-fix'Junio C Hamano Wed, 30 May 2018 12:51:26 +0000 (21:51 +0900)

Merge branch 'js/empty-config-section-fix'

Error codepath fix.

* js/empty-config-section-fix:
config: a user-provided invalid section is not a BUG

Merge branch 'bw/ref-prefix-for-configured-refspec'Junio C Hamano Wed, 30 May 2018 12:51:26 +0000 (21:51 +0900)

Merge branch 'bw/ref-prefix-for-configured-refspec'

"git fetch $there $refspec" that talks over protocol v2 can take
advantage of server-side ref filtering; the code has been extended
so that this mechanism triggers also when fetching with configured
refspec.

* bw/ref-prefix-for-configured-refspec: (38 commits)
fetch: generate ref-prefixes when using a configured refspec
refspec: consolidate ref-prefix generation logic
submodule: convert push_unpushed_submodules to take a struct refspec
remote: convert check_push_refs to take a struct refspec
remote: convert match_push_refs to take a struct refspec
http-push: store refspecs in a struct refspec
transport: remove transport_verify_remote_names
send-pack: store refspecs in a struct refspec
transport: convert transport_push to take a struct refspec
push: convert to use struct refspec
push: check for errors earlier
remote: convert match_explicit_refs to take a struct refspec
remote: convert get_ref_match to take a struct refspec
remote: convert query_refspecs to take a struct refspec
remote: convert apply_refspecs to take a struct refspec
remote: convert get_stale_heads to take a struct refspec
fetch: convert prune_refs to take a struct refspec
fetch: convert get_ref_map to take a struct refspec
fetch: convert do_fetch to take a struct refspec
refspec: remove the deprecated functions
...

Merge branch 'sb/grep-die-on-unreadable-index'Junio C Hamano Wed, 30 May 2018 12:51:26 +0000 (21:51 +0900)

Merge branch 'sb/grep-die-on-unreadable-index'

Error behaviour of "git grep" when it cannot read the index was
inconsistent with other commands that uses the index, which has
been corrected to error out early.

* sb/grep-die-on-unreadable-index:
grep: handle corrupt index files early

The seventh batch for 2.18Junio C Hamano Wed, 30 May 2018 05:10:34 +0000 (14:10 +0900)

The seventh batch for 2.18

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

Merge branch 'sb/submodule-update-try-harder'Junio C Hamano Wed, 30 May 2018 05:04:12 +0000 (14:04 +0900)

Merge branch 'sb/submodule-update-try-harder'

"git submodule update" attempts two different kinds of "git fetch"
against the upstream repository to grab a commit bound at the
submodule's path, but it incorrectly gave up if the first kind
(i.e. a normal fetch) failed, making the second "last resort" one
(i.e. fetching an exact commit object by object name) ineffective.
This has been corrected.

* sb/submodule-update-try-harder:
git-submodule.sh: try harder to fetch a submodule

Merge branch 'lm/credential-netrc'Junio C Hamano Wed, 30 May 2018 05:04:11 +0000 (14:04 +0900)

Merge branch 'lm/credential-netrc'

Update credential-netrc helper (in contrib/) to allow customizing
the GPG used to decrypt the encrypted .netrc file.

* lm/credential-netrc:
git-credential-netrc: accept gpg option
git-credential-netrc: adapt to test framework for git

Merge branch 'ab/get-short-oid'Junio C Hamano Wed, 30 May 2018 05:04:11 +0000 (14:04 +0900)

Merge branch 'ab/get-short-oid'

When a short hexadecimal string is used to name an object but there
are multiple objects that share the string as the prefix of their
names, the code lists these ambiguous candidates in a help message.
These object names are now sorted according to their types for
easier eyeballing.

* ab/get-short-oid:
get_short_oid: sort ambiguous objects by type, then SHA-1
sha1-name.c: move around the collect_ambiguous() function
git-p4: change "commitish" typo to "committish"
sha1-array.h: align function arguments
sha1-name.c: remove stray newline