Last active
March 4, 2021 20:53
-
-
Save ginkgomzd/a12e8e25e01e3dad81975d65eb3a5e9e to your computer and use it in GitHub Desktop.
Compare two directories and generate separate patch files and a list of unique files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
patch_file = "ERR" # initialize | |
patches = "patches" # dir to output patches | |
if (ENVIRON["PATCH_DIR"]) { | |
patches = ENVIRON["PATCH_DIR"] | |
} | |
system("test -d " patches " || mkdir -p " patches) | |
} | |
/^diff/ { next } | |
/Sólo en/ { next } | |
/Only in/ { next } | |
/^-{3}|+{3}/ { | |
setOutput() | |
} | |
{ | |
print $0 >> patch_file | |
} | |
function setOutput( file_path, path, new_file) { | |
file_path = $2 | |
split(file_path, path, "/") | |
new_file = patches "/" path[length(path)] ".patch" | |
if (new_file != patch_file) { | |
system("truncate --size 0 " new_file ) | |
} | |
patch_file = new_file | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
e.g.
diff -ur release/ site/ | awk -f split-diffs.awk