diff --git a/commands/command_migrate.go b/commands/command_migrate.go index 9c942d5e..de01f760 100644 --- a/commands/command_migrate.go +++ b/commands/command_migrate.go @@ -206,6 +206,9 @@ func getHistoryRewriter(cmd *cobra.Command, db *odb.ObjectDatabase) *githistory. } func init() { + info := NewCommand("info", migrateInfoCommand) + info.Flags().IntVar(&migrateInfoTopN, "top", 5, "--top=") + RegisterCommand("migrate", nil, func(cmd *cobra.Command) { // Adding flags directly to cmd.Flags() doesn't apply those // flags to any subcommands of the root. Therefore, loop through @@ -216,7 +219,7 @@ func init() { // `git-lfs-migrate(1)` command as a subcommand (child). for _, subcommand := range []*cobra.Command{ - MigrateInfoCommand, + info, } { subcommand.Flags().StringVarP(&includeArg, "include", "I", "", "Include a list of paths") subcommand.Flags().StringVarP(&excludeArg, "exclude", "X", "", "Exclude a list of paths") diff --git a/commands/command_migrate_info.go b/commands/command_migrate_info.go index ea005cbe..0a39afa5 100644 --- a/commands/command_migrate_info.go +++ b/commands/command_migrate_info.go @@ -13,8 +13,6 @@ import ( "github.com/spf13/cobra" ) -var MigrateInfoCommand = NewCommand("info", migrateInfoCommand) - var ( // migrateInfoTopN is a flag given to the git-lfs-migrate(1) subcommand // 'info' which specifies how many info entries to show by default. @@ -111,7 +109,3 @@ func (e EntriesBySize) Print(to io.Writer) (int, error) { return fmt.Fprintln(to, strings.Join(output, "\n")) } - -func init() { - MigrateInfoCommand.Flags().IntVar(&migrateInfoTopN, "top", 5, "--top=") -}