mirror of
https://github.com/iwata/git-now.git
synced 2026-09-10 07:26:29 -04:00
Merge branch 'hotfix/0.1.1.0'
This commit is contained in:
commit
a07a05893b
|
|
@ -34,16 +34,16 @@ Installation
|
|||
### Mac OS
|
||||
If you're on a Mac and use [homebrew](http://github.com/mxcl/homebrew), it's simple:
|
||||
|
||||
$ brew install https://github.com/iwata/git-now/raw/master/git-now.rb
|
||||
$ brew install git-now
|
||||
|
||||
#### install options
|
||||
* ``--zsh-completion``<br />copy zsh completion function for zsh users
|
||||
* ``--zsh-completion``<br />copy zsh completion function to ``/usr/local/share/zsh/functions`` for zsh users
|
||||
|
||||
$ brew install --zsh-completion https://github.com/iwata/git-now/raw/master/git-now.rb
|
||||
$ brew install --zsh-completion git-now
|
||||
|
||||
Show details
|
||||
|
||||
$ brew options https://github.com/iwata/git-now/raw/master/git-now.rb
|
||||
$ brew options git-now
|
||||
|
||||
### Manual installation
|
||||
If you prefer a manual installation, please use the following instructions:
|
||||
|
|
|
|||
37
etc/_git-now
37
etc/_git-now
|
|
@ -16,17 +16,18 @@ __git-now-add ()
|
|||
typeset -A opt_args
|
||||
|
||||
_arguments -s :\
|
||||
'(--all)-n[do not actually add files; only show which ones would be added]'\
|
||||
'(--all)-v[show files as they are added]'\
|
||||
'(-f --force --all)'{-f,--force}'[allow adding otherwise ignored files]'\
|
||||
'(-i --interactive --all)'{-i,--interactive}'[add contents interactively to index]'\
|
||||
'(-p --path --all)'{-p,--path}'[like -i but go directly into patch mode for specified files]'\
|
||||
'(-e --edit --all)'{-e,--edit}'[open diff against index in editor]'\
|
||||
'(-u --update --all)'{-u,--update}'[update only files git already knows about]'\
|
||||
'(-N --intent-to-add --all)'{-N,--intent-to-add}'[record only that path will be added later]'\
|
||||
'(-s --stat)'{-s,--stat}'[generate diffstat instead of patch]'\
|
||||
'--push[push to remote after performing finish]'\
|
||||
'(-n -v -f --force -i --interactive -p --path -e --edit -u --update -N --intent-to-add)--all[add --update and add .]'\
|
||||
'(--all -h --help)-n[do not actually add files; only show which ones would be added]'\
|
||||
'(--all -h --help)-v[show files as they are added]'\
|
||||
'(-f --force --all -h --help)'{-f,--force}'[allow adding otherwise ignored files]'\
|
||||
'(-i --interactive --all -h --help)'{-i,--interactive}'[add contents interactively to index]'\
|
||||
'(-p --path --all -h --help)'{-p,--path}'[like -i but go directly into patch mode for specified files]'\
|
||||
'(-e --edit --all -h --help)'{-e,--edit}'[open diff against index in editor]'\
|
||||
'(-u --update --all -h --help)'{-u,--update}'[update only files git already knows about]'\
|
||||
'(-N --intent-to-add --all -h --help)'{-N,--intent-to-add}'[record only that path will be added later]'\
|
||||
'(-s --stat -h --help)'{-s,--stat}'[generate diffstat instead of patch]'\
|
||||
'(-h --help)--push[push to remote after performing finish]'\
|
||||
'(-n -v -f --force -i --interactive -p --path -e --edit -u --update -N --intent-to-add -h --help)--all[add --update and add .]'\
|
||||
'(-n -v -f --force -i --interactive -p --path -e --edit -u --update -N --intent-to-add -h --help --all --push)'{-h,--help}'[show help message]'\
|
||||
':filepattern:_files'
|
||||
}
|
||||
|
||||
|
|
@ -95,8 +96,9 @@ case $state in
|
|||
|
||||
(rebase)
|
||||
_arguments \
|
||||
'(-m --mine)'{-m,--mine}'[limit git-now commits by your name]'\
|
||||
':branch-name:__git_branch_names'
|
||||
'(-m --mine -h --help)'{-m,--mine}'[limit git-now commits by your name]'\
|
||||
'(-m --mine -h --help)'{-h,--help}'[show help message]'\
|
||||
':base-branch-name:__git_branch_names'
|
||||
;;
|
||||
|
||||
(push)
|
||||
|
|
@ -106,10 +108,11 @@ case $state in
|
|||
|
||||
(grep)
|
||||
_arguments -s : \
|
||||
'(-p --path)'{-p,--patch}'[generate diff in patch format]'\
|
||||
'(-s --stat)'{-s,--stat}'[generate diffstat instead of patch]'\
|
||||
'(-m --mine)'{-m,--mine}'[limit git-now commits by your name]'\
|
||||
':branch-name:__git_branch_names'
|
||||
'(-p --patch -h --help)'{-p,--patch}'[generate diff in patch format]'\
|
||||
'(-s --stat -h --help)'{-s,--stat}'[generate diffstat instead of patch]'\
|
||||
'(-m --mine -h --help)'{-m,--mine}'[limit git-now commits by your name]'\
|
||||
'(-m --mine -s --stat -p --patch -h --help)'{-h,--help}'[show help message]'\
|
||||
':base-branch-name:__git_branch_names'
|
||||
;;
|
||||
(*)
|
||||
__git-now-add
|
||||
|
|
|
|||
|
|
@ -1,132 +0,0 @@
|
|||
#!zsh
|
||||
#
|
||||
# Installation
|
||||
# ------------
|
||||
#
|
||||
# To achieve git-flow completion nirvana:
|
||||
#
|
||||
# 0. Update your zsh's git-completion module to the newest verion.
|
||||
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
|
||||
#
|
||||
# 1. Install this file. Either:
|
||||
#
|
||||
# a. Place it in your .zshrc:
|
||||
#
|
||||
# b. Or, copy it somewhere (e.g. ~/.git-now-completion.zsh) and put the following line in
|
||||
# your .zshrc:
|
||||
#
|
||||
# source ~/.git-now-completion.zsh
|
||||
#
|
||||
|
||||
_git-now ()
|
||||
{
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'add:default subcommand.'
|
||||
'rebase:rebase for temporary commits.'
|
||||
'push:remove remote branch and push to remote repoistory for rebase commits.'
|
||||
'grep:grep temporary commits.'
|
||||
)
|
||||
_describe -t commands 'git now' subcommands
|
||||
__git-now-add
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(add)
|
||||
__git-now-add
|
||||
;;
|
||||
|
||||
(rebase)
|
||||
_arguments \
|
||||
'(-m --mine)'{-m,--mine}'[limit git-now commits by your name]'\
|
||||
':branch-name:__git_branch_names'
|
||||
;;
|
||||
|
||||
(push)
|
||||
_arguments \
|
||||
':remote-repostory:__git_remotes'
|
||||
;;
|
||||
|
||||
(grep)
|
||||
_arguments -s : \
|
||||
'(-p --path)'{-p,--patch}'[generate diff in patch format]'\
|
||||
'(-s --stat)'{-s,--stat}'[generate diffstat instead of patch]'\
|
||||
'(-m --mine)'{-m,--mine}'[limit git-now commits by your name]'\
|
||||
':branch-name:__git_branch_names'
|
||||
;;
|
||||
(*)
|
||||
__git-now-add
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git-now-add ()
|
||||
{
|
||||
local curcontext="$curcontext" state line expl
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -s :\
|
||||
'(--all)-n[do not actually add files; only show which ones would be added]'\
|
||||
'(--all)-v[show files as they are added]'\
|
||||
'(-f --force --all)'{-f,--force}'[allow adding otherwise ignored files]'\
|
||||
'(-i --interactive --all)'{-i,--interactive}'[add contents interactively to index]'\
|
||||
'(-p --path --all)'{-p,--path}'[like -i but go directly into patch mode for specified files]'\
|
||||
'(-e --edit --all)'{-e,--edit}'[open diff against index in editor]'\
|
||||
'(-u --update --all)'{-u,--update}'[update only files git already knows about]'\
|
||||
'(-N --intent-to-add --all)'{-N,--intent-to-add}'[record only that path will be added later]'\
|
||||
'(-s --stat)'{-s,--stat}'[generate diffstat instead of patch]'\
|
||||
'--push[push to remote after performing finish]'\
|
||||
'(-n -v -f --force -i --interactive -p --path -e --edit -u --update -N --intent-to-add)--all[add --update and add .]'\
|
||||
':filepattern:_files'
|
||||
}
|
||||
|
||||
__git_remotes () {
|
||||
local expl gitdir remotes
|
||||
|
||||
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
|
||||
__git_command_successful || return
|
||||
|
||||
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
|
||||
__git_command_successful || return
|
||||
|
||||
# TODO: Should combine the two instead of either or.
|
||||
if (( $#remotes > 0 )); then
|
||||
_wanted remotes expl remote compadd $* - $remotes
|
||||
else
|
||||
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
|
||||
fi
|
||||
}
|
||||
|
||||
__git_branch_names () {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
|
||||
__git_command_successful || return
|
||||
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
__git_command_successful () {
|
||||
if (( ${#pipestatus:#0} > 0 )); then
|
||||
_message 'not a git repository'
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
zstyle ':completion:*:*:git:*' user-commands now:'description for foo'
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
require 'formula'
|
||||
|
||||
class GitNow < Formula
|
||||
url 'https://github.com/iwata/git-now.git', :tag => 'v0.1.0.9'
|
||||
version '0.1.0.9'
|
||||
url 'https://github.com/iwata/git-now.git', :tag => 'v0.1.1.0'
|
||||
version '0.1.1.0'
|
||||
head 'https://github.com/iwata/git-now.git', :branch => 'develop'
|
||||
homepage 'https://github.com/iwata/git-now'
|
||||
|
||||
def options
|
||||
[
|
||||
['--zsh-completion', "copy zsh completion function file to #{share}/zsh/functions"]
|
||||
['--zsh-completion', "copy zsh completion function file to #{share}/zsh/functions: please add #{share}/zsh/functions to $fpath in .zshrc"]
|
||||
]
|
||||
end
|
||||
|
||||
|
|
@ -19,10 +19,6 @@ class GitNow < Formula
|
|||
# for longopt
|
||||
depends_on 'gnu-getopt'
|
||||
|
||||
if ARGV.include? '--zsh-completion'
|
||||
depends_on 'zsh'
|
||||
end
|
||||
|
||||
def install
|
||||
system "make", "prefix=#{prefix}", "install"
|
||||
if ARGV.include? '--zsh-completion'
|
||||
Loading…
Reference in a new issue