Skip to content

Commit

Permalink
git: commit-graph
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Nov 1, 2023
1 parent 50ed2f9 commit 5b41841
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import (
"github.com/spf13/cobra"
)

var commit_graphCmd = &cobra.Command{
var commitGraphCmd = &cobra.Command{
Use: "commit-graph",
Short: "Write and verify Git commit-graph files",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groups[group_low_level_manipulator].ID,
}

func init() {
carapace.Gen(commit_graphCmd).Standalone()
commit_graphCmd.Flags().String("object-dir", "", "The object directory to store the graph")
rootCmd.AddCommand(commit_graphCmd)
carapace.Gen(commitGraphCmd).Standalone()

rootCmd.AddCommand(commitGraphCmd)
}
26 changes: 26 additions & 0 deletions completers/git_completer/cmd/commitGraph_verify.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var commitGraph_verifyCmd = &cobra.Command{
Use: "verify",
Short: "Read the commit-graph file and verify its contents against the object database",
Run: func(cmd *cobra.Command, args []string) {},
}

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

commitGraph_verifyCmd.Flags().Bool("no-progress", false, "Turn progress off explicitly")
commitGraph_verifyCmd.Flags().String("object-dir", "", "Use given directory for the location of packfiles and commit-graph file")
commitGraph_verifyCmd.Flags().Bool("progress", false, "Turn progress on explicitly")
commitGraph_verifyCmd.Flags().Bool("shallow", false, "Only check the tip commit-graph file in a chain of split commit-graphs")
commitGraphCmd.AddCommand(commitGraph_verifyCmd)

carapace.Gen(commitGraph_verifyCmd).FlagCompletion(carapace.ActionMap{
"object-dir": carapace.ActionDirectories(),
})
}
36 changes: 36 additions & 0 deletions completers/git_completer/cmd/commitGraph_write.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var commitGraph_writeCmd = &cobra.Command{
Use: "write",
Short: "Write a commit-graph file based on the commits found in packfiles",
Run: func(cmd *cobra.Command, args []string) {},
}

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

commitGraph_writeCmd.Flags().Bool("append", false, "Include all commits that are present in the existing commit-graph file")
commitGraph_writeCmd.Flags().Bool("changed-paths", false, "Compute and write information about the paths changed between a commit and its first parent")
commitGraph_writeCmd.Flags().String("max-new-filters", "", "Generate at most n new Bloom filters")
commitGraph_writeCmd.Flags().Bool("no-max-new-filters", false, "Do not limit Bloom filters") // TODO verify
commitGraph_writeCmd.Flags().Bool("no-progress", false, "Turn progress off explicitly")
commitGraph_writeCmd.Flags().String("object-dir", "", "Use given directory for the location of packfiles and commit-graph file")
commitGraph_writeCmd.Flags().Bool("progress", false, "Turn progress on explicitly")
commitGraph_writeCmd.Flags().Bool("reachable", false, "Generate the new commit graph by walking commits starting at all refs.")
commitGraph_writeCmd.Flags().String("split", "", "Write the commit-graph as a chain of multiple commit-graph files stored in <dir>/info/commit-graphs")
commitGraph_writeCmd.Flags().Bool("stdin-commits", false, "Generate the new commit graph by walking commits starting at the commits specified in stdin as a list of OIDs in hex, one OID per line")
commitGraph_writeCmd.Flags().Bool("stdin-packs", false, "Generate the new commit graph by walking objects only in the specified pack-indexe")
commitGraphCmd.AddCommand(commitGraph_writeCmd)

commitGraph_writeCmd.MarkFlagsMutuallyExclusive("reachable", "stdin-packs", "stdin-commits")

carapace.Gen(commitGraph_writeCmd).FlagCompletion(carapace.ActionMap{
"object-dir": carapace.ActionDirectories(),
"split": carapace.ActionValues("no-merge", "replace"),
})
}

0 comments on commit 5b41841

Please sign in to comment.