代码之家  ›  专栏  ›  技术社区  ›  Andres Jaan Tack

Why are git submodules incompatible with svn externals?

  •  14
  • Andres Jaan Tack  · 技术社区  · 14 年前

    There are lots of webpages out there suggesting hackish ways to make svn externals look like git submodules . 我读过 some accounts of what the difference is, but this doesn't seem very fundamental:

    Git子模块链接到另一个项目的存储库中的特定提交,而svn:externals总是获取最新版本。

    Why does this difference make them so fundamentally incompatible? 我们是否可以假定有一个合理的默认值,比如大多数svn:externals指向从不移动的标记?

    2 回复  |  直到 8 年前
        1
  •  10
  •   Community CDub    7 年前

    根本的区别是 composition rule .

    在真实中 统计综合法 定义一个 configuration ,即:
    项目“工作”(即“开发”、“编译”、“部署”、…)所需的标签列表(sha1 commits for git)。

    配置中引用的每个提交都有助于获得所有树的准确版本。没有例外。该树的每个文件都是由您定义的配置指定的确切版本。


    注1.8.2

    “Git子模块”开始学习与远程分支的尖端集成的新模式(而不是与超级项目的Gitlink中记录的提交集成)。

    很快(2013年3月),一个子模块就可以引用上游水头,而不仅仅是固定的sha1。


    (1.8.2之前)每个模块只能有一个标签/sha1。从一个公共父repo,您不能在一个模块中定义一个模块。
    (但是一个模块,仅仅是对一个外部Git回购的引用,它可以有自己的子模块定义:父回购将只引用第一级子模块,而第一级子模块又将引用它自己所承诺的任何子模块)


    不在 SVN external :可以定义目录外部和文件外部,其中包含或不包含显式修订。
    你可以 组成 various external properties. 例如:

    $ svn propget svn:externals calc
    third-party/sounds             http://svn.example.com/repos/sounds
    third-party/skins -r148        http://svn.example.com/skinproj
    third-party/skins/toolkit -r21 http://svn.example.com/skin-maker
    

    The result is not a configuration (one reference for ' calc '),但选择规则的组合定义了目录中所需的确切“补丁”


    In short, you cannot "compute" one SHA1 for a ' ' submodule which would be the exact equivalent of a bunch of svn:external properties on a ' 'svn目录。

        2
  •  3
  •   Dmitry Pavlenko    12 年前

    如果你使用 SmartGit 对于使用带有svn:externals的svn存储库,您不会注意到任何真正的区别。

    实际上,唯一真正的区别(至少是唯一的技术区别)是SVN允许外部的点对点修订(不是固定值),Git子模块不允许。所有其他的区别,依我看,都是无关紧要的,所以你问这个问题是对的。