iesahin / xvc

A robust (🐢) and fast (🐇) MLOps tool for managing data and pipelines in Rust (🦀)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add auto-commit functionality to stores and ec after operations

iesahin opened this issue · comments

This should be on by default, meaning all operations that affect .xvc folder should be commit automatically.

These can be configured with the config options,

core.auto-stage = True
core.auto-commit = True

These can be handled at the CLI level. After a command is run, if there are changes in .xvc/, they can be staged to Git, and commit.

If there are other staged changes, they should be stashed and reapplied. There is git stash push --staged # since 2.35 for this.

So the workflow is

if auto-commit:
   git stash push --staged
   git add .xvc
   git commit -m "Xvc changes after ..."
   git stash pop
if auto-stage:
   # we don't need to stash, simply add the changes
   git add .xvc 

These can be handled at the CLI parsing level. We can add the command line options to the commit message that way.

I checkedlibgit2, its rust port, and git implemented in pure Rust Gitoxide.

  • Gitoxide doesn't seem to have stash functionality.
  • Libgit2 doesn't provide git stash push --staged flag. It only has --keep-index in stash_save function.

With --keep-index, it may be possible to stash only the staged. We first stash everything except the staged (with --keep-index), stash everything (with default), then pop the first stash. This is a more cumbersome method than just calling git stash push --staged in the command line.

From the looks of pull requests in libgit2, I think it's better to use the command itself for this. I don't think it matters much to use Git as a library or as a standalone process call when we do it once in a command. Also, the commands themselves may better be understood by the user. Xvc should use Git like any other user.