denis-stepanov/advent

Support for `db-djv-pg` operations under Git control

denis-stepanov opened this issue · 1 comments

Some db-djv-pg commands, such as export or rename modify the file system. Any serious database snapshot would normally be under version control. Hence, it would be nice that the tool informs Git of the changes made (i.e., stages the change), so that the user would not need to retrofit them manually (which could be a bit tricky, like in the case of rename). It is suggested to add --git flag to such commands (not active by default) which would call the relevant Git commands whenever needed.

Done, with the following remarks:

  1. instead of --git, an autodetect of git repo is implemented, and a reverse option --no-git provided to inhibit it
  2. only rename is currently affected, and it will do git mv, edit followed by git add. export will create new unstaged files which corresponds to regular git behavior wrt new files. delete currently does not support file operations, so no action. Other commands do not modify file system
  3. rename operation will print STAGED on successful run indicating that git has been informed of the change