File: git-push

package info (click to toggle)
yash 2.50-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,036 kB
  • sloc: ansic: 33,211; makefile: 839; sh: 477; sed: 16
file content (83 lines) | stat: -rw-r--r-- 2,576 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# (C) 2011-2014 magicant

# Completion script for the "git-push" command.
# Supports Git 2.0.1.

function completion/git-push {
	WORDS=(git push "${WORDS[2,-1]}")
	command -f completion//reexecute
}

function completion/git::push:arg {

	OPTIONS=( #>#
	"--all; push all local branches"
	"--delete; delete remote refs specified as operands"
	"n --dry-run; don't actually push anything"
	"--follow-tags; push reachable annotated tags as well"
	"f --force; allow non-fast-forward update"
	"--force-with-lease::; like --force, but prevent unexpected history loss"
	"--mirror; push all local refs"
	"--no-force-with-lease; cancel the --force-with-lease option"
	"--no-thin; cancel the --thin option"
	"--no-verify; disable the pre-push hook"
	"--porcelain; print in the machine-friendly format"
	"--progress; report progress"
	"--prune; delete remote branches that have no local counterparts"
	"q --quiet; don't report progress"
	"--repo:; specify the default repository to push to"
	"--receive-pack: --exec:; specify a path for git-receive-pack on the remote host"
	"--recurse-submodules:; ensure submodule commits are available on the remote"
	"u --set-upstream; make pushed branches remote-tracking"
	"--tags; push all local tags"
	"--thin; send a thin pack to reduce traffic"
	"v --verbose" # TODO description
	"--verify; enable the pre-push hook"
	) #<#

	command -f completion//parseoptions
	case $ARGOPT in
		(-)
			command -f completion//completeoptions
			;;
		(--force-with-lease)
			typeset word="${TARGETWORD#"$PREFIX"}"
			word=${word#*:}
			PREFIX=${TARGETWORD%"$word"}
			command -f completion/git::completeref
			;;
		(--receive-pack|--exec)
			command -f completion/git::--receive-pack:arg
			;;
		(--recurse-submodules) #>>#
			complete -P "$PREFIX" -D "check if submodules have been pushed" check
			complete -P "$PREFIX" -D "push submodules as necessary" on-demand
			;; #<<#
		(--repo|'')
			command -f completion//getoperands
			if [ ${WORDS[#]} -eq 0 ]; then
				#TODO complete remote URI
				command -f completion/git::completeremote
			elif [ "${WORDS[-1]}" = tag ]; then
				command -f completion/git::completeref --tags
			else
				typeset word="${TARGETWORD#"$PREFIX"}"
				word=${word#+}
				case $word in
				(*:*) # complete remote refs
					word=${word#*:}
					PREFIX=${TARGETWORD%"$word"}
					command -f completion/git::completeremoteref "${WORDS[1]}"
					;;
				(*) # complete local refs
					PREFIX=${TARGETWORD%"$word"}
					command -f completion/git::completeref
					;;
				esac
			fi
			;;
	esac

}

# vim: set ft=sh ts=8 sts=8 sw=8 noet: