在 git svn clone 中使用 --no-metadata 是否有优势?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8333870/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:12:50  来源:igfitidea点击:

Is there an advantage to using --no-metadata in git svn clone?

gitsvnversion-controlgit-svn

提问by Eric

I'm doing a one-way convert from an SVN repository to a Git repository using git svn clone. Most examples do this with the --no-metadataflag - is there an advantage to using this flag?

我正在使用git svn clone. 大多数示例都使用--no-metadata标志执行此操作- 使用此标志有优势吗?

I understand that the flag removes the SVN revision numbers. I can think of reasons why it may be useful to keep these around (such as referring back to specific commits mentioned in bug tracking software).

我知道该标志删除了 SVN 修订号。我可以想到保留这些可能有用的原因(例如参考错误跟踪软件中提到的特定提交)。

What are the arguments forusing the --no-metadataflag? Is there any benefit other than a sensation of breaking all ties?

使用标志的参数什么--no-metadata?除了打破所有联系的感觉之外,还有什么好处吗?

采纳答案by manojlds

It is actually not recommended:

实际上是不推荐的:

This option is NOT recommended as it makes it difficult to track down old references to SVN revision numbers in existing documentation, bug reports and archives. If you plan to eventually migrate from SVN to git and are certain about dropping SVN history, consider git-filter-branch(1) instead. filter-branch also allows reformatting of metadata for ease-of-reading and rewriting authorship info for non-"svn.authorsFile" users.

不建议使用此选项,因为它很难在现有文档、错误报告和存档中跟踪对 SVN 修订号的旧引用。如果您计划最终从 SVN 迁移到 git 并且确定要删除 SVN 历史记录,请考虑使用 git-filter-branch(1)。filter-branch 还允许重新格式化元数据,以便于阅读和重写非“svn.authorsFile”用户的作者信息。

回答by Mark Booth

One argument for using --no-metadatais that it doesn't change your commit messages. So even if you fetch from different locations, the commit messages will be the same and thus the commit hashes will be the same.

使用的一个论点--no-metadata是它不会更改您的提交消息。因此,即使您从不同位置获取数据,提交消息也将相同,因此提交哈希值也将相同。

As an example, if I git svn inita repo from a local file:URL and later pull from an https:URL, every commit in the repo will be duplicated, since all of the commits with git-svn-id: file:///... will be fetched as git-svn-id: https:///... and encoded with new SHA1's.

例如,如果我git svn init从本地file:URL 获取一个 repo,然后从URL 中提取https:,则 repo 中的每个提交都将被复制,因为所有带有git-svn-id: file:///...的提交都将被提取为git-svn-id: https:///... 并使用新的 SHA1 编码。

If I specify --no-metadatathen the commit message and this sha1 has will be the same and I can fetch from either the local filesystem or the subversion server because there will only be a single copy of any given svn commit in the git repo.

如果我指定--no-metadata那么提交消息和这个 sha1 将是相同的,我可以从本地文件系统或 subversion 服务器获取,因为在 git repo 中将只有任何给定 svn 提交的单个副本。

Personally I would prefer it if there were a minimal metadataoption, which recorded the subversion revision id, but not the full metadata, but without messing around with git-filter-branchwe are stuck with all or nothing.

我个人更喜欢它,如果有一个最小的元数据选项,它记录了颠覆版本 id,而不是完整的元数据,但没有搞乱git-filter-branch我们要么全都被卡住,要么全都没有。