Git格式补丁修补程序无法在不同的存储库

时间:2017-10-06 10:09:11

标签: git git-lfs format-patch

我们目前正在从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

我的下一个想法是使用原始存储库并获取所有lfs对象     GIT_TRACE = 1 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对象添加到远程服务器,或者我是否需要" un-lfs"用于创建.patch文件的存储库,因此二进制差异存储在.patch文件中?

我们真的想保留历史记录,目前修补程序的数量约为1600次,这很难手工完成。

如果我错过了一些明显的方式,我很乐意接受任何建设性的输入

0 个答案:

没有答案
相关问题