-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
pull.go
108 lines (102 loc) · 6.34 KB
/
pull.go
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
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/pkg/actions/tools/git"
"github.com/carapace-sh/carapace/pkg/style"
"github.com/spf13/cobra"
)
var pullCmd = &cobra.Command{
Use: "pull",
Short: "Fetch from and integrate with another repository or a local branch",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groups[group_main].ID,
}
func init() {
carapace.Gen(pullCmd).Standalone()
pullCmd.Flags().Bool("all", false, "fetch from all remotes")
pullCmd.Flags().Bool("allow-unrelated-histories", false, "allow merging unrelated histories")
pullCmd.Flags().BoolP("append", "a", false, "append to .git/FETCH_HEAD instead of overwriting")
pullCmd.Flags().Bool("autostash", false, "automatically stash/stash pop before and after")
pullCmd.Flags().String("cleanup", "", "how to strip spaces and #comments from message")
pullCmd.Flags().Bool("commit", false, "perform a commit if the merge succeeds (default)")
pullCmd.Flags().String("deepen", "", "deepen history of shallow clone")
pullCmd.Flags().String("depth", "", "deepen history of shallow clone")
pullCmd.Flags().Bool("dry-run", false, "dry run")
pullCmd.Flags().Bool("edit", false, "edit message before committing")
pullCmd.Flags().Bool("ff", false, "allow fast-forward")
pullCmd.Flags().Bool("ff-only", false, "abort if fast-forward is not possible")
pullCmd.Flags().BoolP("force", "f", false, "force overwrite of local branch")
pullCmd.Flags().StringP("gpg-sign", "S", "", "GPG sign commit")
pullCmd.Flags().BoolP("ipv4", "4", false, "use IPv4 addresses only")
pullCmd.Flags().BoolP("ipv6", "6", false, "use IPv6 addresses only")
pullCmd.Flags().StringP("jobs", "j", "", "number of submodules pulled in parallel")
pullCmd.Flags().BoolP("keep", "k", false, "keep downloaded pack")
pullCmd.Flags().String("log", "", "add (at most <n>) entries from shortlog to merge commit message")
pullCmd.Flags().BoolS("n", "n", false, "do not show a diffstat at the end of the merge")
pullCmd.Flags().String("negotiation-tip", "", "report that we have only objects reachable from this object")
pullCmd.Flags().Bool("no-commit", false, "perform the merge but do not commit the result")
pullCmd.Flags().Bool("no-edit", false, "don't open an editor to change the commit message")
pullCmd.Flags().Bool("no-ff", false, "generate a merge commit even if the merge resol") // TODO
pullCmd.Flags().Bool("no-gpg-sign", false, "don't GPG-sign the commit")
pullCmd.Flags().Bool("no-log", false, "do not list one-line descriptions of the commit")
pullCmd.Flags().Bool("no-rebase", false, "do not perform a rebase after fetching")
pullCmd.Flags().Bool("no-recurse-submodules", false, "disable recursive fetching of submodules")
pullCmd.Flags().Bool("no-squash", false, "merge and commit")
pullCmd.Flags().Bool("no-stat", false, "do not show diffstat at the end of the merge")
pullCmd.Flags().Bool("no-tags", false, "disable automatic tag following")
pullCmd.Flags().Bool("no-verify-signatures", false, "do not verify the commits being merged")
pullCmd.Flags().Bool("progress", false, "force progress reporting")
pullCmd.Flags().BoolP("prune", "p", false, "prune remote-tracking branches no longer on remote")
pullCmd.Flags().BoolP("quiet", "q", false, "be more quiet")
pullCmd.Flags().StringP("rebase", "r", "", "incorporate changes by rebasing rather than merging")
pullCmd.Flags().String("recurse-submodules", "", "control for recursive fetching of submodules")
pullCmd.Flags().Bool("recurse-submodules-default", false, "provide internal temporary non-negative value f") // TODO
pullCmd.Flags().String("refmap", "", "specify fetch refmap")
pullCmd.Flags().StringP("server-option", "o", "", "option to transmit")
pullCmd.Flags().Bool("set-upstream", false, "set upstream for git pull/fetch")
pullCmd.Flags().String("shallow-exclude", "", "deepen history of shallow clone, excluding rev")
pullCmd.Flags().String("shallow-since", "", "deepen history of shallow repository based on time")
pullCmd.Flags().Bool("show-forced-updates", false, "check for forced-updates on all updated branches")
pullCmd.Flags().String("signoff", "", "add Signed-off-by:")
pullCmd.Flags().Bool("squash", false, "create a single commit instead of doing a merge")
pullCmd.Flags().Bool("stat", false, "show a diffstat at the end of the merge")
pullCmd.Flags().StringP("strategy", "s", "", "merge strategy to use")
pullCmd.Flags().StringP("strategy-option", "X", "", "option for selected merge strategy")
pullCmd.Flags().Bool("submodule-prefix", false, "prepend <path> to paths printed in informative")
pullCmd.Flags().BoolP("tags", "t", false, "fetch all tags and associated objects")
pullCmd.Flags().Bool("unshallow", false, "convert to a complete repository")
pullCmd.Flags().BoolP("update-head-ok", "u", false, "allow updates of current branch head")
pullCmd.Flags().Bool("update-shallow", false, "accept refs that update .git/shallow")
pullCmd.Flags().String("upload-pack", "", "path to upload pack on remote end")
pullCmd.Flags().BoolP("verbose", "v", false, "be more verbose")
pullCmd.Flags().Bool("verify-signatures", false, "verify that the named commit has a valid GPG signature")
rootCmd.AddCommand(pullCmd)
carapace.Gen(pullCmd).FlagCompletion(carapace.ActionMap{
"cleanup": carapace.ActionValuesDescribed(
"default", "act as 'strip' if the message is to be edited and as 'whitespace' otherwise",
"scissors", "same as whitespace but cut from scissor line",
"strip", "remove both whitespace and commentary lines",
"verbatim", "don't change the commit message at all",
"whitespace", "remove leading and trailing whitespace lines",
),
"rebase": carapace.ActionValuesDescribed(
"false", "merge after fetching",
"interactive", "allow list of commits to be edited",
"merges", "try to rebase merges instead of skipping them",
"preserve", "rebase and preserve merges",
"true", "rebase after fetching",
),
"recurse-submodules": carapace.ActionValuesDescribed(
"no", "disable recursion",
"on-demand", "only when submodule reference in superproject is updated",
"yes", "always recurse",
).StyleF(style.ForKeyword),
"strategy": carapace.ActionValues("octopus", "ours", "recursive", "resolve", "subtree"),
})
carapace.Gen(pullCmd).PositionalCompletion(
git.ActionRemotes(),
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return git.ActionRemoteBranches(c.Args[0])
}),
)
}