Git-lfs: lfs migrate does not rewrite later removed files

Created on 7 Nov 2017  路  4Comments  路  Source: git-lfs/git-lfs

Given the following test case:

Commit 1

  • add test-1.bin
  • add test-2.bin

Commit 2

  • rm test-1.bin

Now migrating

git lfs migrate import --include="*.bin" --everything

Results in

  • both test-1.bin and test-2.bin in the .git/lfs/objects directory (which is correct)
  • test-2.bin replace with pointer file (both current and history) (which is correct)
  • test-1.bin (in history) still real file instead of pointer file
bug

All 4 comments

Thanks for the report! I'll see if I can get a failing test going.

I have a similar issue: git lfs migrate info seems to completely ignore files that don't exist anymore.

Hi @tarioch, sorry for the radio silence on our end; I just took a look at this and was unable to reproduce the issue:

~/D/2720 (master) $ git lfs migrate import --include="*.bin" --everything
migrate: Sorting commits: ..., done
migrate: Rewriting commits: 100% (2/2), done
  master        54d8df17ffdd9ee0c3456fabea9d7f7278fa12d1 -> 639a95f9f04563cd166930f99b4ef4491ea2f435
migrate: Updating refs: ..., done
migrate: checkout: ..., done

~/D/2720 (master) $ git log --oneline
639a95f (HEAD -> master) remove a file
74f0a22 initial commit

~/D/2720 (master) $ git show 74f0a22
commit 74f0a22c18ef55f5956a783cd1bec6783093f487
Author: Taylor Blau <[email protected]>
Date:   Mon Dec 11 15:52:34 2017 -0800

    initial commit

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..4edd5ac
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.bin filter=lfs diff=lfs merge=lfs -text
diff --git a/test-1.bin b/test-1.bin
new file mode 100644
index 0000000..8fb3407
--- /dev/null
+++ b/test-1.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb
+size 1
diff --git a/test-2.bin b/test-2.bin
new file mode 100644
index 0000000..8b620c9
--- /dev/null
+++ b/test-2.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d
+size 1

Could you please re-open this issue with a script that is able to reproduce the issue?

I think I figured out my mistake, I did "lfs checkout shaoffirstcommit" which seems to run smudge for the new fetched files but not for the unchanged files. So seems to be fine.

Was this page helpful?
0 / 5 - 0 ratings