Git LFS track does not work with space and/or bracket

Hi!

This question is linked to this issue I opened on Git LFS: https://github.com/git-lfs/git-lfs/issues/2668

 

To sum it up:

I tried to push large files in LFS based on specific folders. 

My gitAttributes file contains the following lines:

Fake[[:space:]]Folder/SomeOtherFake/**/*.jpg filter=lfs diff=lfs merge=lfs -text
Fake[[:space:]]Folder/\[braketFolder\]/**/*.jpg filter=lfs diff=lfs merge=lfs -text

 

My folder hierarchy is:

Fake Folder/bigPicture.jpg
Fake Folder/SomeOtherFake/bigPicture.jpg
Fake Folder/SomeOtherFake/LastFake/bigPicture.jpg
Fake Folder/[braketFolder]/bigPicture.jpg
Fake Folder/[braketFolder]/SomeUnderBraket/bigPicture.jpg

 

When I use git with the command line, everything work fine. 

 

With SourceTree I have two problems:

1) With the space, nothing works. Regardless of the "BigPicture" file I choose, I always get the warning asking me to track it on LFS first.

2) When removing the space in the first folder, I am able to stage the "BigPicture" following files:

Fake Folder/SomeOtherFake/LastFake/bigPicture.jpg
Fake Folder/[braketFolder]/SomeUnderBraket/bigPicture.jpg

But not the follwing ones:

Fake Folder/SomeOtherFake/bigPicture.jpg
Fake Folder/[braketFolder]/bigPicture.jpg

Which is weird because the "SomeOtherFake/**/*.jpg" path should target any file directly in SomeOtherFake or in any folder under SomeOtherFake.

 

Did I miss something?

 

Thanks in advance!

Cheers!

Florian.

 

Cheers!

Florian.

2 answers

0 vote
Mike Corsaro Atlassian Team Oct 18, 2017

Hello! First, which OS are you using?

 

Second: this sounds like a bug in the way Sourcetree parses the filters. In the meantime as a work-around, you can use:

*.jpg filter=lfs diff=lfs merge=lfs -text

 to track all files with that extension

We are on Windows (some on 7 and some on 10)

 

Yep, we could do that for the .png and .jpg and some other "Picture" or "DataOnly" format.

 

 

But we are using unity asset to store gameplay data that are quite light and some 3d data that are quite heavy. We would like to push 3d data unity asset to lfs while keeping the gameplay oriented data on "normal" git.

Which, if I am not mistaking would allow us more option for working on the same asset on different post/branches...

 

To be fair, we are using lfs for the first time so we are not "expert" in why or how to do things...

 

Another surprise appear yesterday. And once again it does not happen in git bash... 

When you remove in unity some ".jpg" file which are already tracked by lfs, when you open sourcetree, they will be downloaded again... You have to open sourcetree first, then remove your files in unity, then commit the removed files on sourcetree to avoid them to be downloaded again.

I do not know if it's also a bug or if it is intended... 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

425 views 0 1
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you