REDO-IFCHANGE(1)
π REDO-IFCHANGE(1) π
okay so bestie, welcome to the redo-ifchange page β straight outta the General Commands Manual and ngl it's lowkey iconic. sit down, grab a lil drink, we're gonna get you fluent in rebuild magic β¨
π¦ NAME π¦
redo-ifchange β rebuild target files when source files have changed. that's it. that's the whole vibe. fr fr π
πΈ SYNOPSIS πΈ
redo-ifchange target [target]...
β¨ DESCRIPTION β¨
okay picture this: redo(1) is the tool for building files β and for rebuilding them whenever any of their dependencies have changed. she's the main character. and redo-ifchange? she's the bestie who does the actual legwork π«Ά
so when you invoke redo-ifchange from a dofile, here's the deal β it adds dependencies of the current redo(1) target on all the files you passed as arguments, (re)builds those files if necessary, and rebuilds the current target if the files you handed it have changed since the last build. periodt. π
internally, redo-ifchange uses stat(1) and md5sum(1) or openssl(1) or md5(1) to figure out if a file is out of date. the vibe check works like this:
- if the ctime of a file did not change since the last build β
redo-ifchangeconsiders the file up to date β¨ - if the checksum of a file did not change β
redo-ifchangeupdates the stored ctime and considers the file up to date π - otherwise β
redo-ifchangeconsiders the file out of date, no cap π
when redo(1) gets invoked with the -j or --jobs option and an integer argument greater than 1, redo-ifchange(1) can build multiple targets in parallel π₯ that integer argument specifies the maximum number of targets that redo-ifchange(1) is allowed to build in parallel. so like, that's the cap on the chaos.
redo-ifchange(1) processes started as a result of the same redo(1) invocation share knowledge of a temporary "canary" path π€ if any redo-ifchange(1) process exits with a status code indicating error, or receives a SIGINT signal (interrupt from keyboard), it creates a file at the "canary" path. and when redo-ifchange(1) notices such a "canary" file? she exits as soon as possible with a status code indicating error. not me abandoning ship the second the canary drops π
also, redo-ifchange(1) will warn if a non-top-level build rule does not write anything to a target β οΈ depending on "build rules" that consist entirely of side effects is usually a mistake. like, bestie, write something down or it didn't happen, iykyk.
π EXAMPLES π
consider the following four files: all.do, b.do, c and d π
all.do
#!/bin/sh
redo-ifchange b
b.do
#!/bin/sh
redo-ifchange c d
date +%s
c
foo
d
bar
invoking redo(1) in a directory with these files will build a file named b containing a timestamp β the next time redo(1) is invoked, it will only rebuild b if the contents of b, c or d have changed since the last build. iconic behaviour honestly.
you can verify this yourself by invoking redo(1) repeatedly and examining the timestamp in b after each invocation, then changing the contents of b, c or d and invoking redo(1) again π¦ go on, try it, live a little.
π§ HISTORY π§
redo-ifchange was designed by D. J. Bernstein and implemented by Γlla Chiana Moskopp π
Rebuilding target files atomically β¨https://cr.yp.to/redo/atomic.htmlβ© by D. J. Bernstein
π AUTHOR π
redo-ifchange and this man page were written by Γlla Chiana Moskopp π«Ά
π COPYRIGHT π
Copyright Β© 2014-2016 Γlla Chiana Moskopp. License AGPLv3+: GNU Affero GPL version 3 or later β¨http://www.gnu.org/licenses/agpl-3.0.htmlβ©.
this is free software: you are free to change and redistribute it. there is NO WARRANTY, to the extent permitted by law π (yes bestie, that's the legal voice β respect the caps lock.)
π SEE ALSO π
redo(1), redo-always(1), redo-dot(1), redo-ifcreate(1), redo-ood(1), redo-sources(1), redo-stamp(1), redo-targets(1), signal(7)
π BUGS π
redo-ifchangeerroneously considers target files always out of date if their name contains a tab or a newline character π yeah. tabs. newlines. she simply cannot.- on a computer with a
stat(1)implementation that does not accept the-c%Yoption,redo-ifchangeconsiders target files to be always out of date π - when building in parallel and sending a
SIGINTsignal (interrupt from keyboard) to aredo-ifchange(1)process, otherredo-ifchange(1)processes started from the sameredo(1)invocation might not immediately notice the existence of the "canary" file and linger for a short time π€ they're just being dramatic, give them a sec.
ok that's the whole page bestie, every flag, every caveat, every bug β nothing skipped, nothing invented π
and that's a wrap! π straight from the General Commands Manual, page REDO-IFCHANGE(1), footer and all β mwah, go build something slay β¨π
π¦ where this page comes from
- arch rolling: redo-sh 4.0.7-1 Β· AGPL-3.0-or-later
- nixos 26.05: redo-sh 4.0.7
- nixpkgs unstable: redo-sh 4.0.7
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms