2020-09-29 10:48:38 +02:00
|
|
|
package models
|
2019-03-09 16:42:10 +02:00
|
|
|
|
|
|
|
// CommitFile : A git commit file
|
|
|
|
type CommitFile struct {
|
2021-03-31 14:00:24 +02:00
|
|
|
// TODO: rename this to Path
|
2021-03-31 13:08:55 +02:00
|
|
|
Name string
|
2020-08-23 06:20:28 +02:00
|
|
|
|
|
|
|
ChangeStatus string // e.g. 'A' for added or 'M' for modified. This is based on the result from git diff --name-status
|
2019-03-09 16:42:10 +02:00
|
|
|
}
|
2020-08-22 01:01:14 +02:00
|
|
|
|
|
|
|
func (f *CommitFile) ID() string {
|
|
|
|
return f.Name
|
|
|
|
}
|
2020-08-22 02:14:53 +02:00
|
|
|
|
|
|
|
func (f *CommitFile) Description() string {
|
|
|
|
return f.Name
|
|
|
|
}
|
2023-03-12 17:45:46 +02:00
|
|
|
|
|
|
|
func (f *CommitFile) Added() bool {
|
|
|
|
return f.ChangeStatus == "A"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (f *CommitFile) Deleted() bool {
|
|
|
|
return f.ChangeStatus == "D"
|
|
|
|
}
|
2023-05-27 11:58:48 +02:00
|
|
|
|
|
|
|
func (f *CommitFile) GetPath() string {
|
|
|
|
return f.Name
|
|
|
|
}
|