我们目前正在从 CVS 迁移到 git 存储库。然而,一个团队大约一年前已经在他们的存储库中使用了 cvs2git,因为他们的新功能需要大量具有历史记录的移动文件,而 CVS 在历史上并不擅长。然后,两个存储库都应该使用 GIT-LFS 来获取我们更大的签入源(例如,预构建的外部库)
我们的想法是创建相同的起点,以便在我们迁移后将所有更改与历史合并到我们的存储库中。
所以我已经有了起点的精确复制品;想法是现在使用 git format-patch 创建所有补丁文件。现在大多数补丁都可以正常工作,问题只是使用 git lfs 的补丁。
一个例子:
diff --git a/Foo/bar/baz.zip b/Foo/bar/baz.zip
new file mode 100644
index 00000000000..6fce3f4bd05
--- /dev/null
+++ b/Foo/bar/baz.zip
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:c90b657621e07fa40476186d94e2f6e06f055b49294b83ee976f73dfac120d86
+size 116056
--
2.13.2.windows.1
当我尝试应用该补丁时,会发生以下情况:
$ git am ../patches/mypatch.patch
Applying: #someTfsId: myCommit
Downloading Foo/bar/baz.zip (113.34 KB)
Error downloading object: Foo/bar/baz.zip (c90b657): Smudge error: Error opening media file.: open D:\repositories\myrepo\.git\lfs\objects\c9\0b\c90b657621e07fa40476186d94e2f6e06f055b49294b83ee976f73dfac120d86: The system cannot find the file specified.
Errors logged to D:\repositories\myrepo\.git\lfs\objects\logs\20171006T110837.3254847.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: Foo/bar/baz.zip: smudge filter lfs failed
user@machine MINGW64 /d/repositories/myrepo (develop|AM 1/1)
$ git am --abort
我的下一个想法是使用原始存储库并使用 GIT_TRACE=1 获取所有 lfs 对象 git lfs fetch --all 之后我尝试复制一个对象(用于测试目的),结果导致
user@machine MINGW64 /d/repositories/myrepo (develop)
$ git am ../patches/mypatch.patch
error: Foo/bar/baz.zip: already exists in working directory
Applying: #someTfsId: myCommit
Patch failed at 0001 #someTfsId: myCommit
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
所以我想问题是:我是否可以将 LFS 对象添加到远程服务器,或者我是否必须“取消 lfs”用于创建 .patch 文件的存储库,以便存储二进制差异在 .patch 文件中?
我们真的很想保留历史,目前补丁的数量大约是 1600 次提交,这很难手动完成。
如果我遗漏了一些明显的方式,我很高兴有任何建设性的意见