0

When I use jfrog rt glc it wants to delete all of the artifacts in the gitlfs repo in artifactory. But I have still one file in the local git repo!

E:\test-scripts>jfrog rt glc
[Info] Searching files from Artifactory repository lfs-local …
[Info] Collecting files to preserve from Git references matching the pattern refs/remotes/* …
[Info] Found 0 files to keep, and 3 to clean
4ee3d767d9126308d6bcf7b7290e85614a83fe51a9d84e765b9b7f4359f79fce
118feab626439e11e6ef3d3d12b3d297c0cccffaf2e34e5b5be7e4276c28678c
cbeffb41253da58f8924423f22a9bd53802633925664d68c46e6bfffd506a33d
Are you sure you want to delete the above files? (y/n):

E:\test-scripts>git lfs ls-files
4ee3d767d9 * xmlstarlet-1.6.1-win32.zip

jfrog rt glc is not looking for the right directory!

git lfs places the artifacts in the directory lfs\objects* and not in refs/remotes/*

The command jfrog rt glc --refs='.git\lfs\objects*' gives the same output.

dir .git\lfs\objects* /s E:\test-scripts.git\lfs\objects\4e\e3 4ee3d767d9126308d6bcf7b7290e85614a83fe51a9d84e765b9b7f4359f79fce

There is still 1 file in '.git\lfs\objects*'

Anyone experience with this?

meedel
  • 21
  • 2
  • Even with the command jfrog rt glc --refs='.git\lfs\objects\*' it wants to clean all the artifacts. – meedel Aug 10 '18 at 11:41
  • dir .git\lfs\objects\* /s E:\test-scripts\.git\lfs\objects\4e\e3 4ee3d767d9126308d6bcf7b7290e85614a83fe51a9d84e765b9b7f4359f79fce E:\test-scripts>jfrog rt glc --refs='.git\lfs\objects\*' [Info] Searching files from Artifactory repository lfs-local ... [Info] Collecting files to preserve from Git references matching the pattern '.git\lfs\objects\*' [Info] Found 0 files to keep, and 3 to clean 4ee3d767d9126308d6bcf7b7290e85614a83fe51a9d84e765b9b7f4359f79fce 118feab626439e11e6ef3d3d12b3d297c0cccffaf2e34e5b5be7e4276c28678c cbeffb41253da58f8924423f22a9bd53802633925664d68c46e6bfffd506a33d – meedel Aug 10 '18 at 11:49
  • Isn't that the same output? Can you edit that into the question please, where you can format it better, rather than posting as a comment. I used a quote format above, and had to add extra spaces to ends of lines to trigger line breaks, but formatting it as code (there's a button) is probably simpler, and does monospace and line breaks automatically for you too. – Rup Aug 10 '18 at 11:56

2 Answers2

1

jfrog rt glc is not looking for the right directory!

git lfs places the artifacts in the directory lfs\objects* and not in refs/remotes/*

That's not how the command works. It doesn't look for objects in .git/lfs/objects or .git/refs/remotes. Here's what it does do:

  1. It looks in your .lfsconfig for a remote LFS server URL (this is presumably an LFS repository on the Artifactory server your CLI is connected to). It downloads the list of object hashes contained in that repository.
  2. It searches the heads of all your Git refs located in refs/remotes/* (so, it searches all your remote tracking branches) for LFS objects. This does not mean it searches that directory for objects. The .git/refs/remotes directory contains names of Git branches, and the command searches those branches.
  3. It compares the list of LFS objects found on the Artifactory server to the list of objects found in your Git remote tracking branches. It prepares to delete the objects from the Artifactory server that were not also found in the tracking branches.

When you run git lfs ls-files, it searches the current local branch. If you're getting an object back from that command that rt glc wants to delete, it's because either your local branch isn't current, or you haven't pushed your changes upstream.

If you would like rt glc to keep artifacts it finds in both your remote tracking and your local branches, you can pass the option --refs=refs/remotes/*,refs/heads/*

Community
  • 1
  • 1
DarthFennec
  • 2,650
  • 17
  • 24
0

I found the 'mismatch'

The command jfrog rt glc 'defaults' the reference pattern matching to unix directory notation ( / )

So for windows you have to use the --refs=refs\remotes* variable to get the right information ( \ )

jfrog.exe = jfrog version 1.18.0

meedel
  • 21
  • 2