我们目前正在从CVS迁移到git存储库。然而,由于其新功能需要大量移动带有历史记录的文件,而CVS在历史上并不擅长此类操作,因此其中一个团队已经一年前使用了cvs2git来处理他们的存储库。这两个存储库都应该使用GIT-LFS来管理我们较大的源代码(例如预构建的外部库)。
我们的想法是创建相同的起始点,以便在迁移后将所有更改和历史记录合并到我们的存储库中。我已经拥有了起始点的精确副本;现在的想法是使用git format-patch创建所有补丁文件。现在大多数补丁都可以正常工作,问题只出现在使用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 git lfs fetch --all 来获取所有的lfs对象。 之后,我尝试复制其中一个对象(仅用于测试),结果如下:
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个提交的补丁,手动完成会很困难。
如果我漏掉了某些明显的方法,我很乐意接受任何建设性的意见。