Bay 12 Games Forum
Dwarf Fortress => DF Modding => Topic started by: LogicalDash on August 21, 2021, 12:37:07 pm
-
One of the nice things about using uncompressed saves is that I can keep them under version control, and thus have a branching history of my fortress. This is inconvenient, though, because I have to either manually run git commit -a every time I save, or else set up some cron job or whatever to do it for me, potentially causing lossage if I save a lot in a short period of time.
Could there be a dfhack script to run git commit -a for me whenever I save?
-
I take it you're playing the Linux version? I'm no expert, but I came up with this with a bit of googling. Apparently you might be able to use something called inotifywait to automatically commit your files based on the files being changed on disk.
https://stackoverflow.com/questions/420143/making-git-auto-commit
-
Ideally the hook would be able to write the commit message so that it has the current game date in it...
-
The DFHack quicksave command is implemented as a Lua script. There's probably some way to modify it to trigger the git commit after the save is done, and to retrieve the current game date in the process.