Support shortening of revision with digest
The `\b` in the regular expression ensures we only match with a hexadecimal notation as awhole, while still allowing to match with e.g. `sha1:...` which would not have been possible by using `\W` as this includes `_`. Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
@@ -22,10 +22,11 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
|
||||
"github.com/fluxcd/flux2/internal/utils"
|
||||
)
|
||||
|
||||
var getSourceGitCmd = &cobra.Command{
|
||||
@@ -81,10 +82,8 @@ func (a *gitRepositoryListAdapter) summariseItem(i int, includeNamespace bool, i
|
||||
revision = item.GetArtifact().Revision
|
||||
}
|
||||
status, msg := statusAndMessage(item.Status.Conditions)
|
||||
if status == string(metav1.ConditionTrue) {
|
||||
revision = shortenCommitSha(revision)
|
||||
msg = shortenCommitSha(msg)
|
||||
}
|
||||
revision = utils.TruncateHex(revision)
|
||||
msg = utils.TruncateHex(msg)
|
||||
return append(nameColumns(&item, includeNamespace, includeKind),
|
||||
revision, strings.Title(strconv.FormatBool(item.Spec.Suspend)), status, msg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user