Search code examples
gitgopatchlibgit2pygit2

Getting full indexes of a patch using libgit2 / git2go


git2go's git.Patch or libgit2's git_patch returns a String value of the following format:

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

Notice that index 9daeafb..dced80a 100644 is not the full index. Is there anyway using libgit2 / git2go to return the full index? i.e. the equivalence of running git diff --full-index?


Solution

  • So I've managed to get some outside help. If anyone runs into the same issue, it can be returned using:

    git_diff_options in libgit2 and setting id_abbrev to 40. https://libgit2.github.com/libgit2/#HEAD/type/git_diff_options

    or DiffOptions in git2go and setting IdAbbrev to 40. https://godoc.org/github.com/libgit2/git2go#DiffOptions