Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
dac07b26
Commit
dac07b26
authored
Jun 05, 2015
by
Robby Russell
Browse files
Merge pull request #2736 from felipec/fc/gitfast
gitfast: update to upstream v1.9.2
parents
35c7b7bb
5918d910
Changes
3
Show whitespace changes
Inline
Side-by-side
plugins/gitfast/_git
View file @
dac07b26
...
@@ -30,10 +30,10 @@ if [ -z "$script" ]; then
...
@@ -30,10 +30,10 @@ if [ -z "$script" ]; then
local -a locations
local -a locations
local e
local e
locations=(
locations=(
$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
'/etc/bash_completion.d/git' # fedora, old debian
'/etc/bash_completion.d/git' # fedora, old debian
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
'/usr/share/bash-completion/completions/git' # arch, ubuntu, new debian
'/usr/share/bash-completion/git' # gentoo
'/usr/share/bash-completion/git' # gentoo
$(dirname ${funcsourcetrace[1]%:*})/git-completion.bash
)
)
for e in $locations; do
for e in $locations; do
test -f $e && script="$e" && break
test -f $e && script="$e" && break
...
@@ -76,6 +76,14 @@ __gitcomp_nl ()
...
@@ -76,6 +76,14 @@ __gitcomp_nl ()
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
}
}
__gitcomp_nl_append ()
{
emulate -L zsh
local IFS=$'\n'
compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
}
__gitcomp_file ()
__gitcomp_file ()
{
{
emulate -L zsh
emulate -L zsh
...
...
plugins/gitfast/git-completion.bash
View file @
dac07b26
#!bash
#
# bash/zsh completion support for core Git.
# bash/zsh completion support for core Git.
#
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
...
@@ -180,9 +178,9 @@ _get_comp_words_by_ref ()
...
@@ -180,9 +178,9 @@ _get_comp_words_by_ref ()
}
}
fi
fi
__gitcompa
d
d
()
__gitcompa
ppen
d
()
{
{
local
i
=
0
local
i
=
${#
COMPREPLY
[@]
}
for
x
in
$1
;
do
for
x
in
$1
;
do
if
[[
"
$x
"
==
"
$3
"
*
]]
;
then
if
[[
"
$x
"
==
"
$3
"
*
]]
;
then
COMPREPLY[i++]
=
"
$2$x$4
"
COMPREPLY[i++]
=
"
$2$x$4
"
...
@@ -190,6 +188,12 @@ __gitcompadd ()
...
@@ -190,6 +188,12 @@ __gitcompadd ()
done
done
}
}
__gitcompadd
()
{
COMPREPLY
=()
__gitcompappend
"
$@
"
}
# Generates completion reply, appending a space to possible completion words,
# Generates completion reply, appending a space to possible completion words,
# if necessary.
# if necessary.
# It accepts 1 to 4 arguments:
# It accepts 1 to 4 arguments:
...
@@ -220,6 +224,14 @@ __gitcomp ()
...
@@ -220,6 +224,14 @@ __gitcomp ()
esac
esac
}
}
# Variation of __gitcomp_nl () that appends to the existing list of
# completion candidates, COMPREPLY.
__gitcomp_nl_append
()
{
local
IFS
=
$'
\n
'
__gitcompappend
"
$1
"
"
${
2
-
}
"
"
${
3
-
$cur
}
"
"
${
4
-
}
"
}
# Generates completion reply from newline-separated possible completion words
# Generates completion reply from newline-separated possible completion words
# by appending a space to all of them.
# by appending a space to all of them.
# It accepts 1 to 4 arguments:
# It accepts 1 to 4 arguments:
...
@@ -231,8 +243,8 @@ __gitcomp ()
...
@@ -231,8 +243,8 @@ __gitcomp ()
# appended.
# appended.
__gitcomp_nl
()
__gitcomp_nl
()
{
{
local
IFS
=
$'
\n
'
COMPREPLY
=()
__gitcomp
add
"
$1
"
"
${
2
-
}
"
"
${
3
-
$cur
}
"
"
${
4
-
}
"
__gitcomp
_nl_append
"
$@
"
}
}
# Generates completion reply with compgen from newline-separated possible
# Generates completion reply with compgen from newline-separated possible
...
@@ -673,7 +685,6 @@ __git_list_porcelain_commands ()
...
@@ -673,7 +685,6 @@ __git_list_porcelain_commands ()
index-pack
)
: plumbing
;;
index-pack
)
: plumbing
;;
init-db
)
: deprecated
;;
init-db
)
: deprecated
;;
local-fetch
)
: plumbing
;;
local-fetch
)
: plumbing
;;
lost-found
)
: infrequent
;;
ls-files
)
: plumbing
;;
ls-files
)
: plumbing
;;
ls-remote
)
: plumbing
;;
ls-remote
)
: plumbing
;;
ls-tree
)
: plumbing
;;
ls-tree
)
: plumbing
;;
...
@@ -687,14 +698,12 @@ __git_list_porcelain_commands ()
...
@@ -687,14 +698,12 @@ __git_list_porcelain_commands ()
pack-refs
)
: plumbing
;;
pack-refs
)
: plumbing
;;
parse-remote
)
: plumbing
;;
parse-remote
)
: plumbing
;;
patch-id
)
: plumbing
;;
patch-id
)
: plumbing
;;
peek-remote
)
: plumbing
;;
prune
)
: plumbing
;;
prune
)
: plumbing
;;
prune-packed
)
: plumbing
;;
prune-packed
)
: plumbing
;;
quiltimport
)
: import
;;
quiltimport
)
: import
;;
read-tree
)
: plumbing
;;
read-tree
)
: plumbing
;;
receive-pack
)
: plumbing
;;
receive-pack
)
: plumbing
;;
remote-
*
)
: transport
;;
remote-
*
)
: transport
;;
repo-config
)
: deprecated
;;
rerere
)
: plumbing
;;
rerere
)
: plumbing
;;
rev-list
)
: plumbing
;;
rev-list
)
: plumbing
;;
rev-parse
)
: plumbing
;;
rev-parse
)
: plumbing
;;
...
@@ -707,7 +716,6 @@ __git_list_porcelain_commands ()
...
@@ -707,7 +716,6 @@ __git_list_porcelain_commands ()
ssh-
*
)
: transport
;;
ssh-
*
)
: transport
;;
stripspace
)
: plumbing
;;
stripspace
)
: plumbing
;;
symbolic-ref
)
: plumbing
;;
symbolic-ref
)
: plumbing
;;
tar-tree
)
: deprecated
;;
unpack-file
)
: plumbing
;;
unpack-file
)
: plumbing
;;
unpack-objects
)
: plumbing
;;
unpack-objects
)
: plumbing
;;
update-index
)
: plumbing
;;
update-index
)
: plumbing
;;
...
@@ -901,7 +909,7 @@ _git_add ()
...
@@ -901,7 +909,7 @@ _git_add ()
esac
esac
# XXX should we check for --update and --all options ?
# XXX should we check for --update and --all options ?
__git_complete_index_file
"--others --modified"
__git_complete_index_file
"--others --modified
--directory --no-empty-directory
"
}
}
_git_archive
()
_git_archive
()
...
@@ -1063,7 +1071,7 @@ _git_clean ()
...
@@ -1063,7 +1071,7 @@ _git_clean ()
esac
esac
# XXX should we check for -x option ?
# XXX should we check for -x option ?
__git_complete_index_file
"--others"
__git_complete_index_file
"--others
--directory
"
}
}
_git_clone
()
_git_clone
()
...
@@ -1188,7 +1196,7 @@ _git_diff ()
...
@@ -1188,7 +1196,7 @@ _git_diff ()
__git_complete_revlist_file
__git_complete_revlist_file
}
}
__git_mergetools_common
=
"diffuse ecmerge emerge kdiff3 meld opendiff
__git_mergetools_common
=
"diffuse
diffmerge
ecmerge emerge kdiff3 meld opendiff
tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare
tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3 codecompare
"
"
...
@@ -1491,6 +1499,12 @@ _git_mergetool ()
...
@@ -1491,6 +1499,12 @@ _git_mergetool ()
_git_merge_base
()
_git_merge_base
()
{
{
case
"
$cur
"
in
--
*
)
__gitcomp
"--octopus --independent --is-ancestor --fork-point"
return
;;
esac
__gitcomp_nl
"
$(
__git_refs
)
"
__gitcomp_nl
"
$(
__git_refs
)
"
}
}
...
@@ -1623,7 +1637,7 @@ _git_rebase ()
...
@@ -1623,7 +1637,7 @@ _git_rebase ()
--preserve-merges --stat --no-stat
--preserve-merges --stat --no-stat
--committer-date-is-author-date --ignore-date
--committer-date-is-author-date --ignore-date
--ignore-whitespace --whitespace=
--ignore-whitespace --whitespace=
--autosquash
--autosquash
--fork-point --no-fork-point
"
"
return
return
...
@@ -1833,6 +1847,7 @@ _git_config ()
...
@@ -1833,6 +1847,7 @@ _git_config ()
branch.
*
)
branch.
*
)
local
pfx
=
"
${
cur
%.*
}
."
cur_
=
"
${
cur
#*.
}
"
local
pfx
=
"
${
cur
%.*
}
."
cur_
=
"
${
cur
#*.
}
"
__gitcomp_nl
"
$(
__git_heads
)
"
"
$pfx
"
"
$cur_
"
"."
__gitcomp_nl
"
$(
__git_heads
)
"
"
$pfx
"
"
$cur_
"
"."
__gitcomp_nl_append
$'autosetupmerge
\n
autosetuprebase
\n
'
"
$pfx
"
"
$cur_
"
return
return
;;
;;
guitool.
*
.
*
)
guitool.
*
.
*
)
...
@@ -1875,6 +1890,7 @@ _git_config ()
...
@@ -1875,6 +1890,7 @@ _git_config ()
remote.
*
)
remote.
*
)
local
pfx
=
"
${
cur
%.*
}
."
cur_
=
"
${
cur
#*.
}
"
local
pfx
=
"
${
cur
%.*
}
."
cur_
=
"
${
cur
#*.
}
"
__gitcomp_nl
"
$(
__git_remotes
)
"
"
$pfx
"
"
$cur_
"
"."
__gitcomp_nl
"
$(
__git_remotes
)
"
"
$pfx
"
"
$cur_
"
"."
__gitcomp_nl_append
"pushdefault"
"
$pfx
"
"
$cur_
"
return
return
;;
;;
url.
*
.
*
)
url.
*
.
*
)
...
@@ -1997,6 +2013,7 @@ _git_config ()
...
@@ -1997,6 +2013,7 @@ _git_config ()
fetch.unpackLimit
fetch.unpackLimit
format.attach
format.attach
format.cc
format.cc
format.coverLetter
format.headers
format.headers
format.numbered
format.numbered
format.pretty
format.pretty
...
@@ -2580,7 +2597,7 @@ if [[ -n ${ZSH_VERSION-} ]]; then
...
@@ -2580,7 +2597,7 @@ if [[ -n ${ZSH_VERSION-} ]]; then
--
*
=
*
|
*
.
)
;;
--
*
=
*
|
*
.
)
;;
*
)
c
=
"
$c
"
;;
*
)
c
=
"
$c
"
;;
esac
esac
array[
$#array
+1]
=
"
$c
"
array[
$
{
#
array
[@]
}
+1]
=
"
$c
"
done
done
compset
-P
'*[=:]'
compset
-P
'*[=:]'
compadd
-Q
-S
''
-p
"
${
2
-
}
"
-a
--
array
&&
_ret
=
0
compadd
-Q
-S
''
-p
"
${
2
-
}
"
-a
--
array
&&
_ret
=
0
...
...
plugins/gitfast/git-prompt.sh
View file @
dac07b26
...
@@ -60,6 +60,7 @@
...
@@ -60,6 +60,7 @@
# of values:
# of values:
#
#
# verbose show number of commits ahead/behind (+/-) upstream
# verbose show number of commits ahead/behind (+/-) upstream
# name if verbose, then also show the upstream abbrev name
# legacy don't use the '--count' option available in recent
# legacy don't use the '--count' option available in recent
# versions of git-rev-list
# versions of git-rev-list
# git always compare HEAD to @{upstream}
# git always compare HEAD to @{upstream}
...
@@ -84,13 +85,17 @@
...
@@ -84,13 +85,17 @@
# the colored output of "git status -sb" and are available only when
# the colored output of "git status -sb" and are available only when
# using __git_ps1 for PROMPT_COMMAND or precmd.
# using __git_ps1 for PROMPT_COMMAND or precmd.
# check whether printf supports -v
__git_printf_supports_v
=
printf
-v
__git_printf_supports_v
--
'%s'
yes
>
/dev/null 2>&1
# stores the divergence from upstream in $p
# stores the divergence from upstream in $p
# used by GIT_PS1_SHOWUPSTREAM
# used by GIT_PS1_SHOWUPSTREAM
__git_ps1_show_upstream
()
__git_ps1_show_upstream
()
{
{
local
key value
local
key value
local
svn_remote svn_url_pattern count n
local
svn_remote svn_url_pattern count n
local
upstream
=
git
legacy
=
""
verbose
=
""
local
upstream
=
git
legacy
=
""
verbose
=
""
name
=
""
svn_remote
=()
svn_remote
=()
# get some config options from git-config
# get some config options from git-config
...
@@ -106,7 +111,7 @@ __git_ps1_show_upstream ()
...
@@ -106,7 +111,7 @@ __git_ps1_show_upstream ()
;;
;;
svn-remote.
*
.url
)
svn-remote.
*
.url
)
svn_remote[
$((${#
svn_remote
[@]
}
+
1
))
]=
"
$value
"
svn_remote[
$((${#
svn_remote
[@]
}
+
1
))
]=
"
$value
"
svn_url_pattern
+
=
"
\\
|
$value
"
svn_url_pattern
=
"
$svn_url_pattern
\\
|
$value
"
upstream
=
svn+git
# default upstream is SVN if available, else git
upstream
=
svn+git
# default upstream is SVN if available, else git
;;
;;
esac
esac
...
@@ -118,6 +123,7 @@ __git_ps1_show_upstream ()
...
@@ -118,6 +123,7 @@ __git_ps1_show_upstream ()
git|svn
)
upstream
=
"
$option
"
;;
git|svn
)
upstream
=
"
$option
"
;;
verbose
)
verbose
=
1
;;
verbose
)
verbose
=
1
;;
legacy
)
legacy
=
1
;;
legacy
)
legacy
=
1
;;
name
)
name
=
1
;;
esac
esac
done
done
...
@@ -200,6 +206,9 @@ __git_ps1_show_upstream ()
...
@@ -200,6 +206,9 @@ __git_ps1_show_upstream ()
*
)
# diverged from upstream
*
)
# diverged from upstream
p
=
" u+
${
count
#*
}
-
${
count
% *
}
"
;;
p
=
" u+
${
count
#*
}
-
${
count
% *
}
"
;;
esac
esac
if
[[
-n
"
$count
"
&&
-n
"
$name
"
]]
;
then
p
=
"
$p
$(
git rev-parse
--abbrev-ref
"
$upstream
"
2>/dev/null
)
"
fi
fi
fi
}
}
...
@@ -250,6 +259,13 @@ __git_ps1_colorize_gitstring ()
...
@@ -250,6 +259,13 @@ __git_ps1_colorize_gitstring ()
r
=
"
$c_clear$r
"
r
=
"
$c_clear$r
"
}
}
eread
()
{
f
=
"
$1
"
shift
test
-r
"
$f
"
&&
read
"
$@
"
<
"
$f
"
}
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
# __git_ps1 accepts 0 or 1 arguments (i.e., format string)
# when called from PS1 using command substitution
# when called from PS1 using command substitution
# in this mode it prints text to add to bash PS1 prompt (includes branch name)
# in this mode it prints text to add to bash PS1 prompt (includes branch name)
...
@@ -312,9 +328,9 @@ __git_ps1 ()
...
@@ -312,9 +328,9 @@ __git_ps1 ()
local
step
=
""
local
step
=
""
local
total
=
""
local
total
=
""
if
[
-d
"
$g
/rebase-merge"
]
;
then
if
[
-d
"
$g
/rebase-merge"
]
;
then
read
b 2>/dev/null <
"
$g
/rebase-merge/head-name"
e
read
"
$g
/rebase-merge/head-name"
b
read
step 2>/dev/null <
"
$g
/rebase-merge/msgnum"
e
read
"
$g
/rebase-merge/msgnum"
step
read
total 2>/dev/null <
"
$g
/rebase-merge/end"
e
read
"
$g
/rebase-merge/end"
total
if
[
-f
"
$g
/rebase-merge/interactive"
]
;
then
if
[
-f
"
$g
/rebase-merge/interactive"
]
;
then
r
=
"|REBASE-i"
r
=
"|REBASE-i"
else
else
...
@@ -322,10 +338,10 @@ __git_ps1 ()
...
@@ -322,10 +338,10 @@ __git_ps1 ()
fi
fi
else
else
if
[
-d
"
$g
/rebase-apply"
]
;
then
if
[
-d
"
$g
/rebase-apply"
]
;
then
read
step 2>/dev/null <
"
$g
/rebase-apply/next"
e
read
"
$g
/rebase-apply/next"
step
read
total 2>/dev/null <
"
$g
/rebase-apply/last"
e
read
"
$g
/rebase-apply/last"
total
if
[
-f
"
$g
/rebase-apply/rebasing"
]
;
then
if
[
-f
"
$g
/rebase-apply/rebasing"
]
;
then
read
b 2>/dev/null <
"
$g
/rebase-apply/head-name"
e
read
"
$g
/rebase-apply/head-name"
b
r
=
"|REBASE"
r
=
"|REBASE"
elif
[
-f
"
$g
/rebase-apply/applying"
]
;
then
elif
[
-f
"
$g
/rebase-apply/applying"
]
;
then
r
=
"|AM"
r
=
"|AM"
...
@@ -349,7 +365,7 @@ __git_ps1 ()
...
@@ -349,7 +365,7 @@ __git_ps1 ()
b
=
"
$(
git symbolic-ref HEAD 2>/dev/null
)
"
b
=
"
$(
git symbolic-ref HEAD 2>/dev/null
)
"
else
else
local head
=
""
local head
=
""
if
!
read
head
2>/dev/null <
"
$g
/HEAD"
;
then
if
!
e
read
"
$g
/HEAD"
head
;
then
if
[
$pcmode
=
yes
]
;
then
if
[
$pcmode
=
yes
]
;
then
PS1
=
"
$ps1pc_start$ps1pc_end
"
PS1
=
"
$ps1pc_start$ps1pc_end
"
fi
fi
...
@@ -433,7 +449,7 @@ __git_ps1 ()
...
@@ -433,7 +449,7 @@ __git_ps1 ()
local
gitstring
=
"
$c
${
b
##refs/heads/
}${
f
:+
$z$f
}
$r$p
"
local
gitstring
=
"
$c
${
b
##refs/heads/
}${
f
:+
$z$f
}
$r$p
"
if
[
$pcmode
=
yes
]
;
then
if
[
$pcmode
=
yes
]
;
then
if
[
[
-n
${
ZSH_VERSION
-
}
]
]
;
then
if
[
"
${
__git_printf_supports_v
-
}
"
!=
yes
]
;
then
gitstring
=
$(
printf
--
"
$printf_format
"
"
$gitstring
"
)
gitstring
=
$(
printf
--
"
$printf_format
"
"
$gitstring
"
)
else
else
printf
-v
gitstring
--
"
$printf_format
"
"
$gitstring
"
printf
-v
gitstring
--
"
$printf_format
"
"
$gitstring
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment