()
| 38 | } |
| 39 | |
| 40 | func (s Status) String() string { |
| 41 | buf := bytes.NewBuffer(nil) |
| 42 | for path, status := range s { |
| 43 | if status.Staging == Unmodified && status.Worktree == Unmodified { |
| 44 | continue |
| 45 | } |
| 46 | |
| 47 | if status.Staging == Renamed { |
| 48 | path = fmt.Sprintf("%s -> %s", path, status.Extra) |
| 49 | } |
| 50 | |
| 51 | fmt.Fprintf(buf, "%c%c %s\n", status.Staging, status.Worktree, path) |
| 52 | } |
| 53 | |
| 54 | return buf.String() |
| 55 | } |
| 56 | |
| 57 | // FileStatus contains the status of a file in the worktree |
| 58 | type FileStatus struct { |