Commit graph

46960 commits

Author SHA1 Message Date
Junio C Hamano 5a88f97cff diff- and log- family: handle "git cmd -h" early
"git $builtin -h" bypasses the usual repository setup and calls the
cmd_$builtin() function, expecting it to show the help text.

Unfortunately the commands in the log- and the diff- family want to
call into the revisions machinery, which by definition needs to have
a repository already discovered.  Strictly speaking, they may not
need a repository only for parsing "-h", but it is a good discipline
to future-proof codepath to ensure that setup_revisions() is called
after we know that a repository is there.

Handle the "git $builtin -h" special case very early in these
commands to work around potential issues.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-05 11:39:59 +09:00
Jeff King f0994fa85d submodule--helper: show usage for "-h"
Normal users shouldn't ever call submodule--helper, but it
doesn't hurt to give them a normal usage message if they try
"-h".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-30 14:45:04 +09:00
Jeff King bb246590a1 remote-{ext,fd}: print usage message on invalid arguments
We just say "Expected two arguments" when we get a different
number of arguments, but we can be slightly friendlier.
People shouldn't generally be running remote helpers
themselves, but curious users might say "git remote-ext -h".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-30 14:45:04 +09:00
Jeff King 619b6c1710 upload-archive: handle "-h" option early
Normally upload-archive forks off upload-archive--writer to
do the real work, and relays any errors back over the
sideband channel. This is a good thing when the command is
properly invoked remotely via ssh or git-daemon. But it's
confusing to curious users who try "git upload-archive -h".

Let's catch this invocation early and give a real usage
message, rather than spewing "-h does not appear to be a git
repository" amidst packet-lines. The chance of a false
positive due to a real client asking for the repo "-h" is
quite small.

Likewise, we'll catch "-h" in upload-archive--writer. People
shouldn't be invoking it manually, but it doesn't hurt to
give a sane message if they do.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-30 14:45:04 +09:00
Jeff King 42fa0cbfe0 credential: handle invalid arguments earlier
The git-credential command only takes one argument: the
operation to perform. If we don't have one, we complain
immediately. But if we have one that we don't recognize, we
don't notice until after we've read the credential from
stdin. This is likely to confuse a user invoking "git
credential -h", as the program will hang waiting for their
input before showing anything.

Let's detect this case early. Likewise, we never noticed
when there are extra arguments beyond the one we're
expecting. Let's catch this with the same conditional.

Note that we don't need to handle "--help" similarly,
because the git wrapper does this before even calling
cmd_credential().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-30 14:45:03 +09:00
Jeff King f3a2fffe06 am: handle "-h" argument earlier
If the user provides "-h" on the command line, then our
parse_options() invocation will show a usage message and
quit. But if "-h" is the only argument, the git wrapper
behaves specially: it ignores our RUN_SETUP flag and calls
cmd_am() without having done repository setup at all.  This
is due to 99caeed05 (Let 'git <command> -h' show usage
without a git dir, 2009-11-09).

Before cmd_am() calls parse_options(), though, it runs a few
other setup functions. One of these is am_state_init(),
which uses git_pathdup() to set up the default rebase-apply
path. But calling git_pathdup() when we haven't done
repository setup will fall back to using ".git". That's
mostly harmless (since we won't use the value anyway), but
is forbidden since b1ef400eec ("setup_git_env: avoid blind
fall-back to ".git"", 2016-10-20), and we now BUG().

We can't easily move that setup to after the parse_options()
call; the point is to set up defaults that are overwritten
by the option parsing. Instead, we'll detect the "-h" case
early and show the usage then. This matches the behavior of
other builtins which have a similar setup-ordering issue
(e.g., git-branch).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-30 14:39:47 +09:00
Junio C Hamano b06d364310 Git 2.13
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-09 23:26:02 +09:00
Junio C Hamano 951ea7656e l10n for Git 2.13.0 round 2.1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJZEc7uAAoJEMek6Rt1RHooON8P/jehsG5LJuY2HMhR1S6KjfYW
 sqFQ8Qhee5U9eK9HUJflqjVPDFiIVnKAdcV08TO3Zh3LPn4Bxrg6I+ivR8dxz6S2
 FDxQMU0QuAMfxbb+ZMyxBNR1NV4axOw5KiSuT6vDba1kQboby/BjIIgTALmxXtMn
 U1UU3rDZiZNqCEjwxzcYw+p3vtRJT0LLc88KTIHVcsjrjRpGZnINoJ5N7dGG7yaB
 yYf4RX91UXnPC5/la5wnxFKosOdetSk3qXmjOt9HqFIPu0AMpQ/jGPCWyFwmDEe+
 0WLZ3Wz3+UFFgxmdXRMMycYgR6XD5PpY6JCB9lJohQ70ugqlxUMYwTc0vE46FCXv
 Oa+iRWnUZOHqz9rQ2FzvpLiqNhaWpu/ifKu8BhjAKzJBmqpqtgr5ZlE7fPKEz5uv
 v3DkdAGXiuFcBRLTcDAjKVS0/ZWFXjeMuM6ZIV80qNTL+0IB54pXxm0e49fBh4HV
 8WTUZoJxEfQBZsBcqdBD37RDGuB/PgzzCpk9doHZ2WWOFhAqqD01VPrXPKGagBgd
 N6nU8EnZB8US0Zi4YNn6txF+baagQCgnLHM68iDmqGX1GpO9W7SJqY6tPtcjLSkf
 NRX8SbT9gLYcRQ2ovZ/TK3PNVV0OhL3zXRGuSt6ORqBfLoHF2V1aqNyjrgjaaknl
 AOctWapWexpaPPg7tjpa
 =sP38
 -----END PGP SIGNATURE-----

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

l10n for Git 2.13.0 round 2.1

* tag 'l10n-2.13.0-rnd2.1' of git://github.com/git-l10n/git-po:
  l10n: zh_CN: for git v2.13.0 l10n round 2
  l10n: sv.po: Update Swedish translation (3195t0f0u)
  l10n: zh_CN: review for git v2.13.0 l10n round 1
  l10n: Update Catalan translation
  l10n: bg.po: Updated Bulgarian translation (3195t)
  l10n: fr.po v2.13 rnd 2
  l10n: de.po: translate 4 new messages
  l10n: de.po: update German translation
  l10n: de.po: lower case after semi-colon
  l10n: vi.po(3195t): Update translation for v2.13.0 round 2
  l10n: git.pot: v2.13.0 round 2 (4 new, 7 removed)
  l10n: zh_CN: for git v2.13.0 l10n round 1
  l10n: fr.po v2.13 round 1
  l10n: pt_PT: update Portuguese translation
  l10n: bg.po: Updated Bulgarian translation (3201t)
  l10n: vi.po(3198t): Updated Vietnamese translation for v2.13.0-rc0
  l10n: sv.po: Update Swedish translation (3199t0f0u)
  l10n: git.pot: v2.13.0 round 1 (96 new, 37 removed)
2017-05-09 23:25:26 +09:00
Jiang Xin 961f9c8b1b Merge branch 'master' of git://github.com/nafmo/git-l10n-sv
* 'master' of git://github.com/nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (3195t0f0u)
2017-05-09 22:12:34 +08:00
Jiang Xin 60638e9816 l10n: zh_CN: for git v2.13.0 l10n round 2
Translate 4 messages (3195t0f0u) for git v2.13.0-rc2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2017-05-09 21:55:38 +08:00
Peter Krefting 6402d7fcd5 l10n: sv.po: Update Swedish translation (3195t0f0u)
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2017-05-09 08:05:09 +01:00
Junio C Hamano 09fc7aff1a Sync with v2.12.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-08 20:20:21 -07:00
Junio C Hamano 9b669787fc Merge branch 'jh/verify-index-checksum-only-in-fsck'
* jh/verify-index-checksum-only-in-fsck:
  t1450: avoid use of "sed" on the index, which is a binary file
2017-05-09 12:17:42 +09:00
Ray Chen 65e2041e40 l10n: zh_CN: review for git v2.13.0 l10n round 1
Signed-off-by: Ray Chen <oldsharp@gmail.com>
2017-05-09 07:03:34 +08:00
Jiang Xin 0502887d3d Merge branch 'master' of https://github.com/vnwildman/git
* 'master' of https://github.com/vnwildman/git:
  l10n: vi.po(3195t): Update translation for v2.13.0 round 2
2017-05-09 06:39:31 +08:00
Jordi Mas 7cbacabc13 l10n: Update Catalan translation
Signed-off-by: Jordi Mas <jmas@softcatala.org>
2017-05-09 06:27:56 +08:00
Alexander Shopov 3e69979fe8 l10n: bg.po: Updated Bulgarian translation (3195t)
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2017-05-09 06:24:36 +08:00
Jiang Xin f172ad6275 Merge branch 'fr_l10n_v2.13_rnd2' of git://github.com/jnavila/git
* 'fr_l10n_v2.13_rnd2' of git://github.com/jnavila/git:
  l10n: fr.po v2.13 rnd 2
2017-05-09 06:18:53 +08:00
Jean-Noel Avila f5be008399 l10n: fr.po v2.13 rnd 2
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
2017-05-06 12:12:54 +02:00
Ralf Thielow 0efcb8b0be l10n: de.po: translate 4 new messages
Translate 4 new messages came from git.pot update in 28e1aaa48 (l10n:
git.pot: v2.13.0 round 2 (4 new, 7 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Matthias Rüster <matthias.ruester@gmail.com>
2017-05-05 19:01:24 +02:00
Ralf Thielow 5c16226833 l10n: de.po: update German translation
Translate 96 new messages came from git.pot update in dfc182b (l10n:
git.pot: v2.13.0 round 1 (96 new, 37 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Matthias Rüster <matthias.ruester@gmail.com>
2017-05-05 19:01:16 +02:00
Michael J Gruber c5614772d6 l10n: de.po: lower case after semi-colon
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2017-05-05 11:16:39 +02:00
Tran Ngoc Quan 72dd4a8e40 l10n: vi.po(3195t): Update translation for v2.13.0 round 2
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2017-05-05 13:41:32 +07:00
Junio C Hamano 95d6787973 Git 2.12.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-05 13:33:22 +09:00
Junio C Hamano ebb1f6fe9d Merge branch 'maint-2.11' into maint 2017-05-05 13:31:40 +09:00
Junio C Hamano 773e3a2e02 Git 2.11.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-05 13:29:43 +09:00
Junio C Hamano a849d36cf2 Merge branch 'maint-2.10' into maint-2.11 2017-05-05 13:26:31 +09:00
Junio C Hamano 840ed14198 Git 2.10.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-05 13:24:10 +09:00
Junio C Hamano fc92b0878c Merge branch 'maint-2.9' into maint-2.10 2017-05-05 13:21:52 +09:00
Junio C Hamano d61226c111 Git 2.9.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-05 13:19:10 +09:00
Junio C Hamano c93ab42b74 Merge branch 'maint-2.8' into maint-2.9 2017-05-05 13:13:48 +09:00
Junio C Hamano cd08873275 Git 2.8.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-05 13:08:54 +09:00
Junio C Hamano a8d93d19a2 Merge branch 'maint-2.7' into maint-2.8 2017-05-05 13:05:03 +09:00
Junio C Hamano c8dd1e3bb1 Git 2.7.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-05 13:03:40 +09:00
Junio C Hamano dc58c8554a Merge branch 'maint-2.6' into maint-2.7 2017-05-05 12:59:16 +09:00
Junio C Hamano 70fcaef90b Git 2.6.7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-05 12:56:19 +09:00
Junio C Hamano ab37a18b60 Merge branch 'maint-2.5' into maint-2.6 2017-05-05 12:52:26 +09:00
Junio C Hamano ac33201285 Git 2.5.6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-05 12:50:38 +09:00
Junio C Hamano 531788af95 Merge branch 'maint-2.4' into maint-2.5 2017-05-05 12:46:53 +09:00
Junio C Hamano 4000b40209 Git 2.4.12
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-05 12:43:16 +09:00
Junio C Hamano 5a4ffdf587 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
2017-05-05 12:17:55 +09:00
Jeff King 3ec804490a 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>
2017-05-05 12:07:27 +09:00
Jiang Xin 28e1aaa485 l10n: git.pot: v2.13.0 round 2 (4 new, 7 removed)
Generate po/git.pot from v2.13.0-rc2 for git v2.13.0 l10n round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2017-05-05 09:37:02 +08:00
Jiang Xin 694c76f5c1 Merge branch 'master' of git://github.com/git-l10n/git-po
* 'master' of git://github.com/git-l10n/git-po:
  l10n: zh_CN: for git v2.13.0 l10n round 1
  l10n: fr.po v2.13 round 1
  l10n: pt_PT: update Portuguese translation
  l10n: bg.po: Updated Bulgarian translation (3201t)
  l10n: vi.po(3198t): Updated Vietnamese translation for v2.13.0-rc0
  l10n: sv.po: Update Swedish translation (3199t0f0u)
  l10n: git.pot: v2.13.0 round 1 (96 new, 37 removed)
2017-05-05 09:35:22 +08:00
Jiang Xin 87cb7997f7 l10n: zh_CN: for git v2.13.0 l10n round 1
Translate 96 messages (3198t0f0u) for git v2.13.0-rc0.

Reviewed-by: 依云 <lilydjwg@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2017-05-05 09:32:08 +08:00
Jiang Xin 90117bda02 Merge branch 'fr_l10n_v2.13_rnd1' of git://github.com/jnavila/git
* 'fr_l10n_v2.13_rnd1' of git://github.com/jnavila/git:
  l10n: fr.po v2.13 round 1
2017-05-05 09:30:33 +08:00
Junio C Hamano 4fa66c85f1 Git 2.13-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-05-04 16:27:19 +09:00
Junio C Hamano 7c7478f45a Merge branch 'rg/a-the-typo'
Typofix.

* rg/a-the-typo:
  fix minor typos
2017-05-04 16:26:47 +09:00
Junio C Hamano c8ddd2aa11 Merge branch 'sr/hooks-cwd-doc'
* sr/hooks-cwd-doc:
  githooks.txt: clarify push hooks are always executed in $GIT_DIR
2017-05-04 16:26:46 +09:00
Junio C Hamano 9f3e2fe9f4 Merge branch 'rg/doc-submittingpatches-wordfix'
* rg/doc-submittingpatches-wordfix:
  doc: update SubmittingPatches
2017-05-04 16:26:46 +09:00