In the implementation of GIT_PS1_SHOWDIRTYSTATE in 738a94a (bash:
offer to show (un)staged changes, 2009-02-03), I cut&pasted the
git-diff invocations from dirty-worktree checks elsewhere, carrying
along the --ignore-submodules option.
As pointed out by Kevin Ballard, this doesn't really make sense: to
the _user_, a changed submodule counts towards uncommitted changes.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Improve the readability of the bash prompt by adding a space between
the branch name and the status flags (dirty, stash, untracked).
While we are cleaning up this section of code, the two cases for
formatting the prompt are identical except for the format string,
so make them the same.
Suggested-by: Roman Fietze <roman.fietze@telemotive.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Support the new options --all, --prune, and --dry-run for
'git fetch'.
As the --multiple option was primarily introduced to enable
'git remote update' to be re-implemented in terms of 'git fetch'
(16679e37) and is not likely to be used much from the command
line, it does not seems worthwhile to complicate the code
(to support completion of multiple remotes) to handle it.
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
I just wanted to add the recently learnt '--reset-author' option, but
then noticed that there are many more options missing. This patch
adds support for all of 'git commit's options, except '--allow-empty',
because it is primarily there for foreign scm interfaces.
Furthermore, this patch also adds support for completing the arguments
of those options that take a non-filename argument: valid modes are
offered for '--cleanup' and '--untracked-files', while refs for
'--reuse-message' and '--reedit-message', because these two take a
commit as argument.
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>
Since git is not used in each and every interactive xterm, it
seems best to load completion support with cold caches and then
load each needed thing lazily. This has most of the speed
advantage of pre-generating everything at build time, without the
complication of figuring out at build time what commands will be
available at run time.
On this slow laptop, this decreases the time to load
git-completion.bash from about 500 ms to about 175 ms.
Suggested-by: Kirill Smelkov <kirr@mns.spb.ru>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Cc: Stephen Boyd <bebarino@gmail.com>
Cc: SZEDER Gábor <szeder@ira.uka.de>
Cc: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Add p4merge to the set of built-in diff/merge tools, and update
bash completion and documentation.
Signed-off-by: Scott Chacon <schacon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
So complete refs, files after the double-dash and some diff options that
make sense for difftool.
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Complete all long options for 'git rebase' except --no-verify
(probably used very seldom) and the long options corresponding
to -v, -q, and -f.
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Before the --, always attempt ref completion. This helps with
entering the <treeish> arguments to git-grep. As a bonus, you can
work around git-grep's current lack of --all by hitting M-*, ugly as
the resulting command line may be.
Strictly speaking, completing the regular expression argument (or
option argument) makes no sense. However, we cannot prevent _all_
completion (it will fall back to filenames), so we dispense with any
additional complication to detect whether the user still has to enter
a regular expression.
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>
Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Aliases with newlines have been a problem since commit 56fc25f (Bash
completion support for remotes in .git/config., 2006-11-05). The chance
of the problem occurring has been slim at best, until commit 518ef8f
(completion: Replace config --list with --get-regexp, 2009-09-11)
removed the case statement introduced by commit 56fc25f. Before removing
the case statement, most aliases with newlines would work unless they
were specially crafted as follows
[alias]
foo = "log -1 --pretty='format:%s\nalias.error=broken'"
After removing the case statement, a more benign alias like
[alias]
whowhat = "log -1 --pretty='format:%an <%ae>\n%s'"
wont-complete = ...
would cause the completion to break badly.
For now, revert the removal of the case statement until someone comes up
with a better way to get keys from git-config.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
After commit 511a3fc (wrap git's main usage string., 2009-09-12), the
bash completion for git commands includes COMMAND and [ARGS] when it
shouldn't. Fix this by grepping more strictly for a line with git
commands. It's doubtful whether git will ever have commands starting
with anything besides numbers and letters so this should be fine. At
least by being stricter we'll know when we break the completion earlier.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git am learned --scissors, git commit learned --dry-run and git log
learned --decorate=long|short recently.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This update adds 'git stash (apply|pop) --quiet' and all options known
to 'git stash save', and handles the DWIMery from 3c2eb80f (stash:
simplify defaulting to "save" and reject unknown options, 2009-08-18).
Care is taken to avoid offering subcommands in the DWIM case.
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>
__git_find_subcommand() was originally meant to check whether
subcommands are already present on the command line. But the code is
general enough to be used for checking the presence of command line
options as well, and the next commit will use it for that purpose, so
let's give it a more general name.
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>
James Bardin noted that the completion spewed warnings when no git config
file is present. This is likely a bug to be fixed in git config, but it's
also good to simplify the completion code by using the --get-regexp option
as Jeff King pointed out.
Signed-off-by: Todd Zullinger <tmz@pobox.com>
Trivially-acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This configuration option allows systematically rewriting fetch-only URLs
to push-capable URLs when used with push. For instance:
[url "ssh://example.org/"]
pushInsteadOf = "git://example.org/"
This will allow clones of "git://example.org/path/to/repo" to subsequently
push to "ssh://example.org/path/to/repo", without manually configuring
pushurl for that remote.
Includes documentation for the new option, bash completion updates, and
test cases (both that pushInsteadOf applies to push, that it does not
apply to fetch, and that it is ignored when pushURL is already defined).
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Introduce --ignore-whitespace option and corresponding config bool to
ignore whitespace differences while applying patches, akin to the
'patch' program.
'git am', 'git rebase' and the bash git completion are made aware of
this option.
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Added the envvar GIT_PS1_SHOWUNTRACKEDFILES to 'git-completion.bash'.
When set to a nonempty value, then the char '%' will be shown next
to the branch name in the bash prompt.
Signed-off-by: Daniel Trstenjak <daniel.trstenjak@science-computing.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
It is useful to grep directories non-recursively, e.g. when one wants to
look for all files in the toplevel directory, but not in any subdirectory,
or in Documentation/, but not in Documentation/technical/.
This patch adds support for --max-depth <depth> option to git-grep. If it is
given, git-grep descends at most <depth> levels of directories below paths
specified on the command line.
Note that if path specified on command line contains wildcards, this option
makes no sense, e.g.
$ git grep -l --max-depth 0 GNU -- 'contrib/*'
(note the quotes) will search all files in contrib/, even in
subdirectories, because '*' matches all files.
Documentation updates, bash-completion and simple test cases are also
provided.
Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
... so it's available for git log, shortlog and gitk.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commit 0065236 (bash completion: complete variable names for "git
config" with options 2009-05-08) implemented its config variable search
wrong. When a config contains a value with a space and a period (.) in
it, completion erroneously thinks that line in the configuration is
multiple config variables.
For example
$ cat .git/config
format.cc = Junio C Hamano <gitster@pobox.com>
$ git config --unset <TAB>
format.cc
<gitster@pobox.com>
Instead of using a for loop splitting across spaces, pipe each line to a
while read loop and beef up the case statement to match only
'config.variable=value'.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Update to include branch.*.rebase, remote.*.pushurl, and
add.ignore-errors
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
For another patch series I'm working on I needed some tests
for the cc-cmd feature of git-send-email.
This patch adds 3 tests for the feature and for the possibility
to specify --suppress-cc multiple times, and fixes two bugs.
The first bug is that the --suppress-cc option for `cccmd' was
misspelled as `ccmd' in the code. The second bug, which is
actually found only with my other series, is that the argument
to the cccmd is never quoted, so the cccmd would fail with
patch file names containing a space.
A third bug I fix (in the docs) is that the bodycc argument was
actually spelled ccbody in the documentation and bash completion.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Cc: Markus Heidelberg <markus.heidelberg@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Add a '$' in the __git_ps1 output to show stashed changes are present,
when GIT_PS1_SHOWSTASHSTATE is set to a nonempty value.
The code for checking if the stash has entries is taken from
'git-stash.sh'.
Signed-off-by: Daniel Trstenjak <daniel.trstenjak@online.de>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
The recent commits 8763dbb1 (completion: fix PS1 display during a
merge on detached HEAD, 2009-05-16), ff790b6a (completion: simplify
"current branch" in __git_ps1(), 2009-05-10), and d7107ca6
(completion: fix PS1 display during an AM on detached HEAD,
2009-05-26) ensure that the branch name in __git_ps1() is always set
to something sensible. Therefore, the condition for checking the
non-empty branch name is always fulfilled, and can be removed.
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>
This is a companion patch to previous 8763dbb (completion: fix PS1 display
during a merge on detached HEAD, 2009-05-16). While rebasing or running am
on a detached HEAD, the code failed to set $b (branch description) that
enables the whole status display business.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Araxis merge is now a built-in diff/merge tool.
This adds araxis to git-completion and updates
the documentation to mention araxis.
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
grep: fix word-regexp colouring
completion: use git rev-parse to detect bare repos
Cope better with a _lot_ of packs
for-each-ref: fix segfault in copy_email
Its check is more robust than a config check for core.bare
Trivially-Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mh/show-branch-color:
bash completion: show-branch color support
show-branch: color the commit status signs
Conflicts:
contrib/completion/git-completion.bash
* maint:
completion: add missing options to show-branch and show
dir.c: clean up handling of 'path' parameter in read_directory_recursive()
Fix type-punning issues
Add --oneline and --abbrev-commit to show and --sparse to show-branch.
Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
* maint:
test: checkout shouldn't say that HEAD has moved if it didn't
completion: enhance "current branch" display
completion: simplify "current branch" in __git_ps1()
completion: fix PS1 display during a merge on detached HEAD
builtin-checkout: Don't tell user that HEAD has moved before it has
pre-commit.sample: don't print incidental SHA1
tests: Add tests for missing format-patch long options
api-parse-options.txt: use 'func' instead of 'funct'
Turn on USE_ST_TIMESPEC for OpenBSD
ls-tree manpage: output of ls-tree is compatible with update-index
ls-tree manpage: use "unless" instead of "when ... is not"
Introduce GIT_PS1_DESCRIBE option you can set to "contains", "branch", or
"describe" to tweak the way how a detached HEAD is described.
The default behaviour is to describe only exact match with some tag
(otherwise use the first 7 hexdigits) as before.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
As I very often work on a detached HEAD, I found it pretty confusing
when __git_ps1() said 'some-name'. Did I create a branch with that name
by mistake, or do I happen to be on a commit with that exact tag?
This patch fixes the issue by enclosing non branch names in a pair of
parentheses when used to substitute %s token in __git_ps1() argument.
It also fixes a small bug where the branch part is left empty when
.git/HEAD is unreadable for whatever reason. The output now says
"(unknown)".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
If your merge stops in a conflict while on a detached HEAD, recent
completion code fails to show anything. This was because various cases
added to support the operation-in-progress markers (e.g. REBASE, MERGING)
forgot that they need to set the variable "b" to something for the result
they computed to be displayed at all.
Probably not many people make trial merges on a detached HEAD (which is
tremendously useful feature of git, by the way), and that may be why this
was not noticed for a long time.
Acked-By: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>