Imported Upstream version 2.5.1
[scm/test.git] / git / filter_process_status.go
1 package git
2
3 import "fmt"
4
5 // FilterProcessStatus is a constant type representing the various valid
6 // responses for `status=` in the Git filtering process protocol.
7 type FilterProcessStatus uint8
8
9 const (
10         // StatusSuccess is a valid response when a successful event has
11         // occurred.
12         StatusSuccess FilterProcessStatus = iota + 1
13         // StatusDelay is a valid response when a delay has occurred.
14         StatusDelay
15         // StatusError is a valid response when an error has occurred.
16         StatusError
17 )
18
19 // String implements fmt.Stringer by returning a protocol-compliant
20 // representation of the receiving status, or panic()-ing if the Status is
21 // unknown.
22 func (s FilterProcessStatus) String() string {
23         switch s {
24         case StatusSuccess:
25                 return "success"
26         case StatusDelay:
27                 return "delayed"
28         case StatusError:
29                 return "error"
30         }
31
32         panic(fmt.Sprintf("git: unknown FilterProcessStatus '%d'", s))
33 }