How to avoid git-sync using the commit hash while syncing?

80 Views Asked by At

I have the following git-sync job:

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 as a subfolder?

enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

I think there is no way to do that based on the documentation as you mentioned as well but perhaps you can use flag --link <string\> to associate and hide the hash from direct view.

0
On

As it turns out git-sync uses the last commit hash as a folder name to sync the data to. Meaning that once you have a new commit on the repo that you are syncing (specific to the branch or tag etc. you picked) it creates a new folder with that hash. The content is synced to that folder and than symlink swapped to the folder that you specified, in the above example it is the data folder. This behaviour is there to avoid seeing partial data because symlink swapping is considered(is?) atomic.