Commit graph

149 commits

Author SHA1 Message Date
SZEDER Gábor c07838371b bash: offer refs instead of filenames for 'git revert'
The completion script for 'git revert' currently offers options and
filenames.  However, 'git revert' doesn't take any filenames from the
command line, but a single commit.  Therefore, it's more sane to offer
refs instead.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-27 18:35:07 -08:00
SZEDER Gábor 8d8163f377 bash: remove dashed command leftovers
Commit 5a625b07 (bash: remove fetch, push, pull dashed form leftovers,
2008-10-03) did that already, but there were still some git-cmd left
here and there.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-11-27 18:29:53 -08:00
Markus Heidelberg 41d8cf7d7f bash completion: add doubledash to "git show"
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-10-31 00:46:27 -07:00
SZEDER Gábor 5a625b07bb bash: remove fetch, push, pull dashed form leftovers
We don't provide complation for git-commands in dashed form anymore,
so there is no need to keep those cases.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Tested-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-10-05 23:48:43 -07:00
Eric Raible aa5735bed4 completion: git commit should list --interactive
Signed-off-by: Eric Raible <raible@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-19 19:47:36 -07:00
Petr Baudis ff2549dc9a bash completion: Hide more plumbing commands
git <tab><tab> still shows way too many commands, some of them
are clearly plumbing. This patch hides the plumbing commands
liberally (that is, in special cases, users still might want to
call one of the hidden commands, a *normal* workflow should never
involve these, though - and if it does, we have a UI problem anyway).

Signed-off-by: Petr Baudis <pasky@suse.cz>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-03 20:41:47 -07:00
Eric Raible f135aacb5a Completion: add missing '=' for 'diff --diff-filter'
Signed-off-by: Eric Raible <raible@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-22 16:15:21 -07:00
Junio C Hamano 25b3d4d6f3 completion: find out supported merge strategies correctly
"git-merge" is a binary executable these days, and looking for assignment
to $all_strategies variable with grep/sed does not work well.

When asked for an unknown strategy, pre-1.6.0 and post-1.6.0 "git merge"
commands respectively say:

    $ $HOME/git-snap-v1.5.6.5/bin/git merge -s help
    available strategies are: recur recursive octopus resolve stupid ours subtree
    $ $HOME/git-snap-v1.6.0/bin/git merge -s help
    Could not find merge strategy 'help'.
    Available strategies are: recursive octopus resolve ours subtree.

both on their standard error stream.  We can use this to learn what
strategies are supported.

The sed script is written in such a way that it catches both old and new
message styles ("Available" vs "available", and the full stop at the end).
It also allows future versions of "git merge" to line-wrap the list of
strategies, and add extra comments, like this:

    $ $HOME/git-snap-v1.6.1/bin/git merge -s help
    Could not find merge strategy 'help'.
    Available strategies are: blame recursive octopus resolve ours
    subtree.
    Also you have custom strategies: theirs

    Make sure you spell strategy names correctly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 15:48:52 -07:00
Marcus Griep 2946cccfdf bash-completion: Add non-command git help files to bash-completion
Git allows access to the gitattributes man page via `git help attributes`,
but this is not discoverable via the bash-completion mechanism.  This
patch adds all current non-command man pages to the completion candidate
list.

Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 02:32:01 -07:00
Lee Marlow 5a13c8f6f7 bash completion: Add '--merge' long option for 'git log'
Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 17:49:12 -07:00
Lee Marlow b4c72162f6 bash completion: Add completion for 'git mergetool'
The --tool= long option to "git mergetool" can be completed with:

	kdiff3 tkdiff meld xxdiff emerge
	vimdiff gvimdiff ecmerge opendiff

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 17:49:12 -07:00
Eric Raible 7950659dc9 bash completion: 'git apply' should use 'fix' not 'strip'
Bring completion up to date with the man page.

Signed-off-by: Eric Raible <raible@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 17:49:12 -07:00
SZEDER Gábor 5a7ebd4faa bash: remove redundant check for 'git stash apply' options
It will never trigger anyway because of the first check, and even if it
would, it would not offer the command line option.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-08 16:10:39 -07:00
Lee Marlow 1127c51cfe bash completion: Add completion for 'git mv'
Add completions for all long options specified in the docs
    --dry-run

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-05 21:21:20 -07:00
Lee Marlow b1bc1494ed bash completion: Add completion for 'git ls-files'
Add completions for all long options specified in the docs
    --cached --deleted --modified --others --ignored
    --stage --directory --no-empty-directory --unmerged
    --killed --exclude= --exclude-from=
    --exclude-per-directory= --exclude-standard
    --error-unmatch --with-tree= --full-name
    --abbrev --ignored --exclude-per-directory

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-05 21:21:19 -07:00
Lee Marlow b3191ce2d5 bash completion: Add completion for 'git archive'
Add completions for all long options specified in the docs
    --format= --list --verbose
    --prefix= --remote= --exec=

The --format= long option can be completed with available formats
and the --remote= can be completed with defined remote repositories.

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-05 21:21:19 -07:00
Lee Marlow 95d43780cf bash completion: More completions for 'git stash'
Add branch subcommand to completions and USAGE for git-stash.sh.
Complete stash names for show, apply, drop, pop, and branch.
Add "--index" long option for apply.

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-05 21:21:19 -07:00
Lee Marlow a6c2be244f bash completion: Add completion for 'git revert'
Add completions for all long options specified in the docs
    --edit --mainline --no-edit --no-commit --signoff

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-05 21:21:19 -07:00
Lee Marlow 5dad868b26 bash completion: Add completion for 'git init'
Add completions for all long options specified in the docs
    --quiet --bare --template= --shared
    --shared={false|true|umask|group|all|world|everybody}

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-05 21:21:19 -07:00
Lee Marlow 4181c7e8a7 bash completion: Add completion for 'git clean'
Add completions for all long options specified in the docs
    --dry-run --quiet

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-05 21:21:19 -07:00
Lee Marlow 3eb1101207 bash completion: Add completion for 'git clone'
Add completions for all long options specified in the docs
    --local --no-hardlinks --shared --reference
    --quiet --no-checkout --bare --mirror --origin
    --upload-pack --template= --depth

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-05 21:21:19 -07:00
Lee Marlow c72e0db1ff bash completion: Add completion for 'git grep'
Add completions for all long options specified in the docs

    --cached
    --text --ignore-case --word-regexp --invert-match
    --full-name
    --extended-regexp --basic-regexp --fixed-strings
    --files-with-matches --name-only
    --files-without-match
    --count
    --and --or --not --all-match

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-04 21:48:51 -07:00
Lee Marlow e49b99a6f5 bash completion: Add more long options for 'git log'
Options added: --parents --children --full-history

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-02 15:22:10 -07:00
Lee Marlow 7339479c2b bash completion: remove unused function _git_diff_tree
completion for git diff-tree was removed in 5cfb4fe

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-02 15:22:10 -07:00
Lee Marlow 1eb7e2f834 bash completion: Add completion for 'git help'
Rename cached __git_commandlist to __git_porcelain_commandlist and
add __git_all_commandlist that only filters out *--* helpers.

Completions for 'git help' will use the __git_all_commandlist, while
the __git_porcelain_commandlist is used for git command completion.

Users who actually read man pages may want to see help for plumbing
commands.

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-27 14:14:01 -07:00
Thomas Rast cbb504c974 bash completion: Add long options for 'git describe'
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-27 14:14:00 -07:00
SZEDER Gábor c84bb14ce5 bash: offer only paths after '--' for 'git checkout'
Commit d773c631 (bash: offer only paths after '--', 2008-07-08) did the
same for several other git commands, but 'git checkout' went unnoticed.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-24 23:29:50 -07:00
Thomas Rast 2ca880fe54 git-completion.bash: provide completion for 'show-branch'
It previously used the same as 'log', but the options are quite
different and the arguments must be single refs (or globs).

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 17:06:36 -07:00
Lee Marlow 08c701d476 bash completion: Add long options for 'git rm'
Options added: --cached --dry-run --ignore-unmatch --quiet

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 17:06:30 -07:00
Stephan Beyer a31c00b00e am --abort: Add to bash-completion and mention in git-rerere documentation
The git-rerere documentation talks about commands that invoke
"git rerere clear" automatically. git am --abort is added and
a typo is fixed additionally.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:57:09 -07:00
Johannes Schindelin 51ef1daa4a Rename .git/rebase to .git/rebase-apply
With git-am, it sounds awkward to have the patches in ".git/rebase/",
but for technical reasons, we have to keep the same directory name
for git-am and git-rebase. ".git/rebase-apply" seems to be a good
compromise.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 18:51:47 -07:00
Johannes Schindelin 28ed6e7b32 Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"
Since the files generated and used during a rebase are never to be
tracked, they should live in $GIT_DIR.  While at it, avoid the rather
meaningless term "dotest" to "rebase", and unhide ".dotest-merge".

This was wished for on the mailing list, but so far unimplemented.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15 18:49:28 -07:00
Shawn O. Pearce 055767194c bash completion: Remove dashed command completion support
Since only 'git' and 'gitk' are in the user's $PATH now we do not
expect users to need completion support for git-fetch, and expect
they will instead rely upon the completion support for 'git fetch'.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:37:42 -07:00
Junio C Hamano 3df6499c22 Merge branch 'sp/maint-bash-completion-optim'
* sp/maint-bash-completion-optim:
  bash completion: Resolve git show ref:path<tab> losing ref: portion
  bash completion: Append space after file names have been completed
2008-07-14 23:36:08 -07:00
Teemu Likonen 25a1f374f0 bash: Add long option completion for 'git send-email'
Add the following long options to be completed with 'git send-email':

    --bcc --cc --cc-cmd --chain-reply-to --compose --dry-run
    --envelope-sender --from --identity --in-reply-to
    --no-chain-reply-to --no-signed-off-by-cc --no-suppress-from
    --no-thread --quiet --signed-off-by-cc --smtp-pass --smtp-server
    --smtp-server-port --smtp-ssl --smtp-user --subject --suppress-cc
    --suppress-from --thread --to

Short ones like --to and --cc are not usable for actual completion
because of the shortness itself and because there are longer ones which
start with same letters (--thread, --compose). It's still useful to have
these shorter options _listed_ when user presses TAB key after typing
two dashes. It gives user an idea what options are available (and --to
and --cc are probably the most commonly used).

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:35:32 -07:00
Shawn O. Pearce db8a9ff038 bash completion: Resolve git show ref:path<tab> losing ref: portion
Linus reported that the bash completion for git show often dropped
the ref portion of the argument (stuff before the :) when trying
to complete a file name of a file in another branch or tag.

Björn Steinbrink tracked it down to the gvfs completion script
which comes standard on many Fedora Core based systems.  That is
removing : from COMP_WORDBREAKS, making readline treat the entire
argument (including the ref) as the name that must be completed.
When the git completion routines supplied a completion of just the
filename, readline replaced everything.

Since Git users often need to use "ref:path" or "ref:ref" sort of
arguments, and expect completion support on both sides of the :
we really want the : in COMP_WORDBREAKS to provide a good user
experience.  This is also the default that ships with bash as it
can be useful in other contexts, such as rcp/scp.

We now try to add : back to COMP_WORDBREAKS if it has been removed
by a script that loaded before us.  However if this doesn't work
(as the : is stripped after we load) we fallback in the completion
routines to include "ref:" as part of the prefix for completions,
allowing readine to fully insert the argument the user wanted.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-14 23:35:18 -07:00
Shawn O. Pearce 778306e405 bash completion: Append space after file names have been completed
When completing `git show origin/maint:Makef<tab>` we should add a
space after the filename has been completed, so that the user can
immediately begin the next argument.

I also added a special case for the symlink variant so we treat it
just like a normal blob, as there are no items below it in the Git
tree structure.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 17:27:50 -07:00
Junio C Hamano 10ce0209b6 Merge branch 'sp/maint-bash-completion-optim'
* sp/maint-bash-completion-optim:
  bash completion: Don't offer "a.." as a completion for "a."
  bash completion: Improve responsiveness of git-log completion
2008-07-13 16:41:02 -07:00
Shawn O. Pearce 6c36c9e4ea bash completion: Don't offer "a.." as a completion for "a."
If the user is trying to complete "v1.5.3.<tab>" to see all of
the available maintenance releases for 1.5.3 we should not give
them an extra dot as the completion.  Instead if the user wants
a ".." or a "..." operator they should key the two dots out on
their own.  Its the same number of keystrokes either way.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 16:40:23 -07:00
Junio C Hamano 15fc1c02fc Merge branch 'sg/stash-k-i'
* sg/stash-k-i:
  Documentation: tweak use case in "git stash save --keep-index"
  stash: introduce 'stash save --keep-index' option
2008-07-13 15:15:27 -07:00
Shawn O. Pearce ab02dfe533 bash completion: Improve responsiveness of git-log completion
Junio noticed the bash completion has been taking a long time lately.
Petr Baudis tracked it down to 72e5e989b ("bash: Add space after
unique command name is completed.").  Tracing the code showed
we spent significant time inside of this loop within __gitcomp,
due to the string copying overhead.

  [28.146109654] _git common over
  [28.164791148] gitrefs in
  [28.280302268] gitrefs dir out
  [28.300939737] gitcomp in
  [28.308378112] gitcomp pre-case
* [28.313407453] gitcomp iter in
* [28.701270296] gitcomp iter out
  [28.713370786] out normal

Since __git_refs avoids this string copying by forking and using
echo we use the same trick here when we need to finish generating
the names for the caller.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 11:36:04 -07:00
Junio C Hamano bb293b831b Merge branch 'maint'
* maint:
  Start preparing release notes for 1.5.6.3
  git-submodule - Fix bugs in adding an existing repo as a module
  bash: offer only paths after '--'
  Remove unnecessary pack-*.keep file after successful git-clone
  make deleting a missing ref more quiet
2008-07-09 00:19:50 -07:00
Eric Raible 50e6102504 completion: add branch options --contains --merged --no-merged
Signed-off-by: Eric Raible <raible@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08 16:51:33 -07:00
SZEDER Gábor d773c6314d bash: offer only paths after '--'
Many git commands use '--' to separate subcommands, options, and refs
from paths.  However, the programmable completion for several of these
commands does not respect the '--', and offer subcommands, options, or
refs after a '--', although only paths are permitted.  e.g. 'git bisect
-- <TAB>' offers subcommands, 'git log -- --<TAB>' offers options and
'git log -- git<TAB>' offers all gitgui tags.

The completion for the following commands share this wrong behaviour:
  am add bisect commit diff log reset shortlog submodule gitk.

To avoid this, we check the presence of a '--' on the command line first
and let the shell do filename completion, if one is found.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-08 16:35:05 -07:00
Dmitry Potapov bf11d4613c completion.bash: add 'skip' and 'run' to git-bisect
Signed-off-by: Dmitry Potapov <dpotapov@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-07 01:06:22 -07:00
SZEDER Gábor 7bedebcaad stash: introduce 'stash save --keep-index' option
'git stash save' saves local modifications to a new stash, and runs 'git
reset --hard' to revert them to a clean index and work tree.  When the
'--keep-index' option is specified, after that 'git reset --hard' the
previous contents of the index is restored and the work tree is updated
to match the index.  This option is useful if the user wants to commit
only parts of his local modifications, but wants to test those parts
before committing.

Also add support for the completion of the new option, and add an
example use case to the documentation.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-05 11:22:13 -07:00
Olivier Marin 8813df9066 Documentation: remove {show,whatchanged}.difftree config options
This removes, from the documentation and the bash completion script, the
two config options that were introduced by the git-whatchanged.sh script
and lost in the C rewrite. Today, we can use aliases as an alternative.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-28 20:55:26 -07:00
Teemu Likonen 66aafad5e4 bash: Add more option completions for 'git log'
Options added: --walk-reflogs --stat --numstat --shortstat
--decorate --diff-filter= --color-words

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-20 10:32:47 -07:00
Dan McGee 20827d99c5 completion: add --graph to log command completion
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-19 16:02:31 -07:00
SZEDER Gábor 1d284cbae3 completion: add more 'git add' options
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-14 12:47:44 -07:00