Check-in by ben on 2025-11-12 04:00:35
Fix fossil configuration parsing to allow spaces in keys and
values. Fix check for empty project-name. Default to sane value
when short-project-name is empty.
INSERTED DELETED
14 8 coprolit.awk
14 8 TOTAL over 1 changed file
Index: coprolit.awk
==================================================================
--- coprolit.awk
+++ coprolit.awk
@@ -23,17 +23,19 @@
system(cmd)
while ((getline <fsout) > 0) {
if (/^#/ || /^config/) {
# ignore comments & config lines
} else {
- k = $2
- v = $4
- sub(/^'/, "", k)
- sub(/'$/, "", k)
- sub(/^'/, "", v)
- sub(/'$/, "", v)
- arr[k] = v
+ sub(/^[0-9][0-9]* */, "")
+ if (match($0, /'[^']*'/)) {
+ k = substr($0, RSTART + 1, RLENGTH - 2)
+ $0 = substr($0, RSTART + RLENGTH + 1)
+ if (match($0, /'[^']*'/)) {
+ v = substr($0, RSTART + 1, RLENGTH - 2)
+ arr[k] = v
+ }
+ }
}
}
close(fsout)
unlink(fsout)
return
@@ -840,13 +842,17 @@
_timeline_opt = ""
}
_download_count = 0
fossil_configuration(_conf)
- if ($_conf["project-name"] == "unknown") {
+ if (length(_conf["project-name"]) == 0) {
print "Error: Could not find fossil project name"
exit 1
+ }
+ if (length(_conf["short-project-name"]) == 0) {
+ _conf["short-project-name"] = tolower(safe_filename(substr( \
+ _conf["project-name"], 1, 8)))
}
_remote = fossil_remote()
mkdir(_work)
generate_home()