diff --git a/CHANGELOG.md b/CHANGELOG.md index 5448bbda15..9637149638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## [Unreleased] - Fix `buf plugin push --label` to allow pushing a plugin with a label. +- Add `--digest-changes-only` flag to `buf registry {module,plugin} commit list` to filter + out commits that have no digest changes. ## [v1.48.0] - 2024-12-19 diff --git a/private/buf/cmd/buf/command/registry/module/modulecommit/modulecommitlist/modulecommitlist.go b/private/buf/cmd/buf/command/registry/module/modulecommit/modulecommitlist/modulecommitlist.go index b12c7f000e..663af0436e 100644 --- a/private/buf/cmd/buf/command/registry/module/modulecommit/modulecommitlist/modulecommitlist.go +++ b/private/buf/cmd/buf/command/registry/module/modulecommit/modulecommitlist/modulecommitlist.go @@ -32,10 +32,11 @@ import ( ) const ( - pageSizeFlagName = "page-size" - pageTokenFlagName = "page-token" - reverseFlagName = "reverse" - formatFlagName = "format" + pageSizeFlagName = "page-size" + pageTokenFlagName = "page-token" + reverseFlagName = "reverse" + formatFlagName = "format" + digestChangesOnlyFlagName = "digest-changes-only" defaultPageSize = 10 ) @@ -67,10 +68,11 @@ If no reference is specified, it lists all commits in this module. } type flags struct { - Format string - PageSize uint32 - PageToken string - Reverse bool + Format string + PageSize uint32 + PageToken string + Reverse bool + DigestChangesOnly bool } func newFlags() *flags { @@ -99,6 +101,12 @@ func (f *flags) Bind(flagSet *pflag.FlagSet) { bufprint.FormatText.String(), fmt.Sprintf(`The output format to use. Must be one of %s`, bufprint.AllFormatsString), ) + flagSet.BoolVar( + &f.DigestChangesOnly, + digestChangesOnlyFlagName, + false, + `Only commits that have changed digests. By default, all commits are listed`, + ) } func run( @@ -229,7 +237,8 @@ func run( }, }, }, - Order: labelHistoryOrder, + Order: labelHistoryOrder, + OnlyCommitsWithChangedDigests: flags.DigestChangesOnly, }, ), ) diff --git a/private/buf/cmd/buf/command/registry/plugin/plugincommit/plugincommitlist/plugincommitlist.go b/private/buf/cmd/buf/command/registry/plugin/plugincommit/plugincommitlist/plugincommitlist.go index 6b16a4eb43..7b63ef4eb0 100644 --- a/private/buf/cmd/buf/command/registry/plugin/plugincommit/plugincommitlist/plugincommitlist.go +++ b/private/buf/cmd/buf/command/registry/plugin/plugincommit/plugincommitlist/plugincommitlist.go @@ -32,10 +32,11 @@ import ( ) const ( - pageSizeFlagName = "page-size" - pageTokenFlagName = "page-token" - reverseFlagName = "reverse" - formatFlagName = "format" + pageSizeFlagName = "page-size" + pageTokenFlagName = "page-token" + reverseFlagName = "reverse" + formatFlagName = "format" + digestChangesOnlyFlagName = "digest-changes-only" defaultPageSize = 10 ) @@ -67,10 +68,11 @@ If no reference is specified, it lists all commits in this plugin. } type flags struct { - Format string - PageSize uint32 - PageToken string - Reverse bool + Format string + PageSize uint32 + PageToken string + Reverse bool + DigestChangesOnly bool } func newFlags() *flags { @@ -78,17 +80,20 @@ func newFlags() *flags { } func (f *flags) Bind(flagSet *pflag.FlagSet) { - flagSet.Uint32Var(&f.PageSize, + flagSet.Uint32Var( + &f.PageSize, pageSizeFlagName, defaultPageSize, `The page size`, ) - flagSet.StringVar(&f.PageToken, + flagSet.StringVar( + &f.PageToken, pageTokenFlagName, "", `The page token. If more results are available, a "next_page" key is present in the --format=json output`, ) - flagSet.BoolVar(&f.Reverse, + flagSet.BoolVar( + &f.Reverse, reverseFlagName, false, `Reverse the results. By default, they are ordered with the newest first`, @@ -99,6 +104,12 @@ func (f *flags) Bind(flagSet *pflag.FlagSet) { bufprint.FormatText.String(), fmt.Sprintf(`The output format to use. Must be one of %s`, bufprint.AllFormatsString), ) + flagSet.BoolVar( + &f.DigestChangesOnly, + digestChangesOnlyFlagName, + false, + `Only commits that have changed digests. By default, all commits are listed`, + ) } func run( @@ -230,7 +241,8 @@ func run( }, }, }, - Order: labelHistoryOrder, + Order: labelHistoryOrder, + OnlyCommitsWithChangedDigests: flags.DigestChangesOnly, }, ), )