Skip to content

Commit

Permalink
Merge pull request #1964 from rsteube/git-fetchpack
Browse files Browse the repository at this point in the history
git: fetch-pack
  • Loading branch information
rsteube authored Nov 1, 2023
2 parents 93bc4ea + 4e2f701 commit dbd33d1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 19 deletions.
56 changes: 56 additions & 0 deletions completers/git_completer/cmd/fetchPack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/time"
"github.com/rsteube/carapace-bin/pkg/actions/tools/git"
"github.com/spf13/cobra"
)

var fetchPackCmd = &cobra.Command{
Use: "fetch-pack",
Short: "Receive missing objects from another repository",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groups[group_low_level_synching].ID,
}

func init() {
carapace.Gen(fetchPackCmd).Standalone()

fetchPackCmd.Flags().Bool("all", false, "Fetch all remote refs")
fetchPackCmd.Flags().Bool("check-self-contained-and-connected", false, "Output \"connectivity-ok\" if the received pack is self-contained and connected")
fetchPackCmd.Flags().Bool("deepen-relative", false, "Argument --depth specifies the number of commits from the current shallow boundary instead of from the tip of each remote branch history")
fetchPackCmd.Flags().String("depth", "", "Limit fetching to ancestor-chains not longer than n")
fetchPackCmd.Flags().String("exec", "", "Same as --upload-pack=<git-upload-pack>")
fetchPackCmd.Flags().Bool("include-tag", false, "If the remote side supports it, annotated tags objects will be downloaded on the same connection")
fetchPackCmd.Flags().BoolP("keep", "k", false, "Do not invoke git unpack-objects on received data, but create a single packfile out of it instead")
fetchPackCmd.Flags().Bool("no-progress", false, "Do not show the progress")
fetchPackCmd.Flags().BoolP("quiet", "q", false, "Pass -q flag to git unpack-objects; this makes the cloning process less verbose")
fetchPackCmd.Flags().Bool("refetch", false, "Skips negotiating commits with the server in order to fetch all matching objects")
fetchPackCmd.Flags().String("shallow-exclude", "", "Deepen or shorten the history of a shallow repository to exclude commits reachable from a specified remote branch or tag")
fetchPackCmd.Flags().String("shallow-since", "", "Deepen or shorten the history of a shallow repository to include all reachable commits after <date>")
fetchPackCmd.Flags().Bool("stdin", false, "Take the list of refs from stdin, one per line")
fetchPackCmd.Flags().Bool("thin", false, "Fetch a \"thin\" pack, which records objects in deltified form based on objects not included in the pack")
fetchPackCmd.Flags().String("upload-pack", "", "Use this to specify the path to git-upload-pack on the remote side, if is not found on your $PATH")
fetchPackCmd.Flags().BoolS("v", "v", false, "Run verbosely")
rootCmd.AddCommand(fetchPackCmd)

carapace.Gen(fetchPackCmd).FlagCompletion(carapace.ActionMap{
"shallow-exclude": git.ActionRefs(git.RefOption{}.Default()),
"shallow-since": time.ActionDate(),
})

carapace.Gen(fetchPackCmd).PositionalCompletion(
git.ActionRepositorySearch(git.SearchOpts{}.Default()),
)

carapace.Gen(fetchPackCmd).PositionalAnyCompletion(
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return git.ActionLsRemoteRefs(git.LsRemoteRefOption{
Url: c.Args[0],
Branches: true,
Tags: true,
})
}),
)
}
19 changes: 0 additions & 19 deletions completers/git_completer/cmd/fetch_pack_generated.go

This file was deleted.

0 comments on commit dbd33d1

Please sign in to comment.