【问题标题】:Getting full indexes of a patch using libgit2 / git2go使用 libgit2 / git2go 获取补丁的完整索引
【发布时间】:2015-03-04 04:16:41
【问题描述】:

git2go 的 git.Patch 或 libgit2 的 git_patch 返回如下格式的 String 值:

"diff": "diff --git a/test b/test
         index 9daeafb..dced80a 100644  
         --- a/test 
         +++ b/test 
         @@ -1 +1,3 @@  
         test
         +  
         +test"

请注意,index 9daeafb..dced80a 100644 不是完整索引。无论如何使用 libgit2 / git2go 返回完整索引?即等同于运行git diff --full-index

【问题讨论】:

    标签: git go patch libgit2 pygit2


    【解决方案1】:

    所以我设法得到了一些外部帮助。如果有人遇到同样的问题,可以使用以下方式返回:

    git_diff_options 在 libgit2 中并将id_abbrev 设置为 40。 https://libgit2.github.com/libgit2/#HEAD/type/git_diff_options

    或 git2go 中的 DiffOptions 并将 IdAbbrev 设置为 40。 https://godoc.org/github.com/libgit2/git2go#DiffOptions

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-12
      • 2021-12-20
      • 1970-01-01
      • 1970-01-01
      • 2021-12-13
      • 1970-01-01
      • 1970-01-01
      • 2014-12-15
      相关资源
      最近更新 更多