File: git-fetch

package info (click to toggle)
yash 2.60-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,152 kB
  • sloc: ansic: 34,578; makefile: 851; sh: 808; sed: 16
file content (135 lines) | stat: -rw-r--r-- 6,349 bytes parent folder | download
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# (C) 2011-2025 magicant

# Completion script for the "git-fetch" command.
# Supports Git 2.48.1.

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

function completion/git::fetch:arg {

        OPTIONS=( #>#
        "--dry-run; don't actually fetch anything"
        "q --quiet; don't report progress"
        "--stdin; read refspecs from the standard input"
        "--submodule-prefix:" # not for command line use
        "--recurse-submodules-default::" # not for command line use
        "u --update-head-ok" # not for command line use
        "v --verbose" # TODO description
        ) #<#
        command -f completion/git::fetch:getopt

        command -f completion//parseoptions -n
        case $ARGOPT in
                (-)
                        command -f completion//completeoptions
                        ;;
                (--negotiation-tip|--recurse-submodules|--refmap| \
                        --shallow-exclude|--upload-pack)
                        command -f completion/git::$ARGOPT:arg
                        ;;
                (--recurse-submodules-default)
                        ;;
#               (--depth)
#                       ;;
                ('')
                        typeset i=2 multiple=false
                        while [ $i -le ${WORDS[#]} ]; do
                                case ${WORDS[i]} in
                                (--)
                                        i=$((i+1))
                                        break
                                        ;;
                                (--multiple)
                                        multiple=true
                                        break
                                        ;;
                                (-?*)
                                        i=$((i+1))
                                        ;;
                                (*)
                                        break
                                        ;;
                                esac
                        done
                        if $multiple || [ $i -gt ${WORDS[#]} ]; then
                                #TODO complete remote URI
                                command -f completion/git::completeremote
                                { command -vf completion/git::completeremotegroup >/dev/null 2>&1 ||
                                        . -AL completion/git-remote; } &&
                                        command -f completion/git::completeremotegroup
                        elif [ "${WORDS[-1]}" = tag ]; then
                                command -f completion/git::completeref --tags
                        else
                                typeset word="${TARGETWORD#"$PREFIX"}"
                                word=${word#+}
                                case $word in
                                (*:*) # complete local refs
                                        word=${word#*:}
                                        PREFIX=${TARGETWORD%"$word"}
                                        command -f completion/git::completeref
                                        ;;
                                (*) # complete remote refs
                                        PREFIX=${TARGETWORD%"$word"}
                                        command -f completion/git::completeremoteref "${WORDS[i]}"
                                        ;;
                                esac
                        fi
                        ;;
        esac

}

function completion/git::fetch:getopt {
        case ${gitcmd-} in
                (pull) typeset no_pull=;;
                (*)    typeset no_pull=true;;
        esac
        OPTIONS=("$OPTIONS" #>#
        "4 --ipv4; use IPv4 addresses only"
        "6 --ipv6; use IPv6 addresses only"
        "--all; fetch all remotes"
        "a --append; append to (not overwrite) existing FETCH_HEAD"
        "--atomic; update all local refs atomically"
        "${no_pull:+--auto-maintenance}; run maintenance tasks after fetching"
        "--depth:; specify the max number of history to fetch"
        "--deepen:; deepen history of shallow clone by specified number of commits"
        "f --force; allow non-fast-forward update"
        "j: --jobs:; specify the number of parallel fetches"
        "k --keep; keep downloaded pack"
        "${no_pull:+--multiple}; allow specifying multiple remotes"
        "--negotiate-only; just print ancestors of the negotiation tip"
        "--negotiation-tip:; specify a commit to start negotiation at"
        "--no-all; don't fetch all remotes"
        "${no_pull:+--no-auto-maintenance}; don't run maintenance tasks after fetching"
        "--no-recurse-submodules; don't fetch submodules"
        "--no-show-forced-updates"
        "${no_pull:+n} --no-tags; don't fetch tags automatically"
        "${no_pull:+--no-write-commit-graph}; don't write commit-graph"
        "${no_pull:+--no-write-fetch-head}; don't update FETCH_HEAD"
        "--porcelain; produce machine-readable output"
        "--prefetch; record fetched objects for future use"
        "--progress; report progress"
        "p --prune; delete remote-tracking branches that no longer exist on the remote"
        "${no_pull:+P --prune-tags}; delete local tags that no longer exist on the remote"
        "--recurse-submodules::; specify whether to fetch submodules"
        "${no_pull:+--refetch}; fetch all objects anew"
        "--refmap:; specify a local ref to receive fetched refs"
        "o: --server-option:; specify a server option"
        "--set-upstream; set upstream for the fetched ref"
        "--shallow-exclude:; resize history of shallow clone by excluding commits reachable from specified refs"
        "--shallow-since:; resize history of shallow clone to specified time"
        "--show-forced-updates"
        "t --tags; fetch all tags from the remote"
        "--unshallow; convert shallow clone to complete clone"
        "--update-shallow; accept refs that update shallow clone"
        "--upload-pack:; specify a path for git-upload-pack on the remote host"
        "${no_pull:+--write-commit-graph}; write commit-graph"
        "${no_pull:+--write-fetch-head}; update FETCH_HEAD"
        ) #<#
}


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