hookWorkingDir resolves the directory a command hook runs in. An absolute override wins; a relative override is joined onto the executor's working directory; with no override the executor's working directory is used. Falling back to the executor's working directory (rather than "", which would inher
(base, override string)
| 163 | // working_dir field (issue #2615); expansion runs before the absolute |
| 164 | // check so ~/... overrides win. |
| 165 | func hookWorkingDir(base, override string) string { |
| 166 | override = path.ExpandWorkingDir("hook working_dir", override) |
| 167 | if filepath.IsAbs(override) { |
| 168 | return override |
| 169 | } |
| 170 | if override == "" { |
| 171 | return base |
| 172 | } |
| 173 | if base == "" { |
| 174 | return override |
| 175 | } |
| 176 | return filepath.Join(base, override) |
| 177 | } |
| 178 | |
| 179 | // hookEnv layers the hook's env overrides onto the executor's env. Only |
| 180 | // the plain ${env.X} form is expanded (against the OS environment) in |
no test coverage detected