do.go | 3 --- doc/INSTALL | 2 +- doc/NEWS | 5 +++++ doc/Rules | 4 +++- ood.go | 12 ++---------- run.go | 13 ------------- t/goredo-already-existing.t | 24 ------------------------ t/goredo-externally-modified.t | 25 +++++++++++++++++++++++++ usage.go | 2 +- diff --git a/do.go b/do.go index edacb328582c61b7826c1d626c571870975774c32864d49e089bb81e1702290e..30f544f903b56af3c488f05a5025312280a78d851fcaf132a75b6e503c61c3cb 100644 --- a/do.go +++ b/do.go @@ -34,9 +34,6 @@ func existsDo(w io.Writer, fdDepName, cwd, pth string) (bool, error) { if FileExists(path.Join(cwd, pth)) { return true, nil } - if w == nil { - return false, nil - } return false, ifcreate(w, fdDepName, pth) } diff --git a/doc/INSTALL b/doc/INSTALL index 1d49311af23def4d1f040f8bc41fd6ac685b5aa7bcf87f5acaca49b0061f6768..0fe476468fce5e1750b521f1ccc812b428db7c941c202e5d7563f2bbdfe8aa54 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -11,7 +11,7 @@ => https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name/go/goredo NixOS packages Preferable way is to [Download] tarball with the signature from website: - $ v=2.9.2 + $ v=2.10.0 $ fetch http://www.goredo.stargrave.org/download/goredo-$v.tar.zst $ fetch http://www.goredo.stargrave.org/download/goredo-$v.tar.zst.{sig,cm} [Integrity] verify diff --git a/doc/NEWS b/doc/NEWS index 19fa8d6540562927b99616e2cd0f7c6806212e21b9e847148bc51ef340f80ae9..b0cfc0adbb056815dfd1ad48b67598896e6a1dea00ef630c6d2a7acd7d27c4b4 100644 --- a/doc/NEWS +++ b/doc/NEWS @@ -1,3 +1,8 @@ +A 2.10.0 +2.10.0 + * Treat all existing files without correponding .dep as a + source files. + A 2.9.2 2.9.2 * Change Go's module namespace and related dependencies from diff --git a/doc/Rules b/doc/Rules index 9cda1a6a78af9e11d81c4064a79256d779705c41e87872f6c5725fef8a1957ab..bee85d5d558fb2d013f525c05a6e89bc18b3e6b37aec170b0ad289a4d0bdf5a0 100644 --- a/doc/Rules +++ b/doc/Rules @@ -1,3 +1,5 @@ +* Source file is already existing file created outside redo's control. + * Target is the single file. Target's result probably won't create file at all. @@ -35,7 +37,7 @@ * .do file search goes up to / by default, but can be limited with either $REDO_TOP_DIR environment variable, or by having .redo/top file in it. -* .do runs in the same directory where it is placed. +* .do runs in the same directory where it is located. * .do runs with the three arguments: * $1 -- name of the target. diff --git a/ood.go b/ood.go index 57dd301e5c4b1bd2c0239994a35718472fa7031226e5a9b21f1063160c485627..65a209558e14e7c16900d1e9a656482f755b81420c286923dcc57265e0faee67 100644 --- a/ood.go +++ b/ood.go @@ -25,7 +25,6 @@ "io" "io/fs" "log" "os" - "path" "strings" "golang.org/x/sys/unix" @@ -72,14 +71,10 @@ return fmt.Sprintf("%s: %s", e.Tgt, e.Err) } func isSrc(tgt *Tgt) bool { - if !FileExists(tgt.a) { - return false - } - tgtH, tgtT := pathSplit(tgt.a) - if do, _, _ := findDo(nil, tgt.a, tgtH, tgtT); do != "" { + if FileExists(tgt.dep) { return false } - return true + return FileExists(tgt.a) } func isOODByBuildUUID(tgt *Tgt) bool { @@ -104,9 +99,6 @@ if errors.Is(err, fs.ErrNotExist) { if isSrc(tgt) { ood = false tracef(CDebug, "ood: %s%s -> is source", indent, tgt) - } else if path.Ext(tgt.a) == ".do" { - ood = false - tracef(CDebug, "ood: %s%s -> is .do", indent, tgt) } else { ood = true tracef(CDebug, "ood: %s%s -> no dep: %s", indent, tgt, tgt.dep) diff --git a/run.go b/run.go index 7ab143f0a98dbb7aed80a85855205b5b353371bfe7a6a913c6b42769d414711a..3f19556907a36c2fb4191934a60491edc95b2e77c016d4fbc7caf6c90b9a992f 100644 --- a/run.go +++ b/run.go @@ -300,19 +300,6 @@ Jobs.Done() }() return nil } - if inodePrev == nil && FileExists(tgt.a) { - lockRelease() - if StopIfMod { - return fmt.Errorf("%s already existing", tgt) - } - Jobs.Add(1) - tracef(CWarn, "%s: already existing: not redoing", tgt) - go func() { - errs <- nil - Jobs.Done() - }() - return nil - } dep = nil // Start preparing .dep diff --git a/t/goredo-already-existing.t b/t/goredo-already-existing.t deleted file mode 100755 index fb358f6c51cd8b4bde8eb6c0adfe32a7de136ca4127a34c0acd51bbf19b5281c..0000000000000000000000000000000000000000 --- a/t/goredo-already-existing.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -test_description="Check failing if \$1 already exists" -. $SHARNESS_TEST_SRCDIR/sharness.sh -export REDO_TOP_DIR="`pwd`" REDO_NO_PROGRESS=1 - -echo echo ok >foo.do -touch foo -test_expect_success "does not fail" "redo foo 2>out" -test_expect_success "message" 'grep -q "already existing" out' - -export REDO_STOP_IF_MODIFIED=1 -test_expect_success "must fail" 'redo foo 2>out ; [ $? = 1 ]' -unset REDO_STOP_IF_MODIFIED -test_expect_success "message" 'grep -q "already existing" out' - -rm foo -test_expect_success "ok" "redo foo" - -echo overwrite >foo -test_expect_success "externally modified" "redo foo 2>out" -test_expect_success "message" 'grep -q "externally modified" out' - -test_done diff --git a/t/goredo-externally-modified.t b/t/goredo-externally-modified.t new file mode 100755 index 0000000000000000000000000000000000000000..254f50ca23a1652fc3da4c9d2463d2109c439ccc85961ce562c2e6b5df5d39ce --- /dev/null +++ b/t/goredo-externally-modified.t @@ -0,0 +1,25 @@ +#!/bin/sh + +test_description="Check externally modified" +. $SHARNESS_TEST_SRCDIR/sharness.sh +export REDO_TOP_DIR="`pwd`" REDO_NO_PROGRESS=1 + +echo echo ok >foo.do +redo foo +echo >foo +test_expect_success "does not fail" "redo foo 2>out" +test_expect_success "message" 'grep -q "externally modified" out' + +export REDO_STOP_IF_MODIFIED=1 +test_expect_success "must fail" 'redo foo 2>out ; [ $? = 1 ]' +unset REDO_STOP_IF_MODIFIED +test_expect_success "message" 'grep -q "externally modified" out' + +rm foo +test_expect_success "ok" "redo foo" + +echo overwrite >foo +test_expect_success "externally modified" "redo foo 2>out" +test_expect_success "message" 'grep -q "externally modified" out' + +test_done diff --git a/usage.go b/usage.go index 624f913d008f0ddeeeccee48d86f891f246987aca84b67b62c66d91d324789a1..d739f8f77033179e30e22b65258e916a85b0b038756cac307330a9a080381043 100644 --- a/usage.go +++ b/usage.go @@ -24,7 +24,7 @@ "strings" ) const ( - Version = "2.9.2" + Version = "2.10.0" Warranty = `Copyright (C) 2020-2026 Sergey Matveev This program is free software: you can redistribute it and/or modify