kubernetes / git-sync

A sidecar app which clones a git repo and keeps it in sync with the upstream.
Apache License 2.0
2.22k stars 411 forks source link

How to disable commit hash in the target folder? #854

Closed l1x closed 9 months ago

l1x commented 9 months ago

I have to following setup:

git-sync --repo https://dev.azure.com/..../repo \
--root /tmp/git/data --dest data --one-time \
--branch master --max-sync-failures 5 \
--password-file /opt/.git-sync-pass --add-user true --depth 1

For some reason this results in a data/9cb27e1a1eb90c2832c22447c5a88085f132e62d/..... The last commit hash is included in the path.

Is there a way to influence this behaviour so that the commit hash is not showing up in the folder?

thockin commented 9 months ago

The hash is how we do atomic updates, and how we know what we think we have already (in case of a crash or a long-lived volume). When upstream changes, we sync, prepare a new worktree, then flip the link.

Otherwise your client might see a tree that is half updated in the middle of a pull.

Instead of accessing it via the hash directory, you can use the symlink, which should always point to the latest hash).

l1x commented 9 months ago

Thanks Tim!