commands/command_migrate: teach how to form a history rewriter

This commit is contained in:
Taylor Blau 2017-06-09 17:41:15 -06:00
parent 547749dd3a
commit 1a67cec98d

@ -175,6 +175,15 @@ func currentRefToMigrate() (*git.Ref, error) {
return current, nil
}
// getHistoryRewriter returns a history rewriter that includes the filepath
// filter given by the --include and --exclude arguments.
func getHistoryRewriter(cmd *cobra.Command, db *odb.ObjectDatabase) *githistory.Rewriter {
include, exclude := getIncludeExcludeArgs(cmd)
filter := buildFilepathFilter(cfg, include, exclude)
return githistory.NewRewriter(db, githistory.WithFilter(filter))
}
func init() {
RegisterCommand("migrate", nil, func(cmd *cobra.Command) {
// Adding flags directly to cmd.Flags() doesn't apply those