normalize git remotes

pull/123/head
Simon Let 6 years ago
parent e981f743bf
commit f18b3afa5c
  1. 9
      pkg/records/records.go

@ -186,6 +186,7 @@ func Enriched(r Record) EnrichedRecord {
// log.Println("Invalid command:", rec) // log.Println("Invalid command:", rec)
record.Invalid = true record.Invalid = true
} }
record.GitOriginRemote = NormalizeGitRemote(record.GitOriginRemote)
return record return record
// TODO: Detect and mark simple commands r.Simple // TODO: Detect and mark simple commands r.Simple
} }
@ -327,6 +328,14 @@ func GetCommandAndFirstWord(cmdLine string) (string, string, error) {
return "ERROR", "ERROR", errors.New("this should not happen - contact developer ;)") return "ERROR", "ERROR", errors.New("this should not happen - contact developer ;)")
} }
// NormalizeGitRomote func
func NormalizeGitRemote(gitRemote string) string {
if strings.HasSuffix(gitRemote, ".git") {
return gitRemote[:len(gitRemote)-4]
}
return gitRemote
}
// DistParams is used to supply params to Enrichedrecords.DistanceTo() // DistParams is used to supply params to Enrichedrecords.DistanceTo()
type DistParams struct { type DistParams struct {
ExitCode float64 ExitCode float64

Loading…
Cancel
Save