Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [request] Save File Version Control  (Read 954 times)

LogicalDash

  • Bay Watcher
    • View Profile
[request] Save File Version Control
« 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?
Logged

DwarfStar

  • Bay Watcher
    • View Profile
Re: [request] Save File Version Control
« Reply #1 on: August 22, 2021, 01:39:07 am »

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
Logged

LogicalDash

  • Bay Watcher
    • View Profile
Re: [request] Save File Version Control
« Reply #2 on: August 22, 2021, 05:01:38 pm »

Ideally the hook would be able to write the commit message so that it has the current game date in it...
Logged

DwarfStar

  • Bay Watcher
    • View Profile
Re: [request] Save File Version Control
« Reply #3 on: August 22, 2021, 07:38:08 pm »

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.
Logged