Staubgeborener / Klipper-Backup

Klipper-Backup is a script for manual or automated Klipper GitHub backups. It's Lightweight, pragmatic and comfortable.
https://klipperbackup.xyz
287 stars 56 forks source link

When backups are up to date still push an empty commit with commit message informing that a backup was ran but no changes occurred #43

Closed Tylerjet closed 9 months ago

Tylerjet commented 9 months ago

added a check for if HEAD still matches remote after attempting to commit files, if they match (no new updates) we instead create an empty commit with a message of "$commit_message - No new changes pushed", and push that to the repo.

Had a few instances where i was trying to test backup crons/jobs and keep having to change something in a file just to make sure it was actually pushing all the way to the repo. And feels like a nice little feature that you still see a commit message even if everything is up-to-date so you know jobs are running as expected at quick glance.

Tylerjet commented 9 months ago

will do the indent, as for optional feature i think it should be more of a required thing as you will want to know if your crons are not running and there is no error message from cron, it just silently fails if there is an issue.

So a user could go days without a backup and never know their crons were not running as they would just assume there were no changes to push.

So this will just ensure with no changes you still get a sort of "Hey I'm still working just fine" commit from the backup script.

but if you don't see it after like a every 4 hours script you know something might be wrong as it should be at least pushing that message every 4 hours.

Staubgeborener commented 9 months ago

Fair enough

dwzg commented 8 months ago

Please make this feature configurable. Having my backup repo polluted by empty commits is (at least for me) not desirable.

Staubgeborener commented 8 months ago

@dwzg Your words shall be heard. You can add empty_commit=no to your .env file, read the corresponding documentation for more information.

dwzg commented 8 months ago

Awesome, thanks for the quick response!