X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=ifchange.go;h=f89da48fc7d1dbe9b733c1e679fd8a4044760aa7;hb=f85b073ee154a49bbd7ca0b6b2a68add4968700c;hp=f0e877ef22c78da9f88f583b57d23bd244fe261d;hpb=573c4cabcbb8e4bf6a90d0f19a440af92b9cef6d;p=goredo.git diff --git a/ifchange.go b/ifchange.go index f0e877e..f89da48 100644 --- a/ifchange.go +++ b/ifchange.go @@ -1,6 +1,6 @@ /* -goredo -- redo implementation on pure Go -Copyright (C) 2020 Sergey Matveev +goredo -- djb's redo implementation on pure Go +Copyright (C) 2020-2021 Sergey Matveev 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 @@ -83,9 +83,11 @@ func buildDependants(tgts []string) map[string]struct{} { trace(CDebug, "collecting deps") seen := map[string]struct{}{} deps := map[string]map[string]struct{}{} - for _, tgt := range tgts { - for _, tgt := range collectDeps(Cwd, tgt, 0, deps) { - seen[tgt] = struct{}{} + for _, tgtInitial := range tgts { + for _, tgt := range collectDeps(Cwd, tgtInitial, 0, deps) { + if tgt != tgtInitial { + seen[tgt] = struct{}{} + } } } if len(seen) == 0 { @@ -112,7 +114,7 @@ func buildDependants(tgts []string) map[string]struct{} { Jobs.Wait() close(errs) if !ok { - trace(CDebug, "alwayses failed, skipping depdendants") + trace(CDebug, "alwayses failed, skipping dependants") return nil } @@ -181,7 +183,7 @@ func ifchange(tgts []string, forced, traced bool) (bool, error) { var err error for _, tgt := range tgts { if _, ok := seen[tgt]; ok { - trace(CDebug, "%s was already build as a dependenant", tgt) + trace(CDebug, "%s was already build as a dependant", tgt) continue } ood = true