mirror of
				https://github.com/dcarrillo/prezto.git
				synced 2025-11-04 13:19:09 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			module/git
			...
			pull/563-c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					c2d6b378a6 | ||
| 
						 | 
					7823bb9985 | 
@@ -57,6 +57,17 @@ key_info=(
 | 
				
			|||||||
  'BackTab'   "$terminfo[kcbt]"
 | 
					  'BackTab'   "$terminfo[kcbt]"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Escape sequences from Debian's inputrc.
 | 
				
			||||||
 | 
					key_info+=(
 | 
				
			||||||
 | 
					  'ControlLeft' '\e[1;5D \e[5D \e\e[D \eOd'
 | 
				
			||||||
 | 
					  'ControlRight' '\e[1;5C \e[5C \e\e[C \eOc'
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# if [[ "$TERM" == rxvt* ]]; then
 | 
				
			||||||
 | 
					#   key_info[ControlLeft]+=' \eOd'
 | 
				
			||||||
 | 
					#   key_info[ControlRight]+=' \eOc'
 | 
				
			||||||
 | 
					# fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Set empty $key_info values to an invalid UTF-8 sequence to induce silent
 | 
					# Set empty $key_info values to an invalid UTF-8 sequence to induce silent
 | 
				
			||||||
# bindkey failure.
 | 
					# bindkey failure.
 | 
				
			||||||
for key in "${(k)key_info[@]}"; do
 | 
					for key in "${(k)key_info[@]}"; do
 | 
				
			||||||
@@ -206,10 +217,10 @@ bindkey -d
 | 
				
			|||||||
# Emacs Key Bindings
 | 
					# Emacs Key Bindings
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for key ("$key_info[Escape]"{B,b}) bindkey -M emacs "$key" emacs-backward-word
 | 
					for key in "$key_info[Escape]"{B,b} "${(s: :)key_info[ControlLeft]}"
 | 
				
			||||||
for key ("$key_info[Escape]"{F,f}) bindkey -M emacs "$key" emacs-forward-word
 | 
					  bindkey -M emacs "$key" emacs-backward-word
 | 
				
			||||||
bindkey -M emacs "$key_info[Escape]$key_info[Left]" emacs-backward-word
 | 
					for key in "$key_info[Escape]"{F,f} "${(s: :)key_info[ControlRight]}"
 | 
				
			||||||
bindkey -M emacs "$key_info[Escape]$key_info[Right]" emacs-forward-word
 | 
					  bindkey -M emacs "$key" emacs-forward-word
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Kill to the beginning of the line.
 | 
					# Kill to the beginning of the line.
 | 
				
			||||||
for key in "$key_info[Escape]"{K,k}
 | 
					for key in "$key_info[Escape]"{K,k}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -21,7 +21,7 @@ _arguments -C -s -S \
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
case "$state" in
 | 
					case "$state" in
 | 
				
			||||||
  (remote)
 | 
					  (remote)
 | 
				
			||||||
    remotes=($(command git config --get-regexp 'remote.*.url' | cut -d. -f2))
 | 
					    remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _describe -t branch 'remotes' remotes && ret=0
 | 
					    _describe -t branch 'remotes' remotes && ret=0
 | 
				
			||||||
  ;;
 | 
					  ;;
 | 
				
			||||||
@@ -29,7 +29,7 @@ case "$state" in
 | 
				
			|||||||
    remote="$words[(($CURRENT - 1))]"
 | 
					    remote="$words[(($CURRENT - 1))]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    branches_or_tags=($(
 | 
					    branches_or_tags=($(
 | 
				
			||||||
      command git ls-remote --heads --tags "$remote" 2>/dev/null | cut -f2
 | 
					      git ls-remote --heads --tags "$remote" 2>/dev/null | cut -f2
 | 
				
			||||||
    ))
 | 
					    ))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/})
 | 
					    branches=(HEAD ${${(M)branches_or_tags[@]##refs/heads/?##}##refs/heads/})
 | 
				
			||||||
@@ -39,7 +39,7 @@ case "$state" in
 | 
				
			|||||||
    _describe -t tag 'tags' tags && ret=0
 | 
					    _describe -t tag 'tags' tags && ret=0
 | 
				
			||||||
  ;;
 | 
					  ;;
 | 
				
			||||||
  (file)
 | 
					  (file)
 | 
				
			||||||
    files=(${(0)"$(_call_program files command git ls-files -z --exclude-standard 2>/dev/null)"})
 | 
					    files=(${(0)"$(_call_program files git ls-files -z --exclude-standard 2>/dev/null)"})
 | 
				
			||||||
    _wanted file expl 'file' _multi_parts - / files && ret=0
 | 
					    _wanted file expl 'file' _multi_parts - / files && ret=0
 | 
				
			||||||
  ;;
 | 
					  ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -25,7 +25,7 @@ case "$state" in
 | 
				
			|||||||
    while IFS=$'\n' read submodule; do
 | 
					    while IFS=$'\n' read submodule; do
 | 
				
			||||||
      submodules+=("$submodule")
 | 
					      submodules+=("$submodule")
 | 
				
			||||||
    done < <(
 | 
					    done < <(
 | 
				
			||||||
      command git config --file "$(git-root)/.gitmodules" --list \
 | 
					      git config --file "$(git-root)/.gitmodules" --list \
 | 
				
			||||||
        | grep '.path=' \
 | 
					        | grep '.path=' \
 | 
				
			||||||
        | cut -d= -f2-
 | 
					        | cut -d= -f2-
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -18,7 +18,7 @@ local submodule
 | 
				
			|||||||
while IFS=$'\n' read submodule; do
 | 
					while IFS=$'\n' read submodule; do
 | 
				
			||||||
  submodules+=("$submodule")
 | 
					  submodules+=("$submodule")
 | 
				
			||||||
done < <(
 | 
					done < <(
 | 
				
			||||||
  command git config --file "$(git-root)/.gitmodules" --list \
 | 
					  git config --file "$(git-root)/.gitmodules" --list \
 | 
				
			||||||
    | grep '.path=' \
 | 
					    | grep '.path=' \
 | 
				
			||||||
    | cut -d= -f2-
 | 
					    | cut -d= -f2-
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,12 +5,12 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! command git rev-parse 2> /dev/null; then
 | 
					if ! git rev-parse 2> /dev/null; then
 | 
				
			||||||
  print "$0: not a repository: $PWD" >&2
 | 
					  print "$0: not a repository: $PWD" >&2
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local ref="$(command git symbolic-ref HEAD 2> /dev/null)"
 | 
					local ref="$(git symbolic-ref HEAD 2> /dev/null)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ -n "$ref" ]]; then
 | 
					if [[ -n "$ref" ]]; then
 | 
				
			||||||
  print "${ref#refs/heads/}"
 | 
					  print "${ref#refs/heads/}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,15 +5,15 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  print "$0: not a repository work tree: $PWD" >&2
 | 
					  print "$0: not a repository work tree: $PWD" >&2
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
command git fsck 2> /dev/null \
 | 
					git fsck 2> /dev/null \
 | 
				
			||||||
  | grep "^dangling commit" \
 | 
					  | grep "^dangling commit" \
 | 
				
			||||||
  | awk '{print $3}' \
 | 
					  | awk '{print $3}' \
 | 
				
			||||||
  | command git log \
 | 
					  | git log \
 | 
				
			||||||
      --date-order \
 | 
					      --date-order \
 | 
				
			||||||
      --no-walk \
 | 
					      --no-walk \
 | 
				
			||||||
      --stdin \
 | 
					      --stdin \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local git_dir="${$(command git rev-parse --git-dir):A}"
 | 
					local git_dir="${$(git rev-parse --git-dir):A}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ -n "$git_dir" ]]; then
 | 
					if [[ -n "$git_dir" ]]; then
 | 
				
			||||||
  print "$git_dir"
 | 
					  print "$git_dir"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  print "$0: not a repository work tree: $PWD" >&2
 | 
					  print "$0: not a repository work tree: $PWD" >&2
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
@@ -13,7 +13,7 @@ fi
 | 
				
			|||||||
local remotes remote references reference file url
 | 
					local remotes remote references reference file url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
remote="${1:-origin}"
 | 
					remote="${1:-origin}"
 | 
				
			||||||
remotes=($(command git config --get-regexp 'remote.*.url' | cut -d. -f2))
 | 
					remotes=($(git config --get-regexp 'remote.*.url' | cut -d. -f2))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (( $remotes[(i)$remote] == $#remotes + 1 )); then
 | 
					if (( $remotes[(i)$remote] == $#remotes + 1 )); then
 | 
				
			||||||
  print "$0: remote not found: $remote" >&2
 | 
					  print "$0: remote not found: $remote" >&2
 | 
				
			||||||
@@ -21,14 +21,14 @@ if (( $remotes[(i)$remote] == $#remotes + 1 )); then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
url=$(
 | 
					url=$(
 | 
				
			||||||
  command git config --get "remote.${remote}.url" \
 | 
					  git config --get "remote.${remote}.url" \
 | 
				
			||||||
    | sed -En "s/(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p"
 | 
					    | sed -En "s/(git|https?)(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\4\/\5/p"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
reference="${${2:-$(git-branch-current)}:-HEAD}"
 | 
					reference="${${2:-$(git-branch-current)}:-HEAD}"
 | 
				
			||||||
references=(
 | 
					references=(
 | 
				
			||||||
  HEAD
 | 
					  HEAD
 | 
				
			||||||
  ${$(command git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/}
 | 
					  ${$(git ls-remote --heads --tags "$remote" | awk '{print $2}')##refs/(heads|tags)/}
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (( $references[(i)$reference] == $#references + 1 )); then
 | 
					if (( $references[(i)$reference] == $#references + 1 )); then
 | 
				
			||||||
@@ -37,7 +37,7 @@ if (( $references[(i)$reference] == $#references + 1 )); then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ "$reference" == 'HEAD' ]]; then
 | 
					if [[ "$reference" == 'HEAD' ]]; then
 | 
				
			||||||
  reference="$(command git rev-parse HEAD 2>/dev/null)"
 | 
					  reference="$(git rev-parse HEAD 2>/dev/null)"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
file="$3"
 | 
					file="$3"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -164,15 +164,15 @@ function git-info {
 | 
				
			|||||||
  typeset -gA git_info
 | 
					  typeset -gA git_info
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Return if not inside a Git repository work tree.
 | 
					  # Return if not inside a Git repository work tree.
 | 
				
			||||||
  if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					  if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
    return 1
 | 
					    return 1
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (( $# > 0 )); then
 | 
					  if (( $# > 0 )); then
 | 
				
			||||||
    if [[ "$1" == [Oo][Nn] ]]; then
 | 
					    if [[ "$1" == [Oo][Nn] ]]; then
 | 
				
			||||||
      command git config --bool prompt.showinfo true
 | 
					      git config --bool prompt.showinfo true
 | 
				
			||||||
    elif [[ "$1" == [Oo][Ff][Ff] ]]; then
 | 
					    elif [[ "$1" == [Oo][Ff][Ff] ]]; then
 | 
				
			||||||
      command git config --bool prompt.showinfo false
 | 
					      git config --bool prompt.showinfo false
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      print "usage: $0 [ on | off ]" >&2
 | 
					      print "usage: $0 [ on | off ]" >&2
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
@@ -180,7 +180,7 @@ function git-info {
 | 
				
			|||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Return if git-info is disabled.
 | 
					  # Return if git-info is disabled.
 | 
				
			||||||
  if ! is-true "${$(command git config --bool prompt.showinfo):-true}"; then
 | 
					  if ! is-true "${$(git config --bool prompt.showinfo):-true}"; then
 | 
				
			||||||
    return 1
 | 
					    return 1
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -190,7 +190,7 @@ function git-info {
 | 
				
			|||||||
  # Format commit.
 | 
					  # Format commit.
 | 
				
			||||||
  zstyle -s ':prezto:module:git:info:commit' format 'commit_format'
 | 
					  zstyle -s ':prezto:module:git:info:commit' format 'commit_format'
 | 
				
			||||||
  if [[ -n "$commit_format" ]]; then
 | 
					  if [[ -n "$commit_format" ]]; then
 | 
				
			||||||
    commit="$(command git rev-parse HEAD 2> /dev/null)"
 | 
					    commit="$(git rev-parse HEAD 2> /dev/null)"
 | 
				
			||||||
    if [[ -n "$commit" ]]; then
 | 
					    if [[ -n "$commit" ]]; then
 | 
				
			||||||
      zformat -f commit_formatted "$commit_format" "c:$commit"
 | 
					      zformat -f commit_formatted "$commit_format" "c:$commit"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
@@ -199,7 +199,7 @@ function git-info {
 | 
				
			|||||||
  # Format stashed.
 | 
					  # Format stashed.
 | 
				
			||||||
  zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
 | 
					  zstyle -s ':prezto:module:git:info:stashed' format 'stashed_format'
 | 
				
			||||||
  if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then
 | 
					  if [[ -n "$stashed_format" && -f "$(git-dir)/refs/stash" ]]; then
 | 
				
			||||||
    stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
 | 
					    stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
 | 
				
			||||||
    if [[ -n "$stashed" ]]; then
 | 
					    if [[ -n "$stashed" ]]; then
 | 
				
			||||||
      zformat -f stashed_formatted "$stashed_format" "S:$stashed"
 | 
					      zformat -f stashed_formatted "$stashed_format" "S:$stashed"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
@@ -215,7 +215,7 @@ function git-info {
 | 
				
			|||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Get the branch.
 | 
					  # Get the branch.
 | 
				
			||||||
  branch="${$(command git symbolic-ref HEAD 2> /dev/null)#refs/heads/}"
 | 
					  branch="${$(git symbolic-ref HEAD 2> /dev/null)#refs/heads/}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Format branch.
 | 
					  # Format branch.
 | 
				
			||||||
  zstyle -s ':prezto:module:git:info:branch' format 'branch_format'
 | 
					  zstyle -s ':prezto:module:git:info:branch' format 'branch_format'
 | 
				
			||||||
@@ -226,7 +226,7 @@ function git-info {
 | 
				
			|||||||
  # Format position.
 | 
					  # Format position.
 | 
				
			||||||
  zstyle -s ':prezto:module:git:info:position' format 'position_format'
 | 
					  zstyle -s ':prezto:module:git:info:position' format 'position_format'
 | 
				
			||||||
  if [[ -z "$branch" && -n "$position_format" ]]; then
 | 
					  if [[ -z "$branch" && -n "$position_format" ]]; then
 | 
				
			||||||
    position="$(command git describe --contains --all HEAD 2> /dev/null)"
 | 
					    position="$(git describe --contains --all HEAD 2> /dev/null)"
 | 
				
			||||||
    if [[ -n "$position" ]]; then
 | 
					    if [[ -n "$position" ]]; then
 | 
				
			||||||
      zformat -f position_formatted "$position_format" "p:$position"
 | 
					      zformat -f position_formatted "$position_format" "p:$position"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
@@ -236,7 +236,7 @@ function git-info {
 | 
				
			|||||||
  zstyle -s ':prezto:module:git:info:remote' format 'remote_format'
 | 
					  zstyle -s ':prezto:module:git:info:remote' format 'remote_format'
 | 
				
			||||||
  if [[ -n "$branch" && -n "$remote_format" ]]; then
 | 
					  if [[ -n "$branch" && -n "$remote_format" ]]; then
 | 
				
			||||||
    # Gets the remote name.
 | 
					    # Gets the remote name.
 | 
				
			||||||
    remote_cmd='command git rev-parse --symbolic-full-name --verify HEAD@{upstream}'
 | 
					    remote_cmd='git rev-parse --symbolic-full-name --verify HEAD@{upstream}'
 | 
				
			||||||
    remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
 | 
					    remote="${$(${(z)remote_cmd} 2> /dev/null)##refs/remotes/}"
 | 
				
			||||||
    if [[ -n "$remote" ]]; then
 | 
					    if [[ -n "$remote" ]]; then
 | 
				
			||||||
      zformat -f remote_formatted "$remote_format" "R:$remote"
 | 
					      zformat -f remote_formatted "$remote_format" "R:$remote"
 | 
				
			||||||
@@ -247,7 +247,7 @@ function git-info {
 | 
				
			|||||||
  zstyle -s ':prezto:module:git:info:behind' format 'behind_format'
 | 
					  zstyle -s ':prezto:module:git:info:behind' format 'behind_format'
 | 
				
			||||||
  if [[ -n "$branch" && ( -n "$ahead_format" || -n "$behind_format" ) ]]; then
 | 
					  if [[ -n "$branch" && ( -n "$ahead_format" || -n "$behind_format" ) ]]; then
 | 
				
			||||||
    # Gets the commit difference counts between local and remote.
 | 
					    # Gets the commit difference counts between local and remote.
 | 
				
			||||||
    ahead_and_behind_cmd='command git rev-list --count --left-right HEAD...@{upstream}'
 | 
					    ahead_and_behind_cmd='git rev-list --count --left-right HEAD...@{upstream}'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Get ahead and behind counts.
 | 
					    # Get ahead and behind counts.
 | 
				
			||||||
    ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)"
 | 
					    ahead_and_behind="$(${(z)ahead_and_behind_cmd} 2> /dev/null)"
 | 
				
			||||||
@@ -276,7 +276,7 @@ function git-info {
 | 
				
			|||||||
    if [[ -n "$indexed_format" ]]; then
 | 
					    if [[ -n "$indexed_format" ]]; then
 | 
				
			||||||
      ((
 | 
					      ((
 | 
				
			||||||
        indexed+=$(
 | 
					        indexed+=$(
 | 
				
			||||||
          command git diff-index \
 | 
					          git diff-index \
 | 
				
			||||||
            --no-ext-diff \
 | 
					            --no-ext-diff \
 | 
				
			||||||
            --name-only \
 | 
					            --name-only \
 | 
				
			||||||
            --cached \
 | 
					            --cached \
 | 
				
			||||||
@@ -296,7 +296,7 @@ function git-info {
 | 
				
			|||||||
    if [[ -n "$unindexed_format" ]]; then
 | 
					    if [[ -n "$unindexed_format" ]]; then
 | 
				
			||||||
      ((
 | 
					      ((
 | 
				
			||||||
        unindexed+=$(
 | 
					        unindexed+=$(
 | 
				
			||||||
          command git diff-files \
 | 
					          git diff-files \
 | 
				
			||||||
            --no-ext-diff \
 | 
					            --no-ext-diff \
 | 
				
			||||||
            --name-only \
 | 
					            --name-only \
 | 
				
			||||||
            --ignore-submodules=${ignore_submodules:-none} \
 | 
					            --ignore-submodules=${ignore_submodules:-none} \
 | 
				
			||||||
@@ -314,7 +314,7 @@ function git-info {
 | 
				
			|||||||
    if [[ -n "$untracked_format" ]]; then
 | 
					    if [[ -n "$untracked_format" ]]; then
 | 
				
			||||||
      ((
 | 
					      ((
 | 
				
			||||||
        untracked+=$(
 | 
					        untracked+=$(
 | 
				
			||||||
          command git ls-files \
 | 
					          git ls-files \
 | 
				
			||||||
            --other \
 | 
					            --other \
 | 
				
			||||||
            --exclude-standard \
 | 
					            --exclude-standard \
 | 
				
			||||||
            2> /dev/null \
 | 
					            2> /dev/null \
 | 
				
			||||||
@@ -329,7 +329,7 @@ function git-info {
 | 
				
			|||||||
    (( dirty = indexed + unindexed + untracked ))
 | 
					    (( dirty = indexed + unindexed + untracked ))
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    # Use porcelain status for easy parsing.
 | 
					    # Use porcelain status for easy parsing.
 | 
				
			||||||
    status_cmd="command git status --porcelain --ignore-submodules=${ignore_submodules:-none}"
 | 
					    status_cmd="git status --porcelain --ignore-submodules=${ignore_submodules:-none}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Get current status.
 | 
					    # Get current status.
 | 
				
			||||||
    while IFS=$'\n' read line; do
 | 
					    while IFS=$'\n' read line; do
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local root="$(command git rev-parse --show-toplevel 2> /dev/null)"
 | 
					local root="$(git rev-parse --show-toplevel 2> /dev/null)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ -n "$root" ]]; then
 | 
					if [[ -n "$root" ]]; then
 | 
				
			||||||
  print "$root"
 | 
					  print "$root"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  print "$0: not a repository work tree: $PWD" >&2
 | 
					  print "$0: not a repository work tree: $PWD" >&2
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
@@ -13,10 +13,10 @@ fi
 | 
				
			|||||||
local stashed
 | 
					local stashed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ -f "$(git-dir)/refs/stash" ]]; then
 | 
					if [[ -f "$(git-dir)/refs/stash" ]]; then
 | 
				
			||||||
  stashed="$(command git stash list 2> /dev/null | wc -l | awk '{print $1}')"
 | 
					  stashed="$(git stash list 2> /dev/null | wc -l | awk '{print $1}')"
 | 
				
			||||||
  if (( $stashed > 0 )); then
 | 
					  if (( $stashed > 0 )); then
 | 
				
			||||||
    if read -q "?Clear $stashed stashed state(s) [y/N]? "; then
 | 
					    if read -q "?Clear $stashed stashed state(s) [y/N]? "; then
 | 
				
			||||||
      command git stash clear
 | 
					      git stash clear
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,15 +5,15 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  print "$0: not a repository work tree: $PWD" >&2
 | 
					  print "$0: not a repository work tree: $PWD" >&2
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
command git fsck --unreachable 2> /dev/null \
 | 
					git fsck --unreachable 2> /dev/null \
 | 
				
			||||||
  | grep 'commit' \
 | 
					  | grep 'commit' \
 | 
				
			||||||
  | awk '{print $3}' \
 | 
					  | awk '{print $3}' \
 | 
				
			||||||
  | command git log \
 | 
					  | git log \
 | 
				
			||||||
      --pretty=format:${_git_log_oneline_format} \
 | 
					      --pretty=format:${_git_log_oneline_format} \
 | 
				
			||||||
      --extended-regexp \
 | 
					      --extended-regexp \
 | 
				
			||||||
      --grep="${1:-(WIP )?[Oo]n [^:]+:}" \
 | 
					      --grep="${1:-(WIP )?[Oo]n [^:]+:}" \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  print "$0: not a repository work tree: $PWD" >&2
 | 
					  print "$0: not a repository work tree: $PWD" >&2
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
@@ -13,7 +13,7 @@ fi
 | 
				
			|||||||
local commit
 | 
					local commit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for commit in "$@"; do
 | 
					for commit in "$@"; do
 | 
				
			||||||
  command git update-ref \
 | 
					  git update-ref \
 | 
				
			||||||
    -m "$(command git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit"
 | 
					    -m "$(git log -1 --pretty="format:%s" "$commit")" refs/stash "$commit"
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  print "$0: not a repository work tree: $PWD" >&2
 | 
					  print "$0: not a repository work tree: $PWD" >&2
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
elif [[ "$PWD" != "$(git-root)" ]]; then
 | 
					elif [[ "$PWD" != "$(git-root)" ]]; then
 | 
				
			||||||
@@ -17,7 +17,7 @@ local src="$1"
 | 
				
			|||||||
local dst="$2"
 | 
					local dst="$2"
 | 
				
			||||||
local url
 | 
					local url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
url="$(command git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")"
 | 
					url="$(git config --file "$(git-root)/.gitmodules" --get "submodule.${src}.url")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ -z "$url" ]]; then
 | 
					if [[ -z "$url" ]]; then
 | 
				
			||||||
  print "$0: submodule not found: $src" >&2
 | 
					  print "$0: submodule not found: $src" >&2
 | 
				
			||||||
@@ -27,7 +27,7 @@ fi
 | 
				
			|||||||
mkdir -p "${dst:h}"
 | 
					mkdir -p "${dst:h}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
git-submodule-remove "$src"
 | 
					git-submodule-remove "$src"
 | 
				
			||||||
command git submodule add "$url" "$dst"
 | 
					git submodule add "$url" "$dst"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
return 0
 | 
					return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,22 +5,22 @@
 | 
				
			|||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ! is-true "$(command git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
					if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
  print "$0: not a repository work tree: $PWD" >&2
 | 
					  print "$0: not a repository work tree: $PWD" >&2
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
elif [[ "$PWD" != "$(git-root)" ]]; then
 | 
					elif [[ "$PWD" != "$(git-root)" ]]; then
 | 
				
			||||||
  print "$0: must be run from the root of the work tree" >&2
 | 
					  print "$0: must be run from the root of the work tree" >&2
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
elif ! command git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then
 | 
					elif ! git config --file .gitmodules --get "submodule.${1}.path" &>/dev/null; then
 | 
				
			||||||
  print "$0: submodule not found: $1" >&2
 | 
					  print "$0: submodule not found: $1" >&2
 | 
				
			||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
command git config --file "$(git-dir)/config" --remove-section "submodule.${1}" &>/dev/null
 | 
					git config --file "$(git-dir)/config" --remove-section "submodule.${1}" &>/dev/null
 | 
				
			||||||
command git config --file "$(git-root)/.gitmodules" --remove-section "submodule.${1}" &>/dev/null
 | 
					git config --file "$(git-root)/.gitmodules" --remove-section "submodule.${1}" &>/dev/null
 | 
				
			||||||
command git add .gitmodules
 | 
					git add .gitmodules
 | 
				
			||||||
 | 
					
 | 
				
			||||||
command git rm --cached -rf "${1}"
 | 
					git rm --cached -rf "${1}"
 | 
				
			||||||
rm -rf "${1}"
 | 
					rm -rf "${1}"
 | 
				
			||||||
rm -rf "$(git-dir)/modules/${1}"
 | 
					rm -rf "$(git-dir)/modules/${1}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +0,0 @@
 | 
				
			|||||||
#
 | 
					 | 
				
			||||||
# Adds GitHub knowledge to the Git command.
 | 
					 | 
				
			||||||
# https://hub.github.com
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Authors:
 | 
					 | 
				
			||||||
#   Chris Wanstrath <chris@wanstrath.com>
 | 
					 | 
				
			||||||
#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if (( $+commands[hub] )); then
 | 
					 | 
				
			||||||
  function git {
 | 
					 | 
				
			||||||
    hub "$@"
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -15,5 +15,4 @@ pmodload 'helper'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Source module files.
 | 
					# Source module files.
 | 
				
			||||||
source "${0:h}/alias.zsh"
 | 
					source "${0:h}/alias.zsh"
 | 
				
			||||||
source "${0:h}/hub.zsh"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ function diff {
 | 
				
			|||||||
    if (( $+commands[colordiff] )); then
 | 
					    if (( $+commands[colordiff] )); then
 | 
				
			||||||
      command diff --unified "$@" | colordiff --difftype diffu
 | 
					      command diff --unified "$@" | colordiff --difftype diffu
 | 
				
			||||||
    elif (( $+commands[git] )); then
 | 
					    elif (( $+commands[git] )); then
 | 
				
			||||||
      command git --no-pager diff --color=auto --no-ext-diff --no-index "$@"
 | 
					      git --no-pager diff --color=auto --no-ext-diff --no-index "$@"
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      command diff --unified "$@"
 | 
					      command diff --unified "$@"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ function wdiff {
 | 
				
			|||||||
        "$@" \
 | 
					        "$@" \
 | 
				
			||||||
      | sed 's/^\(@@\( [+-][[:digit:]]*,[[:digit:]]*\)\{2\} @@\)$/;5;6m\10m/g'
 | 
					      | sed 's/^\(@@\( [+-][[:digit:]]*,[[:digit:]]*\)\{2\} @@\)$/;5;6m\10m/g'
 | 
				
			||||||
    elif (( $+commands[git] )); then
 | 
					    elif (( $+commands[git] )); then
 | 
				
			||||||
      command git --no-pager diff --color=auto --no-ext-diff --no-index --color-words "$@"
 | 
					      git --no-pager diff --color=auto --no-ext-diff --no-index --color-words "$@"
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      command wdiff "$@"
 | 
					      command wdiff "$@"
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user