How do I commit in git annex on Windows (adjusted branch)

How do I commit in git annex on Windows (adjusted branch)

The datalad project have written the function datalad.support.AnnexRepo.localsync() to accomplish this. The core of that function is

def localsync(self, remote=None, managed_only=False):
    Consolidate the local git-annex branch and/or managed branches.
    This method calls `git annex sync` to perform purely local operations
    that:
    1. Update the corresponding branch of any managed branch.
    2. Synchronize the local git-annex branch with respect to particular
       or all remotes (as currently reflected in the local state of their
       remote git-annex branches).
    If a repository has git-annexs synced/... branches these will be
    updated.  Otherwise, such branches that are created by `git annex sync`
    are removed again after the sync is complete.
    [...]
    
    [...]
    cmd = [sync]
    [...]
    cmd.extend([
        # disable any external interaction and other magic
        --no-push, --no-pull, --no-commit, --no-resolvemerge,
        --no-content])
    self.call_annex(cmd)
    # a sync can establish new config (e.g. annex-uuid for a remote)
    self.config.reload()
    # cleanup synced branch if we caused it
    if not had_synced_branch and synced_branch in self.get_branches():
        lgr.debug(Remove previously non-existent %s branch after sync,
                  synced_branch)
        self.call_git(
            [branch, -d, synced_branch],
        )

so the command needed seems to be git annex sync --no-push --no-pull --no-commit --no-resolvemerge --no-content. This might generate special git annex branches whose names start with synced/…, which might also already be there from a previous sync operation. So this function deletes them if they were not already present beforehand.

How do I commit in git annex on Windows (adjusted branch)

Leave a Reply

Your email address will not be published.