Commit graph

737 commits

Author SHA1 Message Date
Junio C Hamano 2289880f78 Merge branch 'nd/command-list'
The list of commands with their various attributes were spread
across a few places in the build procedure, but it now is getting a
bit more consolidated to allow more automation.

* nd/command-list:
  completion: allow to customize the completable command list
  completion: add and use --list-cmds=alias
  completion: add and use --list-cmds=nohelpers
  Move declaration for alias.c to alias.h
  completion: reduce completable command list
  completion: let git provide the completable command list
  command-list.txt: documentation and guide line
  help: use command-list.txt for the source of guides
  help: add "-a --verbose" to list all commands with synopsis
  git: support --list-cmds=list-<category>
  completion: implement and use --list-cmds=main,others
  git --list-cmds: collect command list in a string_list
  git.c: convert --list-* to --list-cmds=*
  Remove common-cmds.h
  help: use command-list.h for common command list
  generate-cmds.sh: export all commands to command-list.h
  generate-cmds.sh: factor out synopsis extract code
2018-06-01 15:06:37 +09:00
Nguyễn Thái Ngọc Duy 6532f3740b completion: allow to customize the completable command list
By default we show porcelain, external commands and a couple others
that are also popular. If you are not happy with this list, you can
now customize it a new config variable.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21 13:23:14 +09:00
Nguyễn Thái Ngọc Duy 3301d36b29 completion: add and use --list-cmds=alias
By providing aliases via --list-cmds=, we could simplify command
collection code in the script. We only issue one git command. Before
this patch that is "git config", after it's "git --list-cmds=". In
"git help" completion case we actually reduce one "git" process (for
getting guides) but that call was added in this series so it does not
really count.

A couple of bash functions are removed because they are not needed
anymore. __git_compute_all_commands() and $__git_all_commands stay
because they are still needed for completing pager.* config and
without "alias" group, the result is still cacheable.

There is a slight (good) change in _git_help() with this patch: before
"git help <tab>" shows external commands (as in _not_ part of git) as
well as part of $__git_all_commands. We have finer control over
command listing now and can exclude that because we can't provide a
man page for external commands anyway.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21 13:23:14 +09:00
Nguyễn Thái Ngọc Duy e11dca10cf completion: add and use --list-cmds=nohelpers
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21 13:23:14 +09:00
Nguyễn Thái Ngọc Duy 3c7777672b git: support --list-cmds=list-<category>
This allows us to select any group of commands by a category defined
in command-list.txt. This is an internal/hidden option so we don't
have to be picky about the category name or worried about exposing too
much.

This will be used later by git-completion.bash to retrieve certain
command groups.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21 13:23:14 +09:00
Nguyễn Thái Ngọc Duy 6bb2dc0b94 completion: implement and use --list-cmds=main,others
This is part of the effort to break down and provide commands by
category in machine-readable form. This could be helpful later on when
completion script switches to use --list-cmds for selecting
completable commands. It would be much easier for the user to choose
to complete _all_ commands instead of the default selection by passing
different values to --list-cmds in git-completino.bash.

While at there, replace "git help -a" in git-completion.bash with
--list-cmds since it's better suited for this task.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21 13:23:14 +09:00
Nguyễn Thái Ngọc Duy 0089521cac git.c: convert --list-* to --list-cmds=*
Even if these are hidden options, let's make them a bit more generic
since we're introducing more listing types shortly. The code is
structured to allow combining multiple listing types together because
we will soon add more types the 'builtins'.

'parseopt' remains separate because it has separate (SPC) to match
git-completion.bash needs and will not combine with others.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-21 13:23:13 +09:00
Johannes Sixt 7213c28818 git: add -P as a short option for --no-pager
It is possible to configure 'less', the pager, to use an alternate
screen to show the content, for example, by setting LESS=RS in the
environment. When it is closed in this configuration, it switches
back to the original screen, and all content is gone.

It is not uncommon to request that the output remains visible in
the terminal. For this, the option --no-pager can be used. But
it is a bit cumbersome to type, even when command completion is
available. Provide a short option, -P, to make the option more
easily accessible.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-04 14:35:38 +09:00
Junio C Hamano a8ba07c68a Merge branch 'ab/man-sec-list'
Doc update.

* ab/man-sec-list:
  git manpage: note git-security@googlegroups.com
2018-03-15 15:00:46 -07:00
Ævar Arnfjörð Bjarmason 2caa7b8d27 git manpage: note git-security@googlegroups.com
Add a mention of the security mailing list to the "Reporting Bugs"
section. There's a mention of this list at
https://git-scm.com/community but none in git.git itself.

The copy is pasted from the git-scm.com website. Let's use the same
wording in both places.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-08 11:26:19 -08:00
Jonathan Tan 8ba18e6fa4 http: support omitting data from traces
GIT_TRACE_CURL provides a way to debug what is being sent and received
over HTTP, with automatic redaction of sensitive information. But it
also logs data transmissions, which significantly increases the log file
size, sometimes unnecessarily. Add an option "GIT_TRACE_CURL_NO_DATA" to
allow the user to omit such data transmissions.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-19 13:06:57 -08:00
Jonathan Tan 83411783c3 http: support cookie redaction when tracing
When using GIT_TRACE_CURL, Git already redacts the "Authorization:" and
"Proxy-Authorization:" HTTP headers. Extend this redaction to a
user-specified list of cookies, specified through the
"GIT_REDACT_COOKIES" environment variable.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-19 13:06:50 -08:00
Junio C Hamano 8d7fefaac4 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").
2017-12-19 11:33:58 -08:00
Junio C Hamano 4c6dad0059 Merge branch 'bw/protocol-v1'
A new mechanism to upgrade the wire protocol in place is proposed
and demonstrated that it works with the older versions of Git
without harming them.

* bw/protocol-v1:
  Documentation: document Extra Parameters
  ssh: introduce a 'simple' ssh variant
  i5700: add interop test for protocol transition
  http: tell server that the client understands v1
  connect: tell server that the client understands v1
  connect: teach client to recognize v1 server response
  upload-pack, receive-pack: introduce protocol version 1
  daemon: recognize hidden request arguments
  protocol: introduce protocol extension mechanisms
  pkt-line: add packet_write function
  connect: in ref advertisement, shallows are last
2017-12-06 09:23:44 -08:00
Ann T Ropea a2cd709de3 print_sha1_ellipsis: introduce helper
Introduce a helper print_sha1_ellipsis() that pays attention to the
GIT_PRINT_SHA1_ELLIPSIS environment variable, and prepare the tests to
unconditionally set it for the test pieces that will be broken once the code
stops showing the extra dots by default.

The removal of these dots is merely a plan at this step and has not happened
yet but soon will.

Document GIT_PRINT_SHA1_ELLIPSIS.

Signed-off-by: Ann T Ropea <bedhanger@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-04 08:25:35 -08:00
Junio C Hamano c9fdbca92c Merge branch 'av/fsmonitor'
Various fixes to bp/fsmonitor topic.

* av/fsmonitor:
  fsmonitor: simplify determining the git worktree under Windows
  fsmonitor: store fsmonitor bitmap before splitting index
  fsmonitor: read from getcwd(), not the PWD environment variable
  fsmonitor: delay updating state until after split index is merged
  fsmonitor: document GIT_TRACE_FSMONITOR
  fsmonitor: don't bother pretty-printing JSON from watchman
  fsmonitor: set the PWD to the top of the working tree
2017-11-21 14:07:51 +09:00
Johannes Schindelin b2f55717c7 mingw: document the standard handle redirection
This feature has been in Git for Windows since v2.11.0(2), as an
experimental option. Now it is considered mature, and it is high time to
document it properly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-02 11:19:44 +09:00
Alex Vandiver bd76afd13d fsmonitor: document GIT_TRACE_FSMONITOR
Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-30 11:46:03 +09:00
Brandon Williams 94b8ae5aca ssh: introduce a 'simple' ssh variant
When using the 'ssh' transport, the '-o' option is used to specify an
environment variable which should be set on the remote end.  This allows
git to send additional information when contacting the server,
requesting the use of a different protocol version via the
'GIT_PROTOCOL' environment variable like so: "-o SendEnv=GIT_PROTOCOL".

Unfortunately not all ssh variants support the sending of environment
variables to the remote end.  To account for this, only use the '-o'
option for ssh variants which are OpenSSH compliant.  This is done by
checking that the basename of the ssh command is 'ssh' or the ssh
variant is overridden to be 'ssh' (via the ssh.variant config).

Other options like '-p' and '-P', which are used to specify a specific
port to use, or '-4' and '-6', which are used to indicate that IPV4 or
IPV6 addresses should be used, may also not be supported by all ssh
variants.

Currently if an ssh command's basename wasn't 'plink' or
'tortoiseplink' git assumes that the command is an OpenSSH variant.
Since user configured ssh commands may not be OpenSSH compliant, tighten
this constraint and assume a variant of 'simple' if the basename of the
command doesn't match the variants known to git.  The new ssh variant
'simple' will only have the host and command to execute ([username@]host
command) passed as parameters to the ssh command.

Update the Documentation to better reflect the command-line options sent
to ssh commands based on their variant.

Reported-by: Jeffrey Yasskin <jyasskin@google.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-17 10:51:30 +09:00
Brandon Williams 373d70efb2 protocol: introduce protocol extension mechanisms
Create protocol.{c,h} and provide functions which future servers and
clients can use to determine which protocol to use or is being used.

Also introduce the 'GIT_PROTOCOL' environment variable which will be
used to communicate a colon separated list of keys with optional values
to a server.  Unknown keys and values must be tolerated.  This mechanism
is used to communicate which version of the wire protocol a client would
like to use with a server.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-17 10:51:29 +09:00
Junio C Hamano 8f2733a04b Merge branch 'ad/doc-markup-fix'
Docfix.

* ad/doc-markup-fix:
  doc: correct command formatting
2017-10-03 15:42:50 +09:00
Adam Dinwoodie 5e633326e4 doc: correct command formatting
Leaving spaces around the `-delimeters for commands means asciidoc fails
to parse them as the start of a literal string.  Remove an extraneous
space that is causing a literal to not be formatted as such.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Acked-by: Andreas Heiduk <asheiduk@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-09-29 10:54:38 +09:00
Jeff King 27344d6a6c git: add --no-optional-locks option
Some tools like IDEs or fancy editors may periodically run
commands like "git status" in the background to keep track
of the state of the repository. Some of these commands may
refresh the index and write out the result in an
opportunistic way: if they can get the index lock, then they
update the on-disk index with any updates they find. And if
not, then their in-core refresh is lost and just has to be
recomputed by the next caller.

But taking the index lock may conflict with other operations
in the repository. Especially ones that the user is doing
themselves, which _aren't_ opportunistic. In other words,
"git status" knows how to back off when somebody else is
holding the lock, but other commands don't know that status
would be happy to drop the lock if somebody else wanted it.

There are a couple possible solutions:

  1. Have some kind of "pseudo-lock" that allows other
     commands to tell status that they want the lock.

     This is likely to be complicated and error-prone to
     implement (and maybe even impossible with just
     dotlocks to work from, as it requires some
     inter-process communication).

  2. Avoid background runs of commands like "git status"
     that want to do opportunistic updates, preferring
     instead plumbing like diff-files, etc.

     This is awkward for a couple of reasons. One is that
     "status --porcelain" reports a lot more about the
     repository state than is available from individual
     plumbing commands. And two is that we actually _do_
     want to see the refreshed index. We just don't want to
     take a lock or write out the result. Whereas commands
     like diff-files expect us to refresh the index
     separately and write it to disk so that they can depend
     on the result. But that write is exactly what we're
     trying to avoid.

  3. Ask "status" not to lock or write the index.

     This is easy to implement. The big downside is that any
     work done in refreshing the index for such a call is
     lost when the process exits. So a background process
     may end up re-hashing a changed file multiple times
     until the user runs a command that does an index
     refresh themselves.

This patch implements the option 3. The idea (and the test)
is largely stolen from a Git for Windows patch by Johannes
Schindelin, 67e5ce7f63 (status: offer *not* to lock the
index and update it, 2016-08-12). The twist here is that
instead of making this an option to "git status", it becomes
a "git" option and matching environment variable.

The reason there is two-fold:

  1. An environment variable is carried through to
     sub-processes. And whether an invocation is a
     background process or not should apply to the whole
     process tree. So you could do "git --no-optional-locks
     foo", and if "foo" is a script or alias that calls
     "status", you'll still get the effect.

  2. There may be other programs that want the same
     treatment.

     I've punted here on finding more callers to convert,
     since "status" is the obvious one to call as a repeated
     background job. But "git diff"'s opportunistic refresh
     of the index may be a good candidate.

The test is taken from 67e5ce7f63, and it's worth repeating
Johannes's explanation:

  Note that the regression test added in this commit does
  not *really* verify that no index.lock file was written;
  that test is not possible in a portable way. Instead, we
  verify that .git/index is rewritten *only* when `git
  status` is run without `--no-optional-locks`.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-09-27 16:11:01 +09:00
Junio C Hamano b438722c06 Merge branch 'ah/doc-empty-string-is-false' into maint
Doc update.

* ah/doc-empty-string-is-false:
  doc: clarify "config --bool" behaviour with empty string
2017-09-10 17:03:03 +09:00
Junio C Hamano 76be4487f0 Merge branch 'ah/doc-empty-string-is-false'
Doc update.

* ah/doc-empty-string-is-false:
  doc: clarify "config --bool" behaviour with empty string
2017-08-23 14:13:08 -07:00
Andreas Heiduk 7f0a02be2f doc: clarify "config --bool" behaviour with empty string
`git config --bool xxx.yyy` returns `true` for `[xxx]yyy` but
`false` for `[xxx]yyy=` or `[xxx]yyy=""`.  This is tested in
t1300-repo-config.sh since 09bc098c2.

Signed-off-by: Andreas Heiduk <asheiduk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-08-14 15:47:56 -07:00
Junio C Hamano 2c04f63405 Git 2.13.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-05 09:05:38 +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 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 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 034667a458 Git 2.12.2
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJY1XqcAAoJELC16IaWr+bL0/EQAMFyPd8Rzjpt+yWs/gSllSSB
 KuBKpBssfBVhqEjHz7o1y3NseOzQj6mbJR3WIrGpUOhlzDU/ARFYL//3EkHEbDzd
 Cw9BXfU5B/zfkP9zPI8ecmjmjFfRwrCGA+DOTXYAA5RZz0Done+VsZwQYsBShEd8
 7cQNFNoThic4ww3Lba+VM6rh+6D89PcG21pQQy+DgwEWWTYPQXmebIYAnCgpLGcv
 JLIPgefEBGwDlQ08rGZaiuKU3cqSSXIovNz7Oslntr6OlH3tox4lHtGVV3w/i2uY
 /488+yiKqO7MP85/0Qg8xmv1sVnGOk9UilS18OsJsHGd1uByjWq6abfbdGqEmYJR
 JhY5L3OBX8hlCsP3//JESqMWoXFZTzaCL2FQAh59FdNTk0BxvQFw3OVRz2CP6Y6y
 Ghn4ywU3HSgZDYzPjE7sHsn+xTUAm3BZcHZ0VWM0we3QRibTewVkBmAh8nukZxfb
 MutOGVRTHBoPKlQ+THz6eyBHV4N431Wko+Zq7bl4KttJk/WXl1nCzyLVi0TizsoO
 NfeI1dtrOnMiBMR+dAIWoNd9cyDMU6j1wzvnWoCZs8YUrtegB9cM6XbI+gJ5NK6v
 TVvYcqoZf4JFteYqVAXN7NtHApPcoPDOtV4vsB/qNoY2xiX7YZRGshuijlst6jOC
 WfuyDe+wnrMb4Q4LVknC
 =jgnW
 -----END PGP SIGNATURE-----

Sync with 2.12.2
2017-03-24 13:31:01 -07:00
Junio C Hamano 8f9aeb0d36 Git 2.12.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-24 12:59:15 -07:00
Junio C Hamano c0f9c70589 Git 2.12.1
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJY0DjLAAoJELC16IaWr+bLunoQANIiSAbmnTjtiv2GOvWLIeGX
 YqSr8MsgpiXyuEgvh72gn/WGJvT+NoAQckV/J5/9iKOFce1KEhbjXdkcZMmUs/Ep
 6mFO7YObMZ/mrIkyXdboCr8fzhaRXDFmR99UvJnshljAQjQT3YNQjcSHwm+QrpF5
 jD0IaZqZcTkbRqJDWeM3TDhn1wdpvsFCTRXYivUOSHacLmf0vdsBk5auG7Qe9WOX
 sJdm4BtvklG/uiCdLar1Izpueo56iUxas3WKh6BFgvJQ9S0678lfYaQEQhul4brF
 M84GIIKqTg4Wmx/nFfcgLCT4t14XwmbR5kM5fTXvxRhzf+Cwc5JmUKqiZZRJmV8L
 SxkoFPypASpcD4915YsGTUs/tzTAvTmaLPkGbQrgZHuLXAfq5toKqJOjDx7MHnrl
 K9hxyDX0vbH9tpzuTcEkncgn8Hy1PaBN4+425s1ozIEsXhMK4uQgfHsi4TH10dvK
 zp463Ux1NSAsYCko+hkvkd3jG0zbRCY0akpLuXhVlqmYzMnGgY3nwfDPGTmroRBH
 0NK6wmnB+z+8RvQzaBLzfVN2SeZs0Ay2igjcWCk5lEbPEZtbOMYRLYVw0cz9os0y
 9Br8UBSQLBd3AyagVZE4NZpt5TKYP9EQ25cwOuXaiHK52NaY6inH9bA/vvPqT5fc
 YfeTRoCCnn/rkHz6cnF0
 =jkWN
 -----END PGP SIGNATURE-----

Sync with 2.12.1
2017-03-20 13:56:13 -07:00
Junio C Hamano 1f6b1afea0 Git 2.12.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-20 13:17:08 -07:00