Reputation: 2254
So I am doing a proof of concept of LFS in VSTS for work and am having an unusual issue. I'm having a hard time PROVING its doing what it's supposed to be doing. Basically I followed the instructions for adding the .gitattributes file
Contents of .gitattributes
*.pdf filter=lfs diff=lfs merge=lfs -text
Then I added a pdf file at the root and commit
git add ./3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
git commit -m "some comment"
output: [Master_Copy_LFSTest 738f4a6] some comment
1 file changed, 3 insertions(+)
create mode 100644 3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
Now at this point I do have the local .git\lfs\objects\xx\xx\bunchoftext that indeed seems to be my file, tested by moving and renaming back to pdf and opening.
However there is still the full file in the local repo root, not the 3 line pointer file. Now at this point I push the repo.
git push origin Master_Copy_LFSTest
Locking support detected on remote "origin". Consider enabling it with:
$ git config
lfs.https://xxxxxxxx.visualstudio.com/xxxxxx/_git/xxxxx.git/info/lfs.locksverify true
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s
Uploading LFS objects: 100% (1/1), 25 MB | 0 B/s
Uploading LFS objects: 100% (1/1), 25 MB | 0 B/s, done
git : To https://xxxxxxx.visualstudio.com/xxxxxxx/_git/xxxxxx
At line:1 char:1
+ git push origin Master_Copy_LFSTest
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (To https://xxxx.../_git/xxxxxx:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
58a347c..738f4a6 Master_Copy_LFSTest -> Master_Copy_LFSTest
Which kind of looks like it worked but obviously something has happened to get the NotSpecified error.
So it "seems" like it worked but I cant actually tell.
If I go into the code files viewer for the branch in vsts and click the pdf file it loads the binary into the viewer which I would not expect, I thought I would see the three line pointer file. This is the output from show
git show 738f4a6
commit 738f4a6bc8a87ce34ab2352bb58a0a44c96be48a
Author: Paul <[email protected]>
Date: Thu Jul 19 13:53:37 2018 -0400
some comment
diff --git a/3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf b/3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
new file mode 100644
index 0000000..4179d33
--- /dev/null
+++ b/3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c7aed7138ea8a2f6eda3e22992a52329d2b945c119a517c02056bf8379b92f36
+size 24590383
git lfs ls-files
c7aed7138e * 3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
But the thing that really gets me is that if I do a VSTS build and DO NOT check the box for Checkout files from LFS in the get sources step I STILL get the pdf file in the output (one of the project files references it to always copy to output). If this was REALLY working I would have through I would get the pointer file, not the real pdf.
Here is a command dump from a second attempt
PM> git lfs track "*.pdf"
Tracking "*.pdf"
PM> git lfs ls-files
PM> git lfs ls-files
PM> git add .
PM> git lfs ls-files
e545334f11 * 1.pdf
PM> git commit -m "added file for lfs"
[master_bugs 3840795] added file for lfs
1 file changed, 3 insertions(+)
create mode 100644 1.pdf
PM> git push origin master_bugs
Locking support detected on remote "origin". Consider enabling it with:
$ git config lfs.https://xxxxxxxxx.visualstudio.com/xxxxxx/_git/xxxxx.git/info/lfs.locksverify true
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s
Uploading LFS objects: 100% (1/1), 2.7 MB | 0 B/s
Uploading LFS objects: 100% (1/1), 2.7 MB | 0 B/s, done
git : To https://xxxxxxxx.visualstudio.com/xxxxxxxx/_git/xxxxx
At line:1 char:1
+ git push origin master_bugs
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (To https://xxxx.../_git/xxxxx:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
7c41bfe..3840795 master_bugs -> master_bugs
PM> git config lfs.https://xxxxxxxx.visualstudio.com/xxxxxxxx/_git/xxxxxxx.git/info/lfs.locksverify true
PM> git push origin master_bugs
git : Everything up-to-date
At line:1 char:1
+ git push origin master_bugs
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Everything up-to-date:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PM> git push origin master_bugs
git : Everything up-to-date
At line:1 char:1
+ git push origin master_bugs
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Everything up-to-date:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PM> git show 3840795
commit 3840795646ae042c7d87c34b32ee7235f776f952
Author: Paul <[email protected]>
Date: Thu Jul 19 15:58:16 2018 -0400
added file for lfs
diff --git a/1.pdf b/1.pdf
new file mode 100644
index 0000000..5e46737
--- /dev/null
+++ b/1.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e545334f117b7a01e03df7b7d1ba744ff752fdbe28bbfc1178d0a43a95db87cd
+size 2701762
PM> git show 7c41bfe
commit 7c41bfe52faeb8dd4dcb822195c679fc9cb3e4d0
Author: Paul <[email protected]>
Date: Thu Jul 19 15:54:11 2018 -0400
asdsad
diff --git a/.gitattributes b/.gitattributes
index 09d8abc..b634d85 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,3 +1 @@
*.pdf filter=lfs diff=lfs merge=lfs -text
-"*.pdf" filter=lfs diff=lfs merge=lfs -text
-'*.pdf' filter=lfs diff=lfs merge=lfs -text
How can I tell if this is ACTUALLY working?
Upvotes: 1
Views: 769
Reputation: 38106
The pdf file 3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
of your git repo has already been managed in Git LFS.
As you checked by the command:
git lfs ls-files
And the diff for 3FOWW_Rules_of_Play_Digital_Final_v1.3.pdf
file in commit 738f4a6
also indicate that the file is managed in git lfs, as the message shows:
version https://git-lfs.github.com/spec/v1
So the main confusion for you seems to be why the lfs file can be seen even when you deselect Checkout files from LFS option in VSTS build Get sources step.
Actually the content of the LFS file is not downloaded if the option Checkout files from LFS is deselected. You can double check by the lfs file's size.
Such as I have 11.png
file managed in git lfs, when I deselect Checkout files from LFS option in Get sources step, the file 11.png
is 1KB. And if I select Checkout files from LFS option in Get sources step and build again, the file 11.png is 83KB
.
Upvotes: 1