gitweb.git
Merge branch 'ks/branch-cleanup'Junio C Hamano Wed, 27 Dec 2017 19:16:25 +0000 (11:16 -0800)

Merge branch 'ks/branch-cleanup'

Code clean-up.

* ks/branch-cleanup:
builtin/branch: strip refs/heads/ using skip_prefix
branch: update warning message shown when copying a misnamed branch
branch: group related arguments of create_branch()
branch: improve documentation and naming of create_branch() parameters

Merge branch 'rs/strbuf-read-once-reset-length'Junio C Hamano Wed, 27 Dec 2017 19:16:24 +0000 (11:16 -0800)

Merge branch 'rs/strbuf-read-once-reset-length'

Leakfix.

* rs/strbuf-read-once-reset-length:
strbuf: release memory on read error in strbuf_read_once()

Merge branch 'rs/fmt-merge-msg-string-leak-fix'Junio C Hamano Wed, 27 Dec 2017 19:16:23 +0000 (11:16 -0800)

Merge branch 'rs/fmt-merge-msg-string-leak-fix'

Leakfix.

* rs/fmt-merge-msg-string-leak-fix:
fmt-merge-msg: avoid leaking strbuf in shortlog()

Merge branch 'rs/am-builtin-leakfix'Junio C Hamano Wed, 27 Dec 2017 19:16:22 +0000 (11:16 -0800)

Merge branch 'rs/am-builtin-leakfix'

Leakfix.

* rs/am-builtin-leakfix:
am: release strbuf after use in split_mail_mbox()

Merge branch 'es/worktree-checkout-hook'Junio C Hamano Wed, 27 Dec 2017 19:16:21 +0000 (11:16 -0800)

Merge branch 'es/worktree-checkout-hook'

"git worktree add" learned to run the post-checkout hook, just like
"git checkout" does, after the initial checkout.

* es/worktree-checkout-hook:
worktree: invoke post-checkout hook (unless --no-checkout)

Merge branch 'lb/rebase-i-short-command-names'Junio C Hamano Wed, 27 Dec 2017 19:16:21 +0000 (11:16 -0800)

Merge branch 'lb/rebase-i-short-command-names'

With a configuration variable rebase.abbreviateCommands set,
"git rebase -i" produces the todo list with a single-letter
command names.

* lb/rebase-i-short-command-names:
sequencer.c: drop 'const' from function return type
t3404: add test case for abbreviated commands
rebase -i: learn to abbreviate command names
rebase -i -x: add exec commands via the rebase--helper
rebase -i: update functions to use a flags parameter
rebase -i: replace reference to sha1 with oid
rebase -i: refactor transform_todo_ids
rebase -i: set commit to null in exec commands
Documentation: use preferred name for the 'todo list' script
Documentation: move rebase.* configs to new file

Merge branch 'tb/check-crlf-for-safe-crlf'Junio C Hamano Wed, 27 Dec 2017 19:16:21 +0000 (11:16 -0800)

Merge branch 'tb/check-crlf-for-safe-crlf'

The "safe crlf" check incorrectly triggered for contents that does
not use CRLF as line endings, which has been corrected.

* tb/check-crlf-for-safe-crlf:
t0027: Adapt the new MIX tests to Windows
convert: tighten the safe autocrlf handling

Merge branch 'jh/object-filtering'Junio C Hamano Wed, 27 Dec 2017 19:16:20 +0000 (11:16 -0800)

Merge branch 'jh/object-filtering'

In preparation for implementing narrow/partial clone, the object
walking machinery has been taught a way to tell it to "filter" some
objects from enumeration.

* jh/object-filtering:
rev-list: support --no-filter argument
list-objects-filter-options: support --no-filter
list-objects-filter-options: fix 'keword' typo in comment
pack-objects: add list-objects filtering
rev-list: add list-objects filtering support
list-objects: filter objects in traverse_commit_list
oidset: add iterator methods to oidset
oidmap: add oidmap iterator methods
dir: allow exclusions from blob in addition to file

sequencer.c: drop 'const' from function return typeJunio C Hamano Wed, 27 Dec 2017 19:12:45 +0000 (11:12 -0800)

sequencer.c: drop 'const' from function return type

With -Werror=ignored-qualifiers, a function that claims to return
"const char" gets this error:

CC sequencer.o
sequencer.c:798:19: error: type qualifiers ignored on function return
type [-Werror=ignored-qualifiers]
static const char command_to_char(const enum todo_command command)
^

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

describe: prepend "tags/" when describing tags with... Daniel Knittl-Frank Mon, 11 Dec 2017 17:24:54 +0000 (18:24 +0100)

describe: prepend "tags/" when describing tags with embedded name

The man page of the "git describe" command explains the expected
output when using the --all option, i.e. the full reference path is
shown, including heads/ or tags/ prefix.

When 212945d4a85dfa172ea55ec73b1d830ef2d8582f ("Teach git-describe
to verify annotated tag names before output") made Git favor the
embedded name of annotated tags, it accidentally changed the output
format when the --all flag is given, only printing the tag's name
without the prefix.

Check if --all was specified and re-add the "tags/" prefix for this
special case to fix the regresssion.

Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

strbuf: fix urlencode format string on signed charJulien Dusser Fri, 22 Dec 2017 17:24:37 +0000 (18:24 +0100)

strbuf: fix urlencode format string on signed char

Git credential fails with special char in password with

remote: Invalid username or password.
fatal: Authentication failed for

File ~/.git-credential contains badly urlencoded characters
%ffffffXX%ffffffYY instead of %XX%YY.

Add a cast to an unsigned char to fix urlencode use of %02x on a
char.

Signed-off-by: Julien Dusser <julien.dusser@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-pack: use internal argv_array of struct child_processRené Scharfe Fri, 22 Dec 2017 08:14:10 +0000 (09:14 +0100)

send-pack: use internal argv_array of struct child_process

Avoid a magic number of NULL placeholder values and a magic index by
constructing the command line for pack-objects using the embedded
argv_array of the child_process. The resulting code is shorter and
easier to extend.

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

http: use internal argv_array of struct child_processRené Scharfe Fri, 22 Dec 2017 11:56:59 +0000 (12:56 +0100)

http: use internal argv_array of struct child_process

Avoid a strangely magic array size (it's slightly too big) and explicit
index numbers by building the command line for index-pack using the
embedded argv_array of the child_process. Add the flag -o and its
argument with argv_array_pushl() to make it obvious that they belong
together. The resulting code is shorter and easier to extend.

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

git-p4: update multiple shelved change listsLuke Diamand Thu, 21 Dec 2017 11:06:14 +0000 (11:06 +0000)

git-p4: update multiple shelved change lists

--update-shelve can now be specified multiple times on the
command-line, to update multiple shelved changelists in a single
submit.

This then means that a git patch series can be mirrored to a
sequence of shelved changelists, and (relatively easily) kept in
sync as changes are made in git.

Note that Perforce does not really support overlapping shelved
changelists where one change touches the files modified by
another. Trying to do this will result in merge conflicts.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: add support for --fixup <commit> -m"<extra... Ævar Arnfjörð Bjarmason Fri, 22 Dec 2017 20:41:52 +0000 (20:41 +0000)

commit: add support for --fixup <commit> -m"<extra message>"

Add support for supplying the -m option with --fixup. Doing so has
errored out ever since --fixup was introduced. Before this, the only
way to amend the fixup message while committing was to use --edit and
amend it in the editor.

The use-case for this feature is one of:

* Leaving a quick note to self when creating a --fixup commit when
it's not self-evident why the commit should be squashed without a
note into another one.

* (Ab)using the --fixup feature to "fix up" commits that have already
been pushed to a branch that doesn't allow non-fast-forwards,
i.e. just noting "this should have been part of that other commit",
and if the history ever got rewritten in the future the two should
be combined.

In such a case you might want to leave a small message,
e.g. "forgot this part, which broke XYZ".

With this, --fixup <commit> -m"More" -m"Details" will result in a
commit message like:

!fixup <subject of <commit>>

More

Details

The reason the test being added here seems to squash "More" at the end
of the subject line of the commit being fixed up is because the test
code is using "%s%b" so the body immediately follows the subject, it's
not a bug in this code, and other tests t7500-commit.sh do the same
thing.

When the --fixup option was initially added the "Option -m cannot be
combined" error was expanded from -c, -C and -F to also include
--fixup[1]

Those options could also support combining with -m, but given what
they do I can't think of a good use-case for doing that, so I have not
made the more invasive change of splitting up the logic in commit.c to
first act on those, and then on -m options.

1. d71b8ba7c9 ("commit: --fixup option for use with rebase
--autosquash", 2010-11-02)

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

check-non-portable-shell.pl: `wc -l` may have leading WSTorsten Bögershausen Thu, 21 Dec 2017 21:26:46 +0000 (22:26 +0100)

check-non-portable-shell.pl: `wc -l` may have leading WS

Test scripts count number of lines in an output and check it againt
its expectation. fb3340a6 ("test-lib: introduce test_line_count to
measure files", 2010-10-31) introduced a helper to show a failure in
such a test in a more readable way than comparing `wc -l` output with
a number.

Besides, on some platforms, "$(wc -l <file)" is padded with leading
whitespace on the left, so

test "$(wc -l <file)" = 4

would not work (most notably on macosX); the users of test_line_count
helper would not suffer from such a portability glitch.

Add a check in check-non-portable-shell.pl to find '"' between
`wc -l` and '=' and hint the user about test_line_count().

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config.txt: document behavior of backslashes in subsectionsDave Borowitz Thu, 21 Dec 2017 13:10:42 +0000 (08:10 -0500)

config.txt: document behavior of backslashes in subsections

Unrecognized escape sequences are invalid in values:

$ git config -f - --list <<EOF
[foo]
bar = "\t\\\y\"\u"
EOF
fatal: bad config line 2 in standard input

But in subsection names, the backslash is simply dropped if the
following character does not produce a recognized escape sequence:

$ git config -f - --list <<EOF
[foo "\t\\\y\"\u"]
bar = baz
EOF
foo.t\y"u.bar=baz

Although it would be nice for subsection names and values to have
consistent behavior, changing the behavior for subsection names is a
nonstarter since it would cause existing, valid config files to
suddenly be interpreted differently.

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ew/empty-merge-with-dirty-index-maint... Junio C Hamano Fri, 22 Dec 2017 20:48:38 +0000 (12:48 -0800)

Merge branch 'ew/empty-merge-with-dirty-index-maint' into ew/empty-merge-with-dirty-index

* ew/empty-merge-with-dirty-index-maint:
merge-recursive: avoid incorporating uncommitted changes in a merge
move index_has_changes() from builtin/am.c to merge.c for reuse
t6044: recursive can silently incorporate dirty changes in a merge

merge-recursive: avoid incorporating uncommitted change... Elijah Newren Thu, 21 Dec 2017 19:19:07 +0000 (11:19 -0800)

merge-recursive: avoid incorporating uncommitted changes in a merge

builtin/merge.c contains this important requirement for merge strategies:
/*
* At this point, we need a real merge. No matter what strategy
* we use, it would operate on the index, possibly affecting the
* working tree, and when resolved cleanly, have the desired
* tree in the index -- this means that the index must be in
* sync with the head commit. The strategies are responsible
* to ensure this.
*/

merge-recursive does not do this check directly, instead it relies on
unpack_trees() to do it. However, merge_trees() has a special check for
the merge branch exactly matching the merge base; when it detects that
situation, it returns early without calling unpack_trees(), because it
knows that the HEAD commit already has the correct result. Unfortunately,
it didn't check that the index matched HEAD, so after it returned, the
outer logic ended up creating a merge commit that included something
other than HEAD.

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

move index_has_changes() from builtin/am.c to merge... Elijah Newren Thu, 21 Dec 2017 19:19:06 +0000 (11:19 -0800)

move index_has_changes() from builtin/am.c to merge.c for reuse

index_has_changes() is a function we want to reuse outside of just am,
making it also available for merge-recursive and merge-ort.

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

t6044: recursive can silently incorporate dirty changes... Elijah Newren Thu, 21 Dec 2017 19:19:05 +0000 (11:19 -0800)

t6044: recursive can silently incorporate dirty changes in a merge

The recursive merge strategy has some special handling when the tree for
the merge branch exactly matches the merge base, but that code path is
missing checks for the index having changes relative to HEAD. Add a
testcase covering this scenario.

Reported-by: Andreas Krey <a.krey@gmx.de>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit doc: document that -c, -C, -F and --fixup with... Ævar Arnfjörð Bjarmason Fri, 22 Dec 2017 16:00:55 +0000 (16:00 +0000)

commit doc: document that -c, -C, -F and --fixup with -m error

Document that providing any of -c, -C, -F and --fixup along with -m
will result in an error. Some variant of this has been errored about
explicitly since 0c091296c0 ("git-commit: log parameter updates.",
2005-08-08), but the documentation was never updated to reflect this.

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

t/helper/test-lazy-name-hash: fix compilationStefan Beller Mon, 18 Dec 2017 21:49:47 +0000 (13:49 -0800)

t/helper/test-lazy-name-hash: fix compilation

I was compiling origin/master today with DEVELOPER compiler flags
and was greeted by:

t/helper/test-lazy-init-name-hash.c: In function ‘cmd_main’:
t/helper/test-lazy-init-name-hash.c:172:5: error: ‘nr_threads_used’ may be used uninitilized in this function [-Werror=maybe-uninitialized]
printf("avg [size %8d] [single %f] %c [multi %f %d]\n",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nr,
~~~
(double)avg_single/1000000000,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(avg_single < avg_multi ? '<' : '>'),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(double)avg_multi/1000000000,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nr_threads_used);
~~~~~~~~~~~~~~~~
t/helper/test-lazy-init-name-hash.c:115:6: note: ‘nr_threads_used’ was declared here
int nr_threads_used;
^~~~~~~~~~~~~~~

I do not see how we can arrive at that line without having `nr_threads_used`
initialized, as we'd have `count > 1` (which asserts that we ran the
loop above at least once, such that it *should* be initialized).

Just clear the variable at the beginning of the function to squelch
the warning.

Signed-off-by: Stefan Beller <sbeller@google.com>
Acked-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5573, t7612: clean up after unexpected success of... Junio C Hamano Fri, 15 Dec 2017 19:42:36 +0000 (11:42 -0800)

t5573, t7612: clean up after unexpected success of 'pull' and 'merge'

The previous steps added test_when_finished to tests that run 'git
pull' or 'git merge' with expectation of success, so that the test
after them can start from a known state even when their 'git pull'
invocation unexpectedly fails. However, tests that run 'git pull'
or 'git merge' expecting it not to succeed forgot to protect later
tests the same way---if they unexpectedly succeed, the test after
them would start from an unexpected state.

Reset and checkout the initial commit after all these tests, whether
they expect their invocations to succeed or fail.

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

RelNotes: the tenth batchJunio C Hamano Tue, 19 Dec 2017 19:34:35 +0000 (11:34 -0800)

RelNotes: the tenth batch

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

Merge branch 'ls/editor-waiting-message'Junio C Hamano Tue, 19 Dec 2017 19:33:59 +0000 (11:33 -0800)

Merge branch 'ls/editor-waiting-message'

Git shows a message to tell the user that it is waiting for the
user to finish editing when spawning an editor, in case the editor
opens to a hidden window or somewhere obscure and the user gets
lost.

* ls/editor-waiting-message:
launch_editor(): indicate that Git waits for user input
refactor "dumb" terminal determination

Merge branch 'sg/setup-doc-update'Junio C Hamano Tue, 19 Dec 2017 19:33:58 +0000 (11:33 -0800)

Merge branch 'sg/setup-doc-update'

Comment update.

* sg/setup-doc-update:
setup.c: fix comment about order of .git directory discovery

Merge branch 'ar/unconfuse-three-dots'Junio C Hamano Tue, 19 Dec 2017 19:33:58 +0000 (11:33 -0800)

Merge branch 'ar/unconfuse-three-dots'

Ancient part of codebase still shows dots after an abbreviated
object name just to show that it is not a full object name, but
these ellipses are confusing to people who newly discovered Git
who are used to seeing abbreviated object names and find them
confusing with the range syntax.

* ar/unconfuse-three-dots:
t2020: test variations that matter
t4013: test new output from diff --abbrev --raw
diff: diff_aligned_abbrev: remove ellipsis after abbreviated SHA-1 value
t4013: prepare for upcoming "diff --raw --abbrev" output format change
checkout: describe_detached_head: remove ellipsis after committish
print_sha1_ellipsis: introduce helper
Documentation: user-manual: limit usage of ellipsis
Documentation: revisions: fix typo: "three dot" ---> "three-dot" (in line with "two-dot").

Merge branch 'tg/worktree-create-tracking'Junio C Hamano Tue, 19 Dec 2017 19:33:57 +0000 (11:33 -0800)

Merge branch 'tg/worktree-create-tracking'

The way "git worktree add" determines what branch to create from
where and checkout in the new worktree has been updated a bit.

* tg/worktree-create-tracking:
add worktree.guessRemote config option
worktree: add --guess-remote flag to add subcommand
worktree: make add <path> <branch> dwim
worktree: add --[no-]track option to the add subcommand
worktree: add can be created from any commit-ish
checkout: factor out functions to new lib file

Merge branch 'gk/tracing-optimization'Junio C Hamano Tue, 19 Dec 2017 19:33:57 +0000 (11:33 -0800)

Merge branch 'gk/tracing-optimization'

The tracing infrastructure has been optimized for cases where no
tracing is requested.

* gk/tracing-optimization:
trace: improve performance while category is disabled
trace: remove trace key normalization

Merge branch 'bw/submodule-config-cleanup'Junio C Hamano Tue, 19 Dec 2017 19:33:57 +0000 (11:33 -0800)

Merge branch 'bw/submodule-config-cleanup'

Recent update to the submodule configuration code broke "diff-tree"
by accidentally stopping to read from the index upfront.

* bw/submodule-config-cleanup:
diff-tree: read the index so attribute checks work in bare repositories

Merge branch 'sb/clone-recursive-submodule-doc'Junio C Hamano Tue, 19 Dec 2017 19:33:56 +0000 (11:33 -0800)

Merge branch 'sb/clone-recursive-submodule-doc'

Doc update.

* sb/clone-recursive-submodule-doc:
Documentation/git-clone: improve description for submodule recursing

Merge branch 'ls/git-gui-no-double-utf8-author-name'Junio C Hamano Tue, 19 Dec 2017 19:33:56 +0000 (11:33 -0800)

Merge branch 'ls/git-gui-no-double-utf8-author-name'

Amending commits in git-gui broke the author name that is non-ascii
due to incorrect enconding conversion.

* ls/git-gui-no-double-utf8-author-name:
git-gui: prevent double UTF-8 conversion

Merge branch 'bw/pathspec-match-submodule-boundary'Junio C Hamano Tue, 19 Dec 2017 19:33:56 +0000 (11:33 -0800)

Merge branch 'bw/pathspec-match-submodule-boundary'

An v2.12-era regression in pathspec match logic, which made it look
into submodule tree even when it is not desired, has been fixed.

* bw/pathspec-match-submodule-boundary:
pathspec: only match across submodule boundaries when requested

Merge branch 'jt/diff-anchored-patience'Junio C Hamano Tue, 19 Dec 2017 19:33:56 +0000 (11:33 -0800)

Merge branch 'jt/diff-anchored-patience'

"git diff" learned a variant of the "--patience" algorithm, to
which the user can specify which 'unique' line to be used as
anchoring points.

* jt/diff-anchored-patience:
diff: support anchoring line(s)

Merge branch 'en/merge-recursive-icase-removal'Junio C Hamano Tue, 19 Dec 2017 19:33:55 +0000 (11:33 -0800)

Merge branch 'en/merge-recursive-icase-removal'

The code internal to the recursive merge strategy was not fully
prepared to see a path that is renamed to try overwriting another
path that is only different in case on case insensitive systems.
This does not matter in the current code, but will start to matter
once the rename detection logic starts taking hints from nearby
paths moving to some directory and moves a new path along with them.

* en/merge-recursive-icase-removal:
merge-recursive: ignore_case shouldn't reject intentional removals

Merge branch 'en/rename-progress'Junio C Hamano Tue, 19 Dec 2017 19:33:55 +0000 (11:33 -0800)

Merge branch 'en/rename-progress'

Historically, the diff machinery for rename detection had a
hardcoded limit of 32k paths; this is being lifted to allow users
trade cycles with a (possibly) easier to read result.

* en/rename-progress:
diffcore-rename: make diff-tree -l0 mean -l<large>
sequencer: show rename progress during cherry picks
diff: remove silent clamp of renameLimit
progress: fix progress meters when dealing with lots of work
sequencer: warn when internal merge may be suboptimal due to renameLimit

builtin/describe.c: describe a blobStefan Beller Thu, 16 Nov 2017 02:00:39 +0000 (18:00 -0800)

builtin/describe.c: describe a blob

Sometimes users are given a hash of an object and they want to
identify it further (ex.: Use verify-pack to find the largest blobs,
but what are these? or [1])

When describing commits, we try to anchor them to tags or refs, as these
are conceptually on a higher level than the commit. And if there is no ref
or tag that matches exactly, we're out of luck. So we employ a heuristic
to make up a name for the commit. These names are ambiguous, there might
be different tags or refs to anchor to, and there might be different
path in the DAG to travel to arrive at the commit precisely.

When describing a blob, we want to describe the blob from a higher layer
as well, which is a tuple of (commit, deep/path) as the tree objects
involved are rather uninteresting. The same blob can be referenced by
multiple commits, so how we decide which commit to use? This patch
implements a rather naive approach on this: As there are no back pointers
from blobs to commits in which the blob occurs, we'll start walking from
any tips available, listing the blobs in-order of the commit and once we
found the blob, we'll take the first commit that listed the blob. For
example

git describe --tags v0.99:Makefile
conversion-901-g7672db20c2:Makefile

tells us the Makefile as it was in v0.99 was introduced in commit 7672db20.

The walking is performed in reverse order to show the introduction of a
blob rather than its last occurrence.

[1] https://stackoverflow.com/questions/223678/which-commit-has-this-blob

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

http: support CURLPROXY_HTTPSWei Shuyu Tue, 19 Dec 2017 17:24:01 +0000 (01:24 +0800)

http: support CURLPROXY_HTTPS

HTTP proxy over SSL is supported by curl since 7.52.0.
This is very useful for networks with protocol whitelist.

Signed-off-by: Wei Shuyu <wsy@dogben.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: rebasing can also be done when HEAD is detachedKaartic Sivaraam Sat, 16 Dec 2017 09:03:19 +0000 (14:33 +0530)

rebase: rebasing can also be done when HEAD is detached

Attempting to rebase when the HEAD is detached and is already
up to date with upstream (so there's nothing to do), the
following message is shown

Current branch HEAD is up to date.

which is clearly wrong as HEAD is not a branch.

Handle the special case of HEAD correctly to give a more precise
error message.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: distinguish user input by quoting itKaartic Sivaraam Sat, 16 Dec 2017 09:03:18 +0000 (14:33 +0530)

rebase: distinguish user input by quoting it

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: consistently use branch_name variableKaartic Sivaraam Sat, 16 Dec 2017 09:03:17 +0000 (14:33 +0530)

rebase: consistently use branch_name variable

The variable "branch_name" holds the <branch> parameter in "git
rebase <upstream> <branch>", but one codepath did not use it after
assigning $1 to it (instead it kept using $1). Make it use the
variable consistently.

Also, update an error message to say there is no such branch or
commit, as we are expecting either of them, and not limiting
ourselves to a branch name.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Doc/check-ref-format: clarify information about @{... Kaartic Sivaraam Sat, 16 Dec 2017 08:13:49 +0000 (13:43 +0530)

Doc/check-ref-format: clarify information about @{-N} syntax

When the N-th previous thing checked out syntax (@{-N}) is used
with '--branch' option of check-ref-format the result may not be
the name of a branch that currently exists or ever existed. This
is because @{-N} is used to refer to the N-th last checked out
"thing", which might be a commit object name if the previous check
out was a detached HEAD state; or a branch name, otherwise. The
documentation thus does a wrong thing by promoting it as the
"previous branch syntax".

State that @{-N} is the syntax for specifying "N-th last thing
checked out" and also state that the result of using @{-N} might
also result in an commit object name.

Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: document default value of http.sslVerifySimon Ruderich Sat, 16 Dec 2017 12:32:02 +0000 (13:32 +0100)

config: document default value of http.sslVerify

Remove any doubt that certificates might not be verified by
default.

Signed-off-by: Simon Ruderich <simon@ruderich.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

p7519: improve check for prerequisite WATCHMANRené Scharfe Sat, 16 Dec 2017 12:12:23 +0000 (13:12 +0100)

p7519: improve check for prerequisite WATCHMAN

The return code of command -v with a non-existing command is 1 in bash
and 127 in dash. Use that return code directly to allow the script to
work with dash and without watchman (e.g. on Debian).

While at it stop redirecting the output. stderr is redirected to
/dev/null by test_lazy_prereq already, and stdout can actually be
useful -- the path of the found watchman executable is sent there, but
it's shown only if the script was run with --verbose.

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

imap-send: URI encode server folderNicolas Morey-Chaisemartin Mon, 18 Dec 2017 19:11:13 +0000 (00:41 +0530)

imap-send: URI encode server folder

When trying to send a patch using 'imap-send' with 'curl' and the
following configuration:

[imap]
folder = "[Gmail]/Drafts"
host = imaps://imap.gmail.com
port = 993
sslverify = false

results in the following error,

curl_easy_perform() failed: URL using bad/illegal format or missing URL

This is a consequence of not URI-encoding the folder portion of
the URL which contains characters such as '[' which are not
allowed in a URI. According to RFC3986, these characters should be
URI-encoded.

So, URI-encode the folder before adding it to the URI to ensure it doesn't
contain characters that aren't allowed in a URI.

Reported-by: Doron Behar <doron.behar@gmail.com>
Signed-off-by: Nicolas Morey-Chaisemartin <NMoreyChaisemartin@suse.com>
Signed-off-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

version --build-options: report commit, too, if possibleJohannes Schindelin Thu, 14 Dec 2017 23:34:38 +0000 (00:34 +0100)

version --build-options: report commit, too, if possible

In particular when local tags are used (or tags that are pushed to some
fork) to build Git, it is very hard to figure out from which particular
revision a particular Git executable was built. It gets worse when those
tags are deleted, or even updated.

Let's just report an exact, unabbreviated commit name in our build
options.

We need to be careful, though, to report when the current commit cannot
be determined, e.g. when building from a tarball without any associated
Git repository. This could be the case also when extracting Git's source
code into an unrelated Git worktree.

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

version --build-options: also report host CPUEric Sunshine Thu, 14 Dec 2017 23:34:34 +0000 (00:34 +0100)

version --build-options: also report host CPU

It can be helpful for bug reports to include information about the
environment in which the bug occurs. "git version --build-options" can
help to supplement this information. In addition to the size of 'long'
already reported by --build-options, also report the host's CPU type.
Example output:

$ git version --build-options
git version 2.9.3.windows.2.826.g06c0f2f
cpu: x86_64
sizeof-long: 4

New Makefile variable HOST_CPU supports cross-compiling.

Suggested-by: Adric Norris <landstander668@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

transport: make transport vtable more privateJonathan Tan Thu, 14 Dec 2017 21:44:45 +0000 (13:44 -0800)

transport: make transport vtable more private

Move the definition of the transport-specific functions provided by
transports, whether declared in transport.c or transport-helper.c, into
an internal header. This means that transport-using code (as opposed to
transport-declaring code) can no longer access these functions (without
importing the internal header themselves), making it clear that they
should use the transport_*() functions instead, and also allowing the
interface between the transport mechanism and an individual transport to
independently evolve.

This is superficially a reversal of commit 824d5776c3f2 ("Refactor
struct transport_ops inlined into struct transport", 2007-09-19).
However, the scope of the involved variables was neither affected nor
discussed in that commit, and I think that the advantages in making
those functions more private outweigh the advantages described in that
commit's commit message. A minor additional point is that the code has
gotten more complicated since then, in that the function-pointer
variables are potentially mutated twice (once initially and once if
transport_take_over() is invoked), increasing the value of corralling
them into their own struct.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone, fetch: remove redundant transport checkJonathan Tan Thu, 14 Dec 2017 21:44:44 +0000 (13:44 -0800)

clone, fetch: remove redundant transport check

Prior to commit a2d725b7bdf7 ("Use an external program to implement
fetching with curl", 2009-08-05), if Git was compiled with NO_CURL, the
get_refs_list and fetch methods in struct transport might not be
populated, hence the checks in clone and fetch. After that commit, all
transports populate get_refs_list and fetch, making the checks in clone
and fetch redundant. Remove those checks.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

partial-clone: design docJeff Hostetler Thu, 14 Dec 2017 21:09:23 +0000 (21:09 +0000)

partial-clone: design doc

Design document for partial clone feature.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

RelNotes: minor typo fixes in 2.16.0 draftTodd Zullinger Thu, 14 Dec 2017 02:42:44 +0000 (21:42 -0500)

RelNotes: minor typo fixes in 2.16.0 draft

Signed-off-by: Todd Zullinger <tmz@pobox.com>

t/lib-git-svn.sh: improve svnserve tests with parallel... Todd Zullinger Fri, 1 Dec 2017 15:56:53 +0000 (10:56 -0500)

t/lib-git-svn.sh: improve svnserve tests with parallel make test

Setting SVNSERVE_PORT enables several tests which require a local
svnserve daemon to be run (in t9113 & t9126). The tests share setup of
the local svnserve via `start_svnserve()`. The function uses svnserve's
`--listen-once` option, which causes svnserve to accept one connection
on the port, serve it, and exit. When running the tests in parallel
this fails if one test tries to start svnserve while the other is still
running.

Use the test number as the svnserve port (similar to httpd tests) to
avoid port conflicts. Developers can set GIT_TEST_SVNSERVE to any value
other than 'false' or 'auto' to enable these tests.

Acked-by: Eric Wong <e@80x24.org>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Todd Zullinger <tmz@pobox.com>

t/lib-git-svn: cleanup inconsistent tab/space usageTodd Zullinger Fri, 1 Dec 2017 15:56:52 +0000 (10:56 -0500)

t/lib-git-svn: cleanup inconsistent tab/space usage

Acked-by: Eric Wong <e@80x24.org>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Todd Zullinger <tmz@pobox.com>

Merge branch 'svn-crlf' of git://bogomips.org/git-svn... Junio C Hamano Thu, 14 Dec 2017 17:26:32 +0000 (09:26 -0800)

Merge branch 'svn-crlf' of git://bogomips.org/git-svn into ew/svn-crlf

* 'svn-crlf' of git://bogomips.org/git-svn:
git-svn: convert CRLF to LF in commit message to SVN

git-svn: convert CRLF to LF in commit message to SVNEric Wong Thu, 14 Dec 2017 00:05:08 +0000 (00:05 +0000)

git-svn: convert CRLF to LF in commit message to SVN

Subversion since 1.6 does not accept CR characters in the commit
message, so filter it out on our end before 'git svn dcommit' sets
the svn:log property.

Reported-by: Brian Bennett <Brian.Bennett@Transamerica.com>
Signed-off-by: Eric Wong <e@80x24.org>

RelNotes: the ninth batchJunio C Hamano Wed, 13 Dec 2017 21:32:34 +0000 (13:32 -0800)

RelNotes: the ninth batch

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

Merge branch 'js/hashmap-update-sample'Junio C Hamano Wed, 13 Dec 2017 21:28:58 +0000 (13:28 -0800)

Merge branch 'js/hashmap-update-sample'

Code comment update.

* js/hashmap-update-sample:
hashmap: adjust documentation to reflect reality

Merge branch 'en/remove-stripspace'Junio C Hamano Wed, 13 Dec 2017 21:28:58 +0000 (13:28 -0800)

Merge branch 'en/remove-stripspace'

An internal function that was left for backward compatibility has
been removed, as there is no remaining callers.

* en/remove-stripspace:
strbuf: remove unused stripspace function alias

Merge branch 'jk/no-optional-locks'Junio C Hamano Wed, 13 Dec 2017 21:28:58 +0000 (13:28 -0800)

Merge branch 'jk/no-optional-locks'

Doc update for a feature available in Git v2.14 and upwards.

* jk/no-optional-locks:
git-status.txt: mention --no-optional-locks

Merge branch 'ds/for-each-file-in-obj-micro-optim'Junio C Hamano Wed, 13 Dec 2017 21:28:57 +0000 (13:28 -0800)

Merge branch 'ds/for-each-file-in-obj-micro-optim'

The code to iterate over loose object files got optimized.

* ds/for-each-file-in-obj-micro-optim:
sha1_file: use strbuf_add() instead of strbuf_addf()

Merge branch 'jk/progress-delay-fix'Junio C Hamano Wed, 13 Dec 2017 21:28:57 +0000 (13:28 -0800)

Merge branch 'jk/progress-delay-fix'

A regression in the progress eye-candy was fixed.

* jk/progress-delay-fix:
progress: drop delay-threshold code
progress: set default delay threshold to 100%, not 0%

Merge branch 'ks/doc-checkout-previous'Junio C Hamano Wed, 13 Dec 2017 21:28:57 +0000 (13:28 -0800)

Merge branch 'ks/doc-checkout-previous'

@{-N} in "git checkout @{-N}" may refer to a detached HEAD state,
but the documentation was not clear about it, which has been fixed.

* ks/doc-checkout-previous:
Doc/checkout: checking out using @{-N} can lead to detached state

Merge branch 'fk/sendmail-from-path'Junio C Hamano Wed, 13 Dec 2017 21:28:56 +0000 (13:28 -0800)

Merge branch 'fk/sendmail-from-path'

"git send-email" tries to see if the sendmail program is available
in /usr/lib and /usr/sbin; extend the list of locations to be
checked to also include directories on $PATH.

* fk/sendmail-from-path:
git-send-email: honor $PATH for sendmail binary

Merge branch 'tg/t-readme-updates'Junio C Hamano Wed, 13 Dec 2017 21:28:56 +0000 (13:28 -0800)

Merge branch 'tg/t-readme-updates'

Developer doc updates.

* tg/t-readme-updates:
t/README: document test_cmp_rev
t/README: remove mention of adding copyright notices

Merge branch 'pc/submodule-helper'Junio C Hamano Wed, 13 Dec 2017 21:28:56 +0000 (13:28 -0800)

Merge branch 'pc/submodule-helper'

A message fix.

* pc/submodule-helper:
submodule--helper.c: i18n: add a missing space in message

Merge branch 'jc/receive-pack-hook-doc'Junio C Hamano Wed, 13 Dec 2017 21:28:55 +0000 (13:28 -0800)

Merge branch 'jc/receive-pack-hook-doc'

Doc update.

* jc/receive-pack-hook-doc:
hooks doc: clarify when receive-pack invokes its hooks

Merge branch 'ab/pcre2-grep'Junio C Hamano Wed, 13 Dec 2017 21:28:54 +0000 (13:28 -0800)

Merge branch 'ab/pcre2-grep'

"git grep" compiled with libpcre2 sometimes triggered a segfault,
which is being fixed.

* ab/pcre2-grep:
grep: fix segfault under -P + PCRE2 <=10.30 + (*NO_JIT)
test-lib: add LIBPCRE1 & LIBPCRE2 prerequisites

Merge branch 'ra/decorate-limit-refs'Junio C Hamano Wed, 13 Dec 2017 21:28:54 +0000 (13:28 -0800)

Merge branch 'ra/decorate-limit-refs'

The tagnames "git log --decorate" uses to annotate the commits can
now be limited to subset of available refs with the two additional
options, --decorate-refs[-exclude]=<pattern>.

* ra/decorate-limit-refs:
log: add option to choose which refs to decorate

Merge branch 'bc/hash-algo'Junio C Hamano Wed, 13 Dec 2017 21:28:54 +0000 (13:28 -0800)

Merge branch 'bc/hash-algo'

An infrastructure to define what hash function is used in Git is
introduced, and an effort to plumb that throughout various
codepaths has been started.

* bc/hash-algo:
repository: fix a sparse 'using integer as NULL pointer' warning
Switch empty tree and blob lookups to use hash abstraction
Integrate hash algorithm support with repo setup
Add structure representing hash algorithm
setup: expose enumerated repo info

path: document path functionsBrandon Williams Wed, 13 Dec 2017 18:28:02 +0000 (10:28 -0800)

path: document path functions

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

transport: remove unused "push" in vtableJonathan Tan Tue, 12 Dec 2017 23:10:56 +0000 (15:10 -0800)

transport: remove unused "push" in vtable

After commit 0d0bac67ce3b ("transport: drop support for git-over-rsync",
2016-02-01), no transport in Git populates the "push" entry in the
transport vtable. Remove this entry.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

install-doc-quick: allow specifying what ref to installRandall S. Becker Sat, 9 Dec 2017 22:07:57 +0000 (17:07 -0500)

install-doc-quick: allow specifying what ref to install

We allow the builders, who want to install the preformatted manpages
and html documents, to specify where in their filesystem these two
repositories are stored. Let them also specify which ref (or even a
revision) to grab the preformatted material from.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/helper: ignore everything but sourcesStefan Beller Tue, 12 Dec 2017 20:56:06 +0000 (12:56 -0800)

t/helper: ignore everything but sources

Compiled test helpers in t/helper are out of sync with the .gitignore
files quite frequently. This can happen when new test helpers are added,
but the explicit .gitignore file is not updated in the same commit, or
when you forget to 'make clean' before checking out a different version
of git, as the different version may have a different explicit list of
test helpers to ignore.

Fix this by having an overly broad ignore pattern in that directory:
Anything, except C and shell source, will be ignored.

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

travis-ci: use 'set -x' in 'ci/*' scripts for extra... SZEDER Gábor Mon, 11 Dec 2017 23:34:43 +0000 (00:34 +0100)

travis-ci: use 'set -x' in 'ci/*' scripts for extra tracing output

While the build logic was embedded in our '.travis.yml', Travis CI
used to produce a nice trace log including all commands executed in
those embedded scriptlets. Since 657343a60 (travis-ci: move Travis CI
code into dedicated scripts, 2017-09-10), however, we only see the
name of the dedicated scripts, but not what those scripts are actually
doing, resulting in a less useful trace log. A patch later in this
series will move setting environment variables from '.travis.yml' to
the 'ci/*' scripts, so not even those will be included in the trace
log.

Use 'set -x' in 'ci/lib-travisci.sh', which is sourced in most other
'ci/*' scripts, so we get trace log about the commands executed in all
of those scripts.

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

travis-ci: set GIT_TEST_HTTPD in 'ci/lib-travisci.sh'SZEDER Gábor Mon, 11 Dec 2017 23:34:46 +0000 (00:34 +0100)

travis-ci: set GIT_TEST_HTTPD in 'ci/lib-travisci.sh'

Commit 657343a60 (travis-ci: move Travis CI code into dedicated
scripts, 2017-09-10) converted '.travis.yml's default 'before_install'
scriptlet to the 'ci/install-dependencies.sh' script, and while doing
so moved setting GIT_TEST_HTTPD=YesPlease for the 64-bit GCC and Clang
Linux build jobs to that script. This is wrong for two reasons:

- The purpose of that script is, as its name suggests, to install
dependencies, not to set any environment variables influencing
which tests should be run (though, arguably, this was already an
issue with the original 'before_install' scriptlet).

- Setting the variable has no effect anymore, because that script is
run in a separate shell process, and the variable won't be visible
in any of the other scripts, notably in 'ci/run-tests.sh'
responsible for, well, running the tests.

Luckily, this didn't have a negative effect on our Travis CI build
jobs, because GIT_TEST_HTTPD is a tri-state variable defaulting to
"auto" and a functioning web server was installed in those Linux build
jobs, so the httpd tests were run anyway.

Apparently the httpd tests run just fine without GIT_TEST_HTTPD being
set, therefore we could simply remove this environment variable.
However, if a bug were to creep in to change the Travis CI build
environment to run the tests as root or to not install Apache, then
the httpd tests would be skipped and the build job would still
succeed. We would only notice if someone actually were to look
through the build job's trace log; but who would look at the trace log
of a successful build job?!

Since httpd tests are important, we do want to run them and we want to
be loudly reminded if they can't be run. Therefore, move setting
GIT_TEST_HTTPD=YesPlease for the 64-bit GCC and Clang Linux build jobs
to 'ci/lib-travisci.sh' to ensure that the build job fails when the
httpd tests can't be run. (We could set it in 'ci/run-tests.sh' just
as well, but it's better to keep all environment variables in one
place in 'ci/lib-travisci.sh'.)

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

travis-ci: move setting environment variables to 'ci... SZEDER Gábor Mon, 11 Dec 2017 23:34:45 +0000 (00:34 +0100)

travis-ci: move setting environment variables to 'ci/lib-travisci.sh'

Our '.travis.yml's 'env.global' section sets a bunch of environment
variables for all build jobs, though none of them actually affects all
build jobs. It's convenient for us, and in most cases it works just
fine, because irrelevant environment variables are simply ignored.

However, $GIT_SKIP_TESTS is an exception: it tells the test harness to
skip the two test scripts that are prone to occasional failures on
OSX, but as it's set for all build jobs those tests are not run in any
of the build jobs that are capable to run them reliably, either.

Therefore $GIT_SKIP_TESTS should only be set in the OSX build jobs,
but those build jobs are included in the build matrix implicitly (i.e.
by combining the matrix keys 'os' and 'compiler'), and there is no way
to set an environment variable only for a subset of those implicit
build jobs. (Unless we were to add new scriptlets to '.travis.yml',
which is exactly the opposite direction that we took with commit
657343a60 (travis-ci: move Travis CI code into dedicated scripts,
2017-09-10)).

So move setting $GIT_SKIP_TESTS to 'ci/lib-travisci.sh', where it can
trivially be set only for the OSX build jobs.

Furthermore, move setting all other environment variables from
'.travis.yml' to 'ci/lib-travisci.sh', too, because a couple of
environment variables are already set there, and this way all
environment variables will be set in the same place. All the logic
controlling our builds is already in the 'ci/*' scripts anyway, so
there is really no good reason to keep the environment variables
separately.

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

travis-ci: introduce a $jobname variable for 'ci/*... SZEDER Gábor Mon, 11 Dec 2017 23:34:44 +0000 (00:34 +0100)

travis-ci: introduce a $jobname variable for 'ci/*' scripts

A couple of 'ci/*' scripts are shared between different build jobs:
'ci/lib-travisci.sh', being a common library, is sourced from almost
every script, while 'ci/install-dependencies.sh', 'ci/run-build.sh'
and 'ci/run-tests.sh' are shared between the "regular" GCC and Clang
Linux and OSX build jobs, and the latter two scripts are used in the
GETTEXT_POISON Linux build job as well.

Our builds could benefit from these shared scripts being able to
easily tell which build job they are taking part in. Now, it's
already quite easy to tell apart Linux vs OSX and GCC vs Clang build
jobs, but it gets trickier with all the additional Linux-based build
jobs included explicitly in the build matrix.

Unfortunately, Travis CI doesn't provide much help in this regard.
The closest we've got is the $TRAVIS_JOB_NUMBER variable, the value of
which is two dot-separated integers, where the second integer
indicates a particular build job. While it would be possible to use
that second number to identify the build job in our shared scripts, it
doesn't seem like a good idea to rely on that:

- Though the build job numbering sequence seems to be stable so far,
Travis CI's documentation doesn't explicitly states that it is
indeed stable and will remain so in the future. And even if it
were stable,

- if we were to remove or insert a build job in the middle, then the
job numbers of all subsequent build jobs would change accordingly.

So roll our own means of simple build job identification and introduce
the $jobname environment variable in our builds, setting it in the
environments of the explicitly included jobs in '.travis.yml', while
constructing one in 'ci/lib-travisci.sh' as the combination of the OS
and compiler name for the GCC and Clang Linux and OSX build jobs. Use
$jobname instead of $TRAVIS_OS_NAME in scripts taking different
actions based on the OS and build job (when installing P4 and Git LFS
dependencies and including them in $PATH). The following two patches
will also rely on $jobname.

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

submodule: convert get_next_submodule to not rely on... Brandon Williams Tue, 12 Dec 2017 19:53:52 +0000 (11:53 -0800)

submodule: convert get_next_submodule to not rely on the_index

Instead of implicitly relying on the global 'the_index', convert
'get_next_submodule()' to use the index of the repository stored in the
callback data 'struct submodule_parallel_fetch'.

Since this removes the last user of the index compatibility macros,
define 'NO_THE_INDEX_COMPATIBILITY_MACROS' to prevent future users of
these macros in submodule.c.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: used correct index in is_staging_gitmodules_okBrandon Williams Tue, 12 Dec 2017 19:53:51 +0000 (11:53 -0800)

submodule: used correct index in is_staging_gitmodules_ok

Commit 883e248b8 (fsmonitor: teach git to optionally utilize a file
system monitor to speed up detecting new or changed files., 2017-09-22)
introduced a call to 'ce_match_stat()' in 'is_staging_gitmodules_ok()'
which implicitly relys on the the global 'the_index' instead of the
passed in 'struct index_state'. Fix this by changing the call to
'ie_match_stat()' and using the passed in index_state struct.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: convert stage_updated_gitmodules to take... Brandon Williams Tue, 12 Dec 2017 19:53:50 +0000 (11:53 -0800)

submodule: convert stage_updated_gitmodules to take a struct index_state

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: add tests for pull --verify-signaturesHans Jerry Illikainen Sun, 10 Dec 2017 06:53:58 +0000 (06:53 +0000)

t: add tests for pull --verify-signatures

Add tests for pull --verify-signatures with untrusted, bad and no
signatures. Previously the only test for --verify-signatures was to
make sure that pull --rebase --verify-signatures result in a warning
(t5520-pull.sh).

Signed-off-by: Hans Jerry Illikainen <hji@dyntopia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

merge: add config option for verifySignaturesHans Jerry Illikainen Sun, 10 Dec 2017 06:53:57 +0000 (06:53 +0000)

merge: add config option for verifySignatures

git merge --verify-signatures can be used to verify that the tip commit
of the branch being merged in is properly signed, but it's cumbersome to
have to specify that every time.

Add a configuration option that enables this behaviour by default, which
can be overridden by --no-verify-signatures.

Signed-off-by: Hans Jerry Illikainen <hji@dyntopia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format: create docs for pretty.hOlga Telezhnaya Tue, 12 Dec 2017 08:55:35 +0000 (08:55 +0000)

format: create docs for pretty.h

Write some docs for functions in pretty.h.
Take it as a first draft, they would be changed later.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format: create pretty.h fileOlga Telezhnaya Tue, 12 Dec 2017 08:55:35 +0000 (08:55 +0000)

format: create pretty.h file

Create header for pretty.c to make formatting interface more structured.
This is a middle point, this file would be merged further with other
files which contain formatting stuff.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4045: reindent to make helpers readableJunio C Hamano Sat, 9 Dec 2017 20:40:13 +0000 (21:40 +0100)

t4045: reindent to make helpers readable

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

diff: add tests for --relative without optional prefix... Jacob Keller Sat, 9 Dec 2017 20:40:12 +0000 (21:40 +0100)

diff: add tests for --relative without optional prefix value

We already have tests for --relative, but they currently only test when
a prefix has been provided. This fails to test the case where --relative
by itself should use the current directory as the prefix.

Teach the check_$type functions to take a directory argument to indicate
which subdirectory to run the git commands in. Add a new test which uses
this to test --relative without a prefix value.

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

diff: use skip_to_optional_arg_default() in parsing... Junio C Hamano Sat, 9 Dec 2017 20:40:11 +0000 (21:40 +0100)

diff: use skip_to_optional_arg_default() in parsing --relative

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

diff: use skip_to_optional_arg_default()Christian Couder Sat, 9 Dec 2017 20:40:10 +0000 (21:40 +0100)

diff: use skip_to_optional_arg_default()

Let's simplify diff option parsing using
skip_to_optional_arg_default().

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

diff: use skip_to_optional_arg()Christian Couder Sat, 9 Dec 2017 20:40:09 +0000 (21:40 +0100)

diff: use skip_to_optional_arg()

Let's simplify diff option parsing using skip_to_optional_arg().

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

index-pack: use skip_to_optional_arg()Christian Couder Sat, 9 Dec 2017 20:40:08 +0000 (21:40 +0100)

index-pack: use skip_to_optional_arg()

Let's simplify index-pack option parsing using
skip_to_optional_arg().

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

git-compat-util: introduce skip_to_optional_arg()Christian Couder Sat, 9 Dec 2017 20:40:07 +0000 (21:40 +0100)

git-compat-util: introduce skip_to_optional_arg()

We often accept both a "--key" option and a "--key=<val>" option.

These options currently are parsed using something like:

if (!strcmp(arg, "--key")) {
/* do something */
} else if (skip_prefix(arg, "--key=", &arg)) {
/* do something with arg */
}

which is a bit cumbersome compared to just:

if (skip_to_optional_arg(arg, "--key", &arg)) {
/* do something with arg */
}

This also introduces skip_to_optional_arg_default() for the few
cases where something different should be done when the first
argument is exactly "--key" than when it is exactly "--key=".

In general it is better for UI consistency and simplicity if
"--key" and "--key=" do the same thing though, so that using
skip_to_optional_arg() should be encouraged compared to
skip_to_optional_arg_default().

Note that these functions can be used to parse any "key=value"
string where "key" is also considered as valid, not just
command line options.

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

clone: support 'clone --shared' from a worktreeEric Sunshine Mon, 11 Dec 2017 23:16:12 +0000 (18:16 -0500)

clone: support 'clone --shared' from a worktree

When worktree functionality was originally implemented, the possibility
of 'clone --local' from within a worktree was overlooked, with the
result that the location of the "objects" directory of the source
repository was computed incorrectly, thus the objects could not be
copied or hard-linked by the clone. This shortcoming was addressed by
744e469755 (clone: allow --local from a linked checkout, 2015-09-28).

However, the related case of 'clone --shared' (despite being handled
only a few lines away from the 'clone --local' case) was not fixed by
744e469755, with a similar result of the "objects" directory location
being incorrectly computed for insertion into the 'alternates' file.
Fix this.

Reported-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

transport-helper: plug strbuf and string_list leaksRené Scharfe Fri, 8 Dec 2017 17:29:31 +0000 (18:29 +0100)

transport-helper: plug strbuf and string_list leaks

Transfer ownership of detached strbufs to string_lists of the
duplicating variety by calling string_list_append_nodup() instead of
string_list_append() to avoid duplicating and then leaking the buffer.

While at it make sure to release the string_list when done;
push_refs_with_export() already does that.

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

t0027: Adapt the new MIX tests to WindowsTorsten Bögershausen Fri, 8 Dec 2017 17:46:36 +0000 (18:46 +0100)

t0027: Adapt the new MIX tests to Windows

The new MIX tests don't pass under Windows, adapt them
to use the correct native line ending.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: reword gitworkflows.txt for neutralityDaniel Bensoussan Fri, 8 Dec 2017 15:18:07 +0000 (16:18 +0100)

doc: reword gitworkflows.txt for neutrality

Change 'he' to 'them' to be more neutral in "gitworkflows.txt".

Signed-off-by: Matthieu Moy <matthieu.moy@univ-lyon1.fr>
Signed-off-by: Timothee Albertin <timothee.albertin@etu.univ-lyon1.fr>
Signed-off-by: Nathan Payre <nathan.payre@etu.univ-lyon1.fr>
Signed-off-by: Daniel Bensoussan <daniel.bensoussan--bohm@etu.univ-lyon1.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

decorate: clean up and document APIJonathan Tan Fri, 8 Dec 2017 00:14:24 +0000 (16:14 -0800)

decorate: clean up and document API

Improve the names of the identifiers in decorate.h, document them, and
add an example of how to use these functions.

The example is compiled and run as part of the test suite.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/Makefile: introduce TEST_SHELL_PATHJeff King Fri, 8 Dec 2017 10:47:22 +0000 (05:47 -0500)

t/Makefile: introduce TEST_SHELL_PATH

You may want to run the test suite with a different shell
than you use to build Git. For instance, you may build with
SHELL_PATH=/bin/sh (because it's faster, or it's what you
expect to exist on systems where the build will be used) but
want to run the test suite with bash (e.g., since that
allows using "-x" reliably across the whole test suite).
There's currently no good way to do this.

You might think that doing two separate make invocations,
like:

make &&
make -C t SHELL_PATH=/bin/bash

would work. And it _almost_ does. The second make will see
our bash SHELL_PATH, and we'll use that to run the
individual test scripts (or tell prove to use it to do so).
So far so good.

But this breaks down when "--tee" or "--verbose-log" is
used. Those options cause the test script to actually
re-exec itself using $SHELL_PATH. But wait, wouldn't our
second make invocation have set SHELL_PATH correctly in the
environment?

Yes, but test-lib.sh sources GIT-BUILD-OPTIONS, which we
built during the first "make". And that overrides the
environment, giving us the original SHELL_PATH again.

Let's introduce a new variable that lets you specify a
specific shell to be run for the test scripts. Note that we
have to touch both the main and t/ Makefiles, since we have
to record it in GIT-BUILD-OPTIONS in one, and use it in the
latter.

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

test-lib: make "-x" work with "--verbose-log"Jeff King Fri, 8 Dec 2017 10:47:17 +0000 (05:47 -0500)

test-lib: make "-x" work with "--verbose-log"

The "-x" tracing option implies "--verbose". This is a
problem when running under a TAP harness like "prove", where
we need to use "--verbose-log" instead. Instead, let's
handle this the same way we do for --valgrind, including the
recent fix from 88c6e9d31c (test-lib: --valgrind should not
override --verbose-log, 2017-09-05). Namely, let's enable
--verbose only when we know there isn't a more specific
verbosity option indicated.

Note that we also have to tweak `want_trace` to turn it on
(previously we just lumped $verbose_log in with $verbose,
but now we don't necessarily auto-set the latter).

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

t5615: avoid re-using descriptor 4Jeff King Fri, 8 Dec 2017 10:47:13 +0000 (05:47 -0500)

t5615: avoid re-using descriptor 4

File descriptors 3 and 4 are special in our test suite, as
they link back to the test script's original stdout and
stderr. Normally this isn't something tests need to worry
about: they are free to clobber these descriptors for
sub-commands without affecting the overall script.

But there's one very special thing about descriptor 4: since
d88785e424 (test-lib: set BASH_XTRACEFD automatically,
2016-05-11), we ask bash to output "set -x" output to it by
number. This goes to _any_ descriptor 4, even if it no
longer points to the place it did when we set BASH_XTRACEFD.

But in t5615, we run a shell loop with descriptor 4
redirected. As a result, t5615 works with non-bash shells
even with "-x". And it works with bash without "-x". But the
combination of "bash t5615-alternate-env.sh -x" gets a test
failure (because our "set -x" output pollutes one of the
files).

We can fix this by using any descriptor _except_ the magical
4. So let's switch arbitrarily to using 5/6 in this loop,
not 3/4.

Another alternative is to use a different descriptor for
BASH_XTRACEFD. But picking an unused one turns out to be
hard. Most shells limit us to 9 numbered descriptors. Bash
can handle more, but:

- while the BASH_XTRACEFD is specific to bash, GIT_TRACE=4
has a similar problem, and would affect all shells

- constructs like "999>/dev/null" are synticatically
invalid to non-bash shells. So we have to actually bury
it inside an eval, which creates more complications.

Of the numbers 1-9, you might think that "9" would be less
used than "4". But it's not; many of our scripts use
descriptors 8 and 9 (probably under the assumption that they
are high and therefore unused). The least-used descriptor is
currently "7". We could switch to that, but we're just
trading one magic number for another.

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