anarcat / bup-cron

mirror of the bup-cron repository, may be out of date while i figure out github mirror things
https://gitlab.com/anarcat/bup-cron
GNU Affero General Public License v3.0
22 stars 4 forks source link

More verbose stats / after-hook #6

Open blueyed opened 9 years ago

blueyed commented 9 years ago

It would be nice to have more detailed stats in the notes, e.g. similar to git log --dirstat=lines,cumulative,3.

Since preferences differ here, and this takes some time to generate, it would be nice to have a hook here, which would export the necessary information for an external tool / command.

This hook might not be linked to the "notes" process, but could be a generic one, allowing the user to add additional notes like suggested above (by using git notes append).

anarcat commented 9 years ago

hmm... i'm not sure i understand what --dirstat does.

having a hook makes sense, i'd be open to adding that if it's simple enough. maybe the way snapshots are extended?

blueyed commented 9 years ago

Try GIT_DIR=$repo git log --dirstat=lines,cumulative,3 $YOURBRANCH.

It shows how much has changed. I find this very useful when trying to keep the backups small.

maybe the way snapshots are extended?

I haven't looked into this yet, but it would make sense to have a similar interface probably. I would like to set something like the following in the config:

after_save=git log --dirstat=lines,cumulative,3 $branch | git notes append -F - $branch

Where GIT_DIR and BUP_DIR would be set/exported in the environment for the current repo, and $branch would be set to the current branch.

anarcat commented 9 years ago

i see. this seems like very useful stuff! but i understand why this needs to be in the notes if you can generate it afterwards anyways...

blueyed commented 9 years ago

It is quite expensive to generate, so having it generated only once is useful.

anarcat commented 9 years ago

makes sense. so maybe a --dirstat option? unless you can think of more such hooks that would be implemented?