gitweb.git
t5404: relax overzealous testJohannes Schindelin Fri, 6 Apr 2018 19:31:22 +0000 (21:31 +0200)

t5404: relax overzealous test

In 0b294c0abf0 (make deleting a missing ref more quiet, 2008-07-08), we
added a test to verify that deleting an already-deleted ref does not
show an error.

Our test simply looks for the substring 'error' in the output of the
`git push`, which might look innocuous on the face of it.

Suppose, however, that you are a big fan of whales. Or even better: your
IT administrator has a whale of a time picking cute user names, e.g.
referring to you (due to your like of India Pale Ales) as "one of the
cuter rorquals" (see https://en.wikipedia.org/wiki/Rorqual to learn a
thing or two about rorquals) and hence your home directory becomes
/home/cuterrorqual. If you now run t5404, it fails! Why? Because the
test calls `git push origin :b3` which outputs:

To /home/cuterrorqual/git/t/trash directory.t5404-tracking-branches/.
- [deleted] b3

Note how there is no error displayed in that output? But of course
"error" is a substring of "cuterrorqual". And so that `grep error
output` finds something.

This bug was not, actually, caught having "error" as a substring of the
user name but while working in a worktree called "colorize-push-errors",
whose name was part of that output, too, suggesting that not even
testing for the *word* `error` via `git grep -w error output` would fix
the underlying issue.

This patch chooses instead to look for the prefix "error:" at the
beginning of the line, so that there can be no ambiguity that any catch
was indeed a message generated by Git's `error_builtin()` function.

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

Git 2.10.5 v2.10.5Junio C Hamano Fri, 22 Sep 2017 05:42:22 +0000 (14:42 +0900)

Git 2.10.5

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

Merge branch 'jk/safe-pipe-capture' into maint-2.10Junio C Hamano Fri, 22 Sep 2017 05:34:34 +0000 (14:34 +0900)

Merge branch 'jk/safe-pipe-capture' into maint-2.10

Merge branch 'jk/cvsimport-quoting' into maint-2.10Junio C Hamano Fri, 22 Sep 2017 05:34:34 +0000 (14:34 +0900)

Merge branch 'jk/cvsimport-quoting' into maint-2.10

Merge branch 'jc/cvsserver' into maint-2.10Junio C Hamano Fri, 22 Sep 2017 05:34:34 +0000 (14:34 +0900)

Merge branch 'jc/cvsserver' into maint-2.10

Merge branch 'jk/git-shell-drop-cvsserver' into maint... Junio C Hamano Fri, 22 Sep 2017 05:34:34 +0000 (14:34 +0900)

Merge branch 'jk/git-shell-drop-cvsserver' into maint-2.10

cvsimport: shell-quote variable used in backticksJeff King Mon, 11 Sep 2017 14:24:26 +0000 (10:24 -0400)

cvsimport: shell-quote variable used in backticks

We run `git rev-parse` though the shell, and quote its
argument only with single-quotes. This prevents most
metacharacters from being a problem, but misses the obvious
case when $name itself has single-quotes in it. We can fix
this by applying the usual shell-quoting formula.

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

archimport: use safe_pipe_capture for user inputJeff King Mon, 11 Sep 2017 14:24:11 +0000 (10:24 -0400)

archimport: use safe_pipe_capture for user input

Refnames can contain shell metacharacters which need to be
passed verbatim to sub-processes. Using safe_pipe_capture
skips the shell entirely.

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

shell: drop git-cvsserver support by defaultJeff King Mon, 11 Sep 2017 15:27:51 +0000 (11:27 -0400)

shell: drop git-cvsserver support by default

The git-cvsserver script is old and largely unmaintained
these days. But git-shell allows untrusted users to run it
out of the box, significantly increasing its attack surface.

Let's drop it from git-shell's list of internal handlers so
that it cannot be run by default. This is not backwards
compatible. But given the age and development activity on
CVS-related parts of Git, this is likely to impact very few
users, while helping many more (i.e., anybody who runs
git-shell and had no intention of supporting CVS).

There's no configuration mechanism in git-shell for us to
add a boolean and flip it to "off". But there is a mechanism
for adding custom commands, and adding CVS support here is
fairly trivial. Let's document it to give guidance to
anybody who really is still running cvsserver.

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

cvsserver: use safe_pipe_capture for `constant commands... Junio C Hamano Mon, 11 Sep 2017 05:45:54 +0000 (14:45 +0900)

cvsserver: use safe_pipe_capture for `constant commands` as well

This is not strictly necessary, but it is a good code hygiene.

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

cvsserver: use safe_pipe_capture instead of backticksjoernchen Mon, 11 Sep 2017 05:45:09 +0000 (14:45 +0900)

cvsserver: use safe_pipe_capture instead of backticks

This makes the script pass arguments that are derived from end-user
input in safer way when invoking subcommands.

Reported-by: joernchen <joernchen@phenoelit.de>
Signed-off-by: joernchen <joernchen@phenoelit.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cvsserver: move safe_pipe_capture() to the main packageJunio C Hamano Mon, 11 Sep 2017 05:44:24 +0000 (14:44 +0900)

cvsserver: move safe_pipe_capture() to the main package

As a preparation for replacing `command` with a call to this
function from outside GITCVS::updater package, move it to the main
package.

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

Git 2.10.4 v2.10.4Junio C Hamano Sun, 30 Jul 2017 22:00:04 +0000 (15:00 -0700)

Git 2.10.4

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

Merge tag 'v2.9.5' into maint-2.10Junio C Hamano Sun, 30 Jul 2017 21:57:33 +0000 (14:57 -0700)

Merge tag 'v2.9.5' into maint-2.10

Git 2.9.5

Git 2.9.5 v2.9.5Junio C Hamano Sun, 30 Jul 2017 21:53:25 +0000 (14:53 -0700)

Git 2.9.5

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

Merge tag 'v2.8.6' into maint-2.9Junio C Hamano Sun, 30 Jul 2017 21:52:14 +0000 (14:52 -0700)

Merge tag 'v2.8.6' into maint-2.9

Git 2.8.6

Git 2.8.6 v2.8.6Junio C Hamano Sun, 30 Jul 2017 21:49:08 +0000 (14:49 -0700)

Git 2.8.6

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

Merge tag 'v2.7.6' into maint-2.8Junio C Hamano Sun, 30 Jul 2017 21:46:43 +0000 (14:46 -0700)

Merge tag 'v2.7.6' into maint-2.8

Git 2.7.6

Git 2.7.6 v2.7.6Junio C Hamano Sun, 30 Jul 2017 21:45:13 +0000 (14:45 -0700)

Git 2.7.6

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

Merge branch 'jk/ssh-funny-url' into maint-2.7Junio C Hamano Fri, 28 Jul 2017 23:11:54 +0000 (16:11 -0700)

Merge branch 'jk/ssh-funny-url' into maint-2.7

connect: reject paths that look like command line optionsJeff King Fri, 28 Jul 2017 19:28:55 +0000 (15:28 -0400)

connect: reject paths that look like command line options

If we get a repo path like "-repo.git", we may try to invoke
"git-upload-pack -repo.git". This is going to fail, since
upload-pack will interpret it as a set of bogus options. But
let's reject this before we even run the sub-program, since
we would not want to allow any mischief with repo names that
actually are real command-line options.

You can still ask for such a path via git-daemon, but there's no
security problem there, because git-daemon enters the repo itself
and then passes "." on the command line.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

connect: reject dashed arguments for proxy commandsJeff King Fri, 28 Jul 2017 19:26:50 +0000 (15:26 -0400)

connect: reject dashed arguments for proxy commands

If you have a GIT_PROXY_COMMAND configured, we will run it
with the host/port on the command-line. If a URL contains a
mischievous host like "--foo", we don't know how the proxy
command may handle it. It's likely to break, but it may also
do something dangerous and unwanted (technically it could
even do something useful, but that seems unlikely).

We should err on the side of caution and reject this before
we even run the command.

The hostname check matches the one we do in a similar
circumstance for ssh. The port check is not present for ssh,
but there it's not necessary because the syntax is "-p
<port>", and there's no ambiguity on the parsing side.

It's not clear whether you can actually get a negative port
to the proxy here or not. Doing:

git fetch git://remote:-1234/repo.git

keeps the "-1234" as part of the hostname, with the default
port of 9418. But it's a good idea to keep this check close
to the point of running the command to make it clear that
there's no way to circumvent it (and at worst it serves as a
belt-and-suspenders check).

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

connect: factor out "looks like command line option... Jeff King Fri, 28 Jul 2017 19:25:45 +0000 (15:25 -0400)

connect: factor out "looks like command line option" check

We reject hostnames that start with a dash because they may
be confused for command-line options. Let's factor out that
notion into a helper function, as we'll use it in more
places. And while it's simple now, it's not clear if some
systems might need more complex logic to handle all cases.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5813: add test for hostname starting with dashJeff King Fri, 28 Jul 2017 19:23:32 +0000 (15:23 -0400)

t5813: add test for hostname starting with dash

Per the explanation in the previous patch, this should be
(and is) rejected.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

connect: reject ssh hostname that begins with a dashJunio C Hamano Wed, 26 Jul 2017 17:24:20 +0000 (10:24 -0700)

connect: reject ssh hostname that begins with a dash

When commands like "git fetch" talk with ssh://$rest_of_URL/, the
code splits $rest_of_URL into components like host, port, etc., and
then spawns the underlying "ssh" program by formulating argv[] array
that has:

- the path to ssh command taken from GIT_SSH_COMMAND, etc.

- dashed options like '-batch' (for Tortoise), '-p <port>' as
needed.

- ssh_host, which is supposed to be the hostname parsed out of
$rest_of_URL.

- then the command to be run on the other side, e.g. git
upload-pack.

If the ssh_host ends up getting '-<anything>', the argv[] that is
used to spawn the command becomes something like:

{ "ssh", "-p", "22", "-<anything>", "command", "to", "run", NULL }

which obviously is bogus, but depending on the actual value of
"<anything>", will make "ssh" parse and use it as an option.

Prevent this by forbidding ssh_host that begins with a "-".

Noticed-by: Joern Schneeweisz of Recurity Labs
Reported-by: Brian at GitLab
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.10.3 v2.10.3Junio C Hamano Fri, 5 May 2017 04:24:10 +0000 (13:24 +0900)

Git 2.10.3

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

Merge branch 'maint-2.9' into maint-2.10Junio C Hamano Fri, 5 May 2017 04:21:52 +0000 (13:21 +0900)

Merge branch 'maint-2.9' into maint-2.10

Git 2.9.4 v2.9.4Junio C Hamano Fri, 5 May 2017 04:18:23 +0000 (13:18 +0900)

Git 2.9.4

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

Merge branch 'maint-2.8' into maint-2.9Junio C Hamano Fri, 5 May 2017 04:13:48 +0000 (13:13 +0900)

Merge branch 'maint-2.8' into maint-2.9

Git 2.8.5 v2.8.5Junio C Hamano Fri, 5 May 2017 04:08:54 +0000 (13:08 +0900)

Git 2.8.5

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

Merge branch 'maint-2.7' into maint-2.8Junio C Hamano Fri, 5 May 2017 04:05:03 +0000 (13:05 +0900)

Merge branch 'maint-2.7' into maint-2.8

Git 2.7.5 v2.7.5Junio C Hamano Fri, 5 May 2017 04:03:40 +0000 (13:03 +0900)

Git 2.7.5

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

Merge branch 'maint-2.6' into maint-2.7Junio C Hamano Fri, 5 May 2017 03:59:16 +0000 (12:59 +0900)

Merge branch 'maint-2.6' into maint-2.7

Git 2.6.7 v2.6.7Junio C Hamano Fri, 5 May 2017 03:56:19 +0000 (12:56 +0900)

Git 2.6.7

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

Merge branch 'maint-2.5' into maint-2.6Junio C Hamano Fri, 5 May 2017 03:52:26 +0000 (12:52 +0900)

Merge branch 'maint-2.5' into maint-2.6

Git 2.5.6 v2.5.6Junio C Hamano Fri, 5 May 2017 03:49:00 +0000 (12:49 +0900)

Git 2.5.6

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

Merge branch 'maint-2.4' into maint-2.5Junio C Hamano Fri, 5 May 2017 03:46:53 +0000 (12:46 +0900)

Merge branch 'maint-2.4' into maint-2.5

Git 2.4.12 v2.4.12Junio C Hamano Fri, 5 May 2017 03:25:09 +0000 (12:25 +0900)

Git 2.4.12

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

Merge branch 'jk/shell-no-repository-that-begins-with... Junio C Hamano Fri, 5 May 2017 03:17:55 +0000 (12:17 +0900)

Merge branch 'jk/shell-no-repository-that-begins-with-dash' into maint-2.4

* jk/shell-no-repository-that-begins-with-dash:
shell: disallow repo names beginning with dash

shell: disallow repo names beginning with dashJeff King Sat, 29 Apr 2017 12:36:44 +0000 (08:36 -0400)

shell: disallow repo names beginning with dash

When a remote server uses git-shell, the client side will
connect to it like:

ssh server "git-upload-pack 'foo.git'"

and we literally exec ("git-upload-pack", "foo.git"). In
early versions of upload-pack and receive-pack, we took a
repository argument and nothing else. But over time they
learned to accept dashed options. If the user passes a
repository name that starts with a dash, the results are
confusing at best (we complain of a bogus option instead of
a non-existent repository) and malicious at worst (the user
can start an interactive pager via "--help").

We could pass "--" to the sub-process to make sure the
user's argument is interpreted as a branch name. I.e.:

git-upload-pack -- -foo.git

But adding "--" automatically would make us inconsistent
with a normal shell (i.e., when git-shell is not in use),
where "-foo.git" would still be an error. For that case, the
client would have to specify the "--", but they can't do so
reliably, as existing versions of git-shell do not allow
more than a single argument.

The simplest thing is to simply disallow "-" at the start of
the repo name argument. This hasn't worked either with or
without git-shell since version 1.0.0, and nobody has
complained.

Note that this patch just applies to do_generic_cmd(), which
runs upload-pack, receive-pack, and upload-archive. There
are two other types of commands that git-shell runs:

- do_cvs_cmd(), but this already restricts the argument to
be the literal string "server"

- admin-provided commands in the git-shell-commands
directory. We'll pass along arbitrary arguments there,
so these commands could have similar problems. But these
commands might actually understand dashed arguments, so
we cannot just block them here. It's up to the writer of
the commands to make sure they are safe. With great
power comes great responsibility.

Reported-by: Timo Schmid <tschmid@ernw.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

preparing for 2.10.3Junio C Hamano Mon, 5 Dec 2016 19:25:02 +0000 (11:25 -0800)

preparing for 2.10.3

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

Merge branch 'jk/common-main' into maint-2.10Junio C Hamano Mon, 5 Dec 2016 19:24:17 +0000 (11:24 -0800)

Merge branch 'jk/common-main' into maint-2.10

* jk/common-main:
common-main: stop munging argv[0] path
git-compat-util: move content inside ifdef/endif guards

Merge branch 'tk/diffcore-delta-remove-unused' into... Junio C Hamano Tue, 29 Nov 2016 21:28:03 +0000 (13:28 -0800)

Merge branch 'tk/diffcore-delta-remove-unused' into maint

Code cleanup.

* tk/diffcore-delta-remove-unused:
diffcore-delta: remove unused parameter to diffcore_count_changes()

Merge branch 'jk/create-branch-remove-unused-param... Junio C Hamano Tue, 29 Nov 2016 21:28:02 +0000 (13:28 -0800)

Merge branch 'jk/create-branch-remove-unused-param' into maint

Code clean-up.

* jk/create-branch-remove-unused-param:
create_branch: drop unused "head" parameter

Merge branch 'nd/worktree-lock' into maintJunio C Hamano Tue, 29 Nov 2016 21:28:02 +0000 (13:28 -0800)

Merge branch 'nd/worktree-lock' into maint

Typofix.

* nd/worktree-lock:
git-worktree.txt: fix typo "to"/"two", and add comma

Merge branch 'ps/common-info-doc' into maintJunio C Hamano Tue, 29 Nov 2016 21:28:01 +0000 (13:28 -0800)

Merge branch 'ps/common-info-doc' into maint

Doc fix.

* ps/common-info-doc:
doc: fix location of 'info/' with $GIT_COMMON_DIR

Merge branch 'rs/cocci' into maintJunio C Hamano Tue, 29 Nov 2016 21:28:00 +0000 (13:28 -0800)

Merge branch 'rs/cocci' into maint

Improve the rule to convert "unsigned char [20]" into "struct
object_id *" in contrib/coccinelle/

* rs/cocci:
cocci: avoid self-references in object_id transformations

Merge branch 'nd/test-helpers' into maintJunio C Hamano Tue, 29 Nov 2016 21:28:00 +0000 (13:28 -0800)

Merge branch 'nd/test-helpers' into maint

Update to the test framework made in 2.9 timeframe broke running
the tests under valgrind, which has been fixed.

* nd/test-helpers:
valgrind: support test helpers

Merge branch 'sc/fmt-merge-msg-doc-markup-fix' into... Junio C Hamano Tue, 29 Nov 2016 21:27:59 +0000 (13:27 -0800)

Merge branch 'sc/fmt-merge-msg-doc-markup-fix' into maint

Documentation fix.

* sc/fmt-merge-msg-doc-markup-fix:
Documentation/fmt-merge-msg: fix markup in example

Merge branch 'rs/commit-pptr-simplify' into maintJunio C Hamano Tue, 29 Nov 2016 21:27:59 +0000 (13:27 -0800)

Merge branch 'rs/commit-pptr-simplify' into maint

Code simplification.

* rs/commit-pptr-simplify:
commit: simplify building parents list

Merge branch 'jk/rebase-config-insn-fmt-docfix' into... Junio C Hamano Tue, 29 Nov 2016 21:27:58 +0000 (13:27 -0800)

Merge branch 'jk/rebase-config-insn-fmt-docfix' into maint

Documentation fix.

* jk/rebase-config-insn-fmt-docfix:
doc: fix missing "::" in config list

Merge branch 'ak/pre-receive-hook-template-modefix... Junio C Hamano Tue, 29 Nov 2016 21:27:57 +0000 (13:27 -0800)

Merge branch 'ak/pre-receive-hook-template-modefix' into maint

A trivial clean-up to a recently graduated topic.

* ak/pre-receive-hook-template-modefix:
pre-receive.sample: mark it executable

Merge branch 'ls/macos-update' into maintJunio C Hamano Tue, 29 Nov 2016 21:27:56 +0000 (13:27 -0800)

Merge branch 'ls/macos-update' into maint

Portability update and workaround for builds on recent Mac OS X.

* ls/macos-update:
travis-ci: disable GIT_TEST_HTTPD for macOS
Makefile: set NO_OPENSSL on macOS by default

Merge branch 'as/merge-attr-sleep' into maintJunio C Hamano Tue, 29 Nov 2016 21:27:56 +0000 (13:27 -0800)

Merge branch 'as/merge-attr-sleep' into maint

Fix for a racy false-positive test failure.

* as/merge-attr-sleep:
t6026: clarify the point of "kill $(cat sleep.pid)"
t6026: ensure that long-running script really is
Revert "t6026-merge-attr: don't fail if sleep exits early"
Revert "t6026-merge-attr: ensure that the merge driver was called"
t6026-merge-attr: ensure that the merge driver was called
t6026-merge-attr: don't fail if sleep exits early

Merge branch 'ak/sh-setup-dot-source-i18n-fix' into... Junio C Hamano Tue, 29 Nov 2016 21:27:56 +0000 (13:27 -0800)

Merge branch 'ak/sh-setup-dot-source-i18n-fix' into maint

Recent update to git-sh-setup (a library of shell functions that
are used by our in-tree scripted Porcelain commands) included
another shell library git-sh-i18n without specifying where it is,
relying on the $PATH. This has been fixed to be more explicit by
prefixing $(git --exec-path) output in front.

* ak/sh-setup-dot-source-i18n-fix:
git-sh-setup: be explicit where to dot-source git-sh-i18n from.

Merge branch 'jk/daemon-path-ok-check-truncation' into... Junio C Hamano Tue, 29 Nov 2016 21:27:55 +0000 (13:27 -0800)

Merge branch 'jk/daemon-path-ok-check-truncation' into maint

"git daemon" used fixed-length buffers to turn URL to the
repository the client asked for into the server side directory
path, using snprintf() to avoid overflowing these buffers, but
allowed possibly truncated paths to the directory. This has been
tightened to reject such a request that causes overlong path to be
required to serve.

* jk/daemon-path-ok-check-truncation:
daemon: detect and reject too-long paths

Merge branch 'rs/ring-buffer-wraparound' into maintJunio C Hamano Tue, 29 Nov 2016 21:27:55 +0000 (13:27 -0800)

Merge branch 'rs/ring-buffer-wraparound' into maint

The code that we have used for the past 10+ years to cycle
4-element ring buffers turns out to be not quite portable in
theoretical world.

* rs/ring-buffer-wraparound:
hex: make wraparound of the index into ring-buffer explicit

Merge branch 'mm/send-email-cc-cruft-after-address... Junio C Hamano Tue, 29 Nov 2016 21:27:54 +0000 (13:27 -0800)

Merge branch 'mm/send-email-cc-cruft-after-address' into maint

"git send-email" attempts to pick up valid e-mails from the
trailers, but people in real world write non-addresses there, like
"Cc: Stable <add@re.ss> # 4.8+", which broke the output depending
on the availability and vintage of Mail::Address perl module.

* mm/send-email-cc-cruft-after-address:
Git.pm: add comment pointing to t9000
t9000-addresses: update expected results after fix
parse_mailboxes: accept extra text after <...> address

Merge branch 'cp/completion-negative-refs' into maintJunio C Hamano Tue, 29 Nov 2016 21:27:53 +0000 (13:27 -0800)

Merge branch 'cp/completion-negative-refs' into maint

The command-line completion script (in contrib/) learned to
complete "git cmd ^mas<HT>" to complete the negative end of
reference to "git cmd ^master".

* cp/completion-negative-refs:
completion: support excluding refs

Merge branch 'jc/am-read-author-file' into maintJunio C Hamano Tue, 29 Nov 2016 21:27:53 +0000 (13:27 -0800)

Merge branch 'jc/am-read-author-file' into maint

Extract a small helper out of the function that reads the authors
script file "git am" internally uses.
This by itself is not useful until a second caller appears in the
future for "rebase -i" helper.

* jc/am-read-author-file:
am: refactor read_author_script()

common-main: stop munging argv[0] pathJeff King Sun, 27 Nov 2016 04:31:13 +0000 (23:31 -0500)

common-main: stop munging argv[0] path

Since 650c44925 (common-main: call git_extract_argv0_path(),
2016-07-01), the argv[0] that is seen in cmd_main() of
individual programs is always the basename of the
executable, as common-main strips off the full path. This
can produce confusing results for git-daemon, which wants to
re-exec itself.

For instance, if the program was originally run as
"/usr/lib/git/git-daemon", it will try just re-execing
"git-daemon", which will find the first instance in $PATH.
If git's exec-path has not been prepended to $PATH, we may
find the git-daemon from a different version (or no
git-daemon at all).

Normally this isn't a problem. Git commands are run as "git
daemon", the git wrapper puts the exec-path at the front of
$PATH, and argv[0] is already "daemon" anyway. But running
git-daemon via its full exec-path, while not really a
recommended method, did work prior to 650c44925. Let's make
it work again.

The real goal of 650c44925 was not to munge argv[0], but to
reliably set the argv0_path global. The only reason it
munges at all is that one caller, the git.c wrapper,
piggy-backed on that computation to find the command
basename. Instead, let's leave argv[0] untouched in
common-main, and have git.c do its own basename computation.

While we're at it, let's drop the return value from
git_extract_argv0_path(). It was only ever used in this one
callsite, and its dual purposes is what led to this
confusion in the first place.

Note that by changing the interface, the compiler can
confirm for us that there are no other callers storing the
return value. But the compiler can't tell us whether any of
the cmd_main() functions (besides git.c) were relying on the
basename munging. However, we can observe that prior to
650c44925, no other cmd_main() functions did that munging,
and no new cmd_main() functions have been introduced since
then. So we can't be regressing any of those cases.

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

diffcore-delta: remove unused parameter to diffcore_cou... Tobias Klauser Mon, 14 Nov 2016 13:39:05 +0000 (14:39 +0100)

diffcore-delta: remove unused parameter to diffcore_count_changes()

The delta_limit parameter to diffcore_count_changes() has been unused
since commit ba23bbc8e ("diffcore-delta: make change counter to byte
oriented again.", 2006-03-04).

Remove the parameter and adjust all callers.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-worktree.txt: fix typo "to"/"two", and add commaBen North Sat, 12 Nov 2016 08:55:16 +0000 (08:55 +0000)

git-worktree.txt: fix typo "to"/"two", and add comma

Signed-off-by: Ben North <ben@redfrontdoor.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t6026: clarify the point of "kill $(cat sleep.pid)"Johannes Sixt Fri, 11 Nov 2016 20:24:44 +0000 (21:24 +0100)

t6026: clarify the point of "kill $(cat sleep.pid)"

We lengthened the time the leftover process sleeps in the previous
commit to make sure it will be there while 'git merge' runs and
finishes. It therefore needs to be killed before leaving the test.
And it needs to be killed even when 'git merge' fails, so it has to
be triggered via test_when_finished mechanism.

Explain all that in a large comment, and move the use site of
test_when_finished to immediately before 'git merge' invocation,
where the process is spawned.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc: fix location of 'info/' with $GIT_COMMON_DIRPatrick Steinhardt Fri, 11 Nov 2016 11:23:32 +0000 (12:23 +0100)

doc: fix location of 'info/' with $GIT_COMMON_DIR

With the introduction of the $GIT_COMMON_DIR variable, the
repository layout manual was changed to reflect the location for
many files in case the variable is set. While adding the new
locations, one typo snuck in regarding the location of the
'info/' folder, which is falsely claimed to reside at
"$GIT_COMMON_DIR/index".

Fix the typo to point to "$GIT_COMMON_DIR/info/" instead.

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

t6026: ensure that long-running script really isJohannes Schindelin Wed, 9 Nov 2016 13:51:22 +0000 (14:51 +0100)

t6026: ensure that long-running script really is

When making sure that background tasks are cleaned up in 5babb5b
(t6026-merge-attr: clean up background process at end of test case,
2016-09-07), we considered to let the background task sleep longer, just
to be certain that it will still be running when we want to kill it
after the test.

Sadly, the assumption appears not to hold true that the test case passes
quickly enough to kill the background task within a second.

Simply increase it to an hour. No system can be possibly slow enough to
make above-mentioned assumption incorrect.

Reported by Andreas Schwab.

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

Revert "t6026-merge-attr: don't fail if sleep exits... Junio C Hamano Thu, 10 Nov 2016 23:55:13 +0000 (15:55 -0800)

Revert "t6026-merge-attr: don't fail if sleep exits early"

This reverts commit 734fde2d7167e4b20d2ff6062ade3846949b0741.

The point of the test is that the stray process was still running
when 'git merge' did its thing through its completion, so a failure
to "kill" it means we didn't give a condition to the test to trigger
a possible future breakage. Appending "|| :" to the "kill" is
sweeping a test-bug under the rug.

Revert "t6026-merge-attr: ensure that the merge driver... Junio C Hamano Thu, 10 Nov 2016 23:54:12 +0000 (15:54 -0800)

Revert "t6026-merge-attr: ensure that the merge driver was called"

This reverts commit c1e0dc59bddce765761a6f863c66ee0cd4b2ca09.

We are not interested in the stray process in the merge driver
started; we want it to be still around.

t6026-merge-attr: ensure that the merge driver was... Andreas Schwab Thu, 10 Nov 2016 08:31:18 +0000 (09:31 +0100)

t6026-merge-attr: ensure that the merge driver was called

Explicitly check for the existence of the pid file to test that the
merge driver was actually called.

Signed-off-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

travis-ci: disable GIT_TEST_HTTPD for macOSLars Schneider Mon, 17 Oct 2016 00:25:50 +0000 (17:25 -0700)

travis-ci: disable GIT_TEST_HTTPD for macOS

TravisCI changed their default macOS image from 10.10 to 10.11 [1].
Unfortunately the HTTPD tests do not run out of the box using the
pre-installed Apache web server anymore. Therefore we enable these
tests only for Linux and disable them for macOS.

[1] https://blog.travis-ci.com/2016-10-04-osx-73-default-image-live/

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: set NO_OPENSSL on macOS by defaultLars Schneider Sun, 6 Nov 2016 19:35:04 +0000 (20:35 +0100)

Makefile: set NO_OPENSSL on macOS by default

Apple removed the OpenSSL header files in macOS 10.11 and above. OpenSSL
was deprecated since macOS 10.7.

Set `NO_OPENSSL` and `APPLE_COMMON_CRYPTO` to `YesPlease` as default for
macOS. It is possible to override this and use OpenSSL by defining
`NO_APPLE_COMMON_CRYPTO`.

Original-patch-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

create_branch: drop unused "head" parameterJeff King Fri, 4 Nov 2016 16:30:12 +0000 (12:30 -0400)

create_branch: drop unused "head" parameter

This function used to have the caller pass in the current
value of HEAD, in order to make sure we didn't clobber HEAD.
In 55c4a6730, that logic moved to validate_new_branchname(),
which just resolves HEAD itself. The parameter to
create_branch is now unused.

Since we have to update and re-wrap the docstring describing
the parameters anyway, let's take this opportunity to break
it out into a list, which makes it easier to find the
parameters.

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

t6026-merge-attr: don't fail if sleep exits earlyAndreas Schwab Tue, 8 Nov 2016 17:03:04 +0000 (18:03 +0100)

t6026-merge-attr: don't fail if sleep exits early

Commit 5babb5bdb3 ("t6026-merge-attr: clean up background process at end
of test case") added a kill command to clean up after the test, but this
can fail if the sleep command exits before the cleanup is executed.
Ignore the error from the kill command.

Signed-off-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Jeff King <peff@peff.net>

cocci: avoid self-references in object_id transformationsRené Scharfe Tue, 1 Nov 2016 08:49:12 +0000 (09:49 +0100)

cocci: avoid self-references in object_id transformations

The object_id functions oid_to_hex, oid_to_hex_r, oidclr, oidcmp, and
oidcpy are defined as wrappers of their legacy counterparts sha1_to_hex,
sha1_to_hex_r, hashclr, hashcmp, and hashcpy, respectively. Make sure
that the Coccinelle transformations for converting legacy function calls
are not applied to these wrappers themselves, which would result in
tautological declarations.

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

git-sh-setup: be explicit where to dot-source git-sh... Anders Kaseorg Sun, 30 Oct 2016 02:10:02 +0000 (22:10 -0400)

git-sh-setup: be explicit where to dot-source git-sh-i18n from.

d323c6b641 ("i18n: git-sh-setup.sh: mark strings for translation",
2016-06-17) started to dot-source git-sh-i18n shell script library,
assuming that $PATH is already adjusted for our scripts, namely,
$GIT_EXEC_PATH is at the beginning of $PATH.

Old contrib scripts like contrib/convert-grafts-to-replace-refs.sh
and contrib/rerere-train.sh and third-party scripts like guilt may
however be using this as ". $(git --exec-path)/git-sh-setup",
without satisfying that assumption. Be more explicit by specifying
its path prefixed with "$(git --exec-path)/". to be safe.

While we’re here, move the sourcing of git-sh-i18n below the shell
portability fixes.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: simplify building parents listRené Scharfe Sat, 29 Oct 2016 12:55:36 +0000 (14:55 +0200)

commit: simplify building parents list

Push pptr down into the FROM_MERGE branch of the if/else statement,
where it's actually used, and call commit_list_append() for appending
elements instead of playing tricks with commit_list_insert(). Call
copy_commit_list() in the amend branch instead of open-coding it. Don't
bother setting pptr in the final branch as it's not used thereafter.

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

doc: fix missing "::" in config listJeff King Sun, 30 Oct 2016 18:46:33 +0000 (14:46 -0400)

doc: fix missing "::" in config list

The rebase.instructionFormat option is missing its "::" to
tell AsciiDoc that it's a list entry. As a result, the
option name gets lumped into the description in one big
paragraph.

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

pre-receive.sample: mark it executableAnders Kaseorg Fri, 28 Oct 2016 18:40:41 +0000 (14:40 -0400)

pre-receive.sample: mark it executable

For consistency with other hooks, make the sample hook executable.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.10.2 v2.10.2Junio C Hamano Fri, 28 Oct 2016 16:02:44 +0000 (09:02 -0700)

Git 2.10.2

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

Merge branch 'pb/test-parse-options-expect' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:24 +0000 (09:01 -0700)

Merge branch 'pb/test-parse-options-expect' into maint

Test clean-up.

* pb/test-parse-options-expect:
t0040: convert all possible tests to use `test-parse-options --expect`

Merge branch 'jc/cocci-xstrdup-or-null' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:23 +0000 (09:01 -0700)

Merge branch 'jc/cocci-xstrdup-or-null' into maint

Code cleanup.

* jc/cocci-xstrdup-or-null:
cocci: refactor common patterns to use xstrdup_or_null()

Merge branch 'rs/cocci' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:23 +0000 (09:01 -0700)

Merge branch 'rs/cocci' into maint

Code cleanup.

* rs/cocci:
use strbuf_add_unique_abbrev() for adding short hashes, part 3
remove unnecessary NULL check before free(3)
coccicheck: make transformation for strbuf_addf(sb, "...") more precise
use strbuf_add_unique_abbrev() for adding short hashes, part 2
use strbuf_addstr() instead of strbuf_addf() with "%s", part 2
gitignore: ignore output files of coccicheck make target
use strbuf_addstr() for adding constant strings to a strbuf, part 2
add coccicheck make target
contrib/coccinelle: fix semantic patch for oid_to_hex_r()

Merge branch 'jc/diff-unique-abbrev-comments' into... Junio C Hamano Fri, 28 Oct 2016 16:01:23 +0000 (09:01 -0700)

Merge branch 'jc/diff-unique-abbrev-comments' into maint

A bit more comments in a tricky code.

* jc/diff-unique-abbrev-comments:
diff_unique_abbrev(): document its assumption and limitation

Merge branch 'rs/pretty-format-color-doc-fix' into... Junio C Hamano Fri, 28 Oct 2016 16:01:23 +0000 (09:01 -0700)

Merge branch 'rs/pretty-format-color-doc-fix' into maint

Small doc update.

* rs/pretty-format-color-doc-fix:
pretty: fix document link for color specification

Merge branch 'js/reset-usage' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:22 +0000 (09:01 -0700)

Merge branch 'js/reset-usage' into maint

Message fix-up.

* js/reset-usage:
reset: fix usage

Merge branch 'po/fix-doc-merge-base-illustration' into... Junio C Hamano Fri, 28 Oct 2016 16:01:21 +0000 (09:01 -0700)

Merge branch 'po/fix-doc-merge-base-illustration' into maint

Some AsciiDoc formatter mishandles a displayed illustration with
tabs in it. Adjust a few of them in merge-base documentation to
work around them.

* po/fix-doc-merge-base-illustration:
doc: fix the 'revert a faulty merge' ASCII art tab spacing
doc: fix merge-base ASCII art tab spacing

Merge branch 'jk/tap-verbose-fix' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:20 +0000 (09:01 -0700)

Merge branch 'jk/tap-verbose-fix' into maint

The Travis CI configuration we ship ran the tests with --verbose
option but this risks non-TAP output that happens to be "ok" to be
misinterpreted as TAP signalling a test that passed. This resulted
in unnecessary failure. This has been corrected by introducing a
new mode to run our tests in the test harness to send the verbose
output separately to the log file.

* jk/tap-verbose-fix:
test-lib: bail out when "-v" used under "prove"
travis: use --verbose-log test option
test-lib: add --verbose-log option
test-lib: handle TEST_OUTPUT_DIRECTORY with spaces

Merge branch 'tg/add-chmod+x-fix' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:19 +0000 (09:01 -0700)

Merge branch 'tg/add-chmod+x-fix' into maint

A hot-fix for a test added by a recent topic that went to both
'master' and 'maint' already.

* tg/add-chmod+x-fix:
t3700: fix broken test under !SANITY

Merge branch 'bw/submodule-branch-dot-doc' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:19 +0000 (09:01 -0700)

Merge branch 'bw/submodule-branch-dot-doc' into maint

Recent git allows submodule.<name>.branch to use a special token
"." instead of the branch name; the documentation has been updated
to describe it.

* bw/submodule-branch-dot-doc:
submodules doc: update documentation for "." used for submodule branches

Merge branch 'jk/tighten-alloc' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:18 +0000 (09:01 -0700)

Merge branch 'jk/tighten-alloc' into maint

Protect our code from over-eager compilers.

* jk/tighten-alloc:
inline xalloc_flex() into FLEXPTR_ALLOC_MEM
avoid pointer arithmetic involving NULL in FLEX_ALLOC_MEM

Merge branch 'jk/fetch-quick-tag-following' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:17 +0000 (09:01 -0700)

Merge branch 'jk/fetch-quick-tag-following' into maint

When fetching from a remote that has many tags that are irrelevant
to branches we are following, we used to waste way too many cycles
when checking if the object pointed at by a tag (that we are not
going to fetch!) exists in our repository too carefully.

* jk/fetch-quick-tag-following:
fetch: use "quick" has_sha1_file for tag following

Merge branch 'jk/merge-base-fork-point-without-reflog... Junio C Hamano Fri, 28 Oct 2016 16:01:17 +0000 (09:01 -0700)

Merge branch 'jk/merge-base-fork-point-without-reflog' into maint

"git rebase" immediately after "git clone" failed to find the fork
point from the upstream.

* jk/merge-base-fork-point-without-reflog:
merge-base: handle --fork-point without reflog

Merge branch 'dk/worktree-dup-checkout-with-bare-is... Junio C Hamano Fri, 28 Oct 2016 16:01:16 +0000 (09:01 -0700)

Merge branch 'dk/worktree-dup-checkout-with-bare-is-ok' into maint

In a worktree connected to a repository elsewhere, created via "git
worktree", "git checkout" attempts to protect users from confusion
by refusing to check out a branch that is already checked out in
another worktree. However, this also prevented checking out a
branch, which is designated as the primary branch of a bare
reopsitory, in a worktree that is connected to the bare
repository. The check has been corrected to allow it.

* dk/worktree-dup-checkout-with-bare-is-ok:
worktree: allow the main brach of a bare repository to be checked out

Merge branch 'sb/submodule-config-doc-drop-path' into... Junio C Hamano Fri, 28 Oct 2016 16:01:16 +0000 (09:01 -0700)

Merge branch 'sb/submodule-config-doc-drop-path' into maint

The "submodule.<name>.path" stored in .gitmodules is never copied
to .git/config and such a key in .git/config has no meaning, but
the documentation described it and submodule.<name>.url next to
each other as if both belong to .git/config. This has been fixed.

* sb/submodule-config-doc-drop-path:
documentation: improve submodule.<name>.{url, path} description

Merge branch 'jk/ref-symlink-loop' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:15 +0000 (09:01 -0700)

Merge branch 'jk/ref-symlink-loop' into maint

A stray symbolic link in $GIT_DIR/refs/ directory could make name
resolution loop forever, which has been corrected.

* jk/ref-symlink-loop:
files_read_raw_ref: prevent infinite retry loops in general
files_read_raw_ref: avoid infinite loop on broken symlinks

Merge branch 'nd/commit-p-doc' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:15 +0000 (09:01 -0700)

Merge branch 'nd/commit-p-doc' into maint

Documentation for "git commit" was updated to clarify that "commit
-p <paths>" adds to the current contents of the index to come up
with what to commit.

* nd/commit-p-doc:
git-commit.txt: clarify --patch mode with pathspec

Merge branch 'jk/clone-copy-alternates-fix' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:14 +0000 (09:01 -0700)

Merge branch 'jk/clone-copy-alternates-fix' into maint

"git clone" of a local repository can be done at the filesystem
level, but the codepath did not check errors while copying and
adjusting the file that lists alternate object stores.

* jk/clone-copy-alternates-fix:
clone: detect errors in normalize_path_copy

Merge branch 'dt/http-empty-auth' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:14 +0000 (09:01 -0700)

Merge branch 'dt/http-empty-auth' into maint

http.emptyauth configuration is a way to allow an empty username to
pass when attempting to authenticate using mechanisms like
Kerberos. We took an unspecified (NULL) username and sent ":"
(i.e. no username, no password) to CURLOPT_USERPWD, but did not do
the same when the username is explicitly set to an empty string.

* dt/http-empty-auth:
http: http.emptyauth should allow empty (not just NULL) usernames

Merge branch 'dp/autoconf-curl-ssl' into maintJunio C Hamano Fri, 28 Oct 2016 16:01:13 +0000 (09:01 -0700)

Merge branch 'dp/autoconf-curl-ssl' into maint

The ./configure script generated from configure.ac was taught how
to detect support of SSL by libcurl better.

* dp/autoconf-curl-ssl:
./configure.ac: detect SSL in libcurl using curl-config

Merge branch 'ak/curl-imap-send-explicit-scheme' into... Junio C Hamano Fri, 28 Oct 2016 16:01:13 +0000 (09:01 -0700)

Merge branch 'ak/curl-imap-send-explicit-scheme' into maint

When we started cURL to talk to imap server when a new enough
version of cURL library is available, we forgot to explicitly add
imap(s):// before the destination. To some folks, that didn't work
and the library tried to make HTTP(s) requests instead.

* ak/curl-imap-send-explicit-scheme:
imap-send: Tell cURL to use imap:// or imaps://