/*
goredo -- redo implementation on pure Go
-Copyright (C) 2020 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2020-2021 Sergey Matveev <stargrave@stargrave.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
// 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
+ }
}
}
// Do we need to ifcreate it, of ifchange with renaming?
if fd == nil {
+ os.Remove(path.Join(cwdOrig, tgt))
err = ifcreate(fdDep, tgt)
if err != nil {
goto Finish