简体   繁体   中英

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? ie the equivalence of running git diff --full-index ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM