Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git: filter-branch #1597

Merged
merged 1 commit into from
Mar 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions completers/git_completer/cmd/filterBranch.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package cmd

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

var filterBranchCmd = &cobra.Command{
Use: "filter-branch",
Short: "Rewrite branches",
Run: func(cmd *cobra.Command, args []string) {},
GroupID: groups[group_manipulator].ID,
}

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

filterBranchCmd.Flags().String("commit-filter", "", "This is the filter for performing the commit")
filterBranchCmd.Flags().StringS("d", "d", "", "Use this option to set the path to the temporary directory used for rewriting")
filterBranchCmd.Flags().String("env-filter", "", "This filter may be used if you only need to modify the environment in which the commit will be performed")
filterBranchCmd.Flags().BoolP("force", "f", false, "Force to start with an existing temporary directory or when there are already refs starting with refs/original/")
filterBranchCmd.Flags().String("index-filter", "", "This is the filter for rewriting the index")
filterBranchCmd.Flags().String("msg-filter", "", "This is the filter for rewriting the commit messages")
filterBranchCmd.Flags().String("original", "", "Use this option to set the namespace where the original commits will be stored")
filterBranchCmd.Flags().String("parent-filter", "", "This is the filter for rewriting the commit’s parent list")
filterBranchCmd.Flags().Bool("prune-empty", false, "Some filters will generate empty commits that leave the tree untouched")
filterBranchCmd.Flags().String("setup", "", "This is not a real filter executed for each commit but a one time setup just before the loop")
filterBranchCmd.Flags().String("state-branch", "", "This option will cause the mapping from old to new objects to be loaded from named branch")
filterBranchCmd.Flags().String("subdirectory-filter", "", "Only look at the history which touches the given subdirectory")
filterBranchCmd.Flags().String("tag-name-filter", "", "This is the filter for rewriting tag names")
filterBranchCmd.Flags().String("tree-filter", "", "This is the filter for rewriting the tree and its contents")
rootCmd.AddCommand(filterBranchCmd)

carapace.Gen(filterBranchCmd).FlagCompletion(carapace.ActionMap{
"d": carapace.ActionDirectories(),
"state-branch": git.ActionLocalBranches(),
"subdirectory-filter": carapace.ActionDirectories(),
})

carapace.Gen(filterBranchCmd).DashAnyCompletion(
bridge.ActionCarapaceBin("git", "rev-list"),
)
}
17 changes: 0 additions & 17 deletions completers/git_completer/cmd/filter_branch_generated.go

This file was deleted.