本文介绍了Git相当于subversion的$ URL $关键字扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑从颠覆转移到git。我们使用Subversion为我们的系统管理员管理配置文件之类的东西之一。为此,我们将

还有 ident 指令,它会将 $ Id $ 放入blob散列。如果可以将其映射回路径名,这可能是可用的,但是我的git-fu不够强大。



有什么建议吗?

工作流程如下:


  1. 管理员提交对VCS回购的更改

  2. 管理员更新已检出回购的中央库位
  3. Admin使用cfengine将更改发送给主机 正如,Git不支持关键字扩展








    文件信息扩展最接近的例子我发现它仍然基于涂抹/清洁方法,使用此git Hash过滤器,但干净的部分将其从文件中删除,并且找不到路径。



    实际上是拼写出来的(以及提及一些git-fu命令,这些命令可能包含你正在寻找的东西,我没有测试过它们):


    I am considering migrating from subversion to git. One of the things we use subversion for our sysadmins to manage things like configuration files. To that end, we put $URL$ into each file, which expands to the file's location in the subversion tree. This lets the admins look at a file on some arbitrary host and figure out where in the tree it came from.

    The closest analog I could find is gitattributes. There is the filter= directive, but it seems that git doesn't communicate to the filter what filename it's filtering, which would be necessary to turn $URL$ into a path.

    There is also the ident directive, which would turn $Id$ into the blob hash. This might be usable if one could map that back into a pathname, but my git-fu isn't strong enough.

    Any suggestions?

    The workflow is as follows:

    1. Admin commits changes to the VCS repo
    2. Admin updates a central location that has checked out the repo
    3. Admin pulls the changes to the host using cfengine
    解决方案

    As mentioned in "Does git have anything like svn propset svn:keywords or pre-/post-commit hooks?", Git does not support keyword expansion.

    "Dealing with SVN keyword expansion with git-sv" provides a solution based on git config filter (which is not exactly what you want) and/or gitattributes.


    The closest example if file information expansion I have found it still based on the smudge/clean approach, with this git Hash filter, but the clean part removes it from the file, and no path can be found.

    This thread actually spells it out (as well as mentioning some git-fu commands which might contain what you are looking for, I have not tested them):

    这篇关于Git相当于subversion的$ URL $关键字扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 05:01
查看更多