File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed
Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -116,16 +116,25 @@ var (
116116
117117func setupStatus () {
118118 _setupStatus .Do (func () {
119- if * statusFdOpt > 0 {
120- switch * statusFdOpt {
121- case 1 :
122- statusFile = os .Stdout
123- case 2 :
124- statusFile = os .Stderr
125- default :
126- // TODO: debugging output if this fails
127- statusFile = os .NewFile (uintptr (* statusFdOpt ), "status" )
128- }
119+ if * statusFdOpt <= 0 {
120+ return
121+ }
122+
123+ const (
124+ unixStdout = 1
125+ unixStderr = 2
126+ )
127+
128+ // Even though Windows uses different numbers, we always equate 1/2 with
129+ // stdout/stderr because Git always passes `--status-fd=1`.
130+ switch * statusFdOpt {
131+ case unixStdout :
132+ statusFile = os .Stdout
133+ case unixStderr :
134+ statusFile = os .Stderr
135+ default :
136+ // TODO: debugging output if this fails
137+ statusFile = os .NewFile (uintptr (* statusFdOpt ), "status" )
129138 }
130139 })
131140}
You can’t perform that action at this time.
0 commit comments