From: Sergey Matveev Date: Tue, 15 Dec 2020 12:17:19 +0000 (+0300) Subject: $1 touching check only if file was known before X-Git-Tag: v0.6.0~5 X-Git-Url: http://www.git.cypherpunks.ru/?p=goredo.git;a=commitdiff_plain;h=679764f6a0162617a3e218384a36baf44179dd4b $1 touching check only if file was known before --- diff --git a/run.go b/run.go index 589889e..824f6c2 100644 --- a/run.go +++ b/run.go @@ -458,14 +458,16 @@ func runScript(tgtOrig string, errs chan error, traced bool) error { } // Was $1 touched? - if fd, err := os.Open(path.Join(cwdOrig, tgt)); err == nil { - ts, err := fileCtime(fd) - fd.Close() - if err == nil && ts != tsPrev { - runErr.Err = errors.New("$1 was explicitly touched") - errs <- runErr + if tsPrev != "" { + if fd, err := os.Open(path.Join(cwdOrig, tgt)); err == nil { + ts, err := fileCtime(fd) fd.Close() - return + if err == nil && ts != tsPrev { + runErr.Err = errors.New("$1 was explicitly touched") + errs <- runErr + fd.Close() + return + } } }