"code.gitea.io/gitea/routers" | "code.gitea.io/gitea/routers" | ||||
"code.gitea.io/gitea/routers/routes" | "code.gitea.io/gitea/routers/routes" | ||||
"github.com/go-git/go-git/v5" | |||||
"github.com/go-git/go-git/v5/config" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
context2 "github.com/gorilla/context" | context2 "github.com/gorilla/context" | ||||
"github.com/unknwon/com" | "github.com/unknwon/com" | ||||
"gopkg.in/src-d/go-git.v4" | |||||
"gopkg.in/src-d/go-git.v4/config" | |||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/testfixtures.v2" | "gopkg.in/testfixtures.v2" | ||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) |
github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect | github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 // indirect | ||||
github.com/gliderlabs/ssh v0.2.2 | github.com/gliderlabs/ssh v0.2.2 | ||||
github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a // indirect | github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a // indirect | ||||
github.com/go-git/go-billy/v5 v5.0.0 | |||||
github.com/go-git/go-git/v5 v5.0.0 | |||||
github.com/go-openapi/jsonreference v0.19.3 // indirect | github.com/go-openapi/jsonreference v0.19.3 // indirect | ||||
github.com/go-redis/redis v6.15.2+incompatible | github.com/go-redis/redis v6.15.2+incompatible | ||||
github.com/go-sql-driver/mysql v1.4.1 | github.com/go-sql-driver/mysql v1.4.1 | ||||
github.com/quasoft/websspi v1.0.0 | github.com/quasoft/websspi v1.0.0 | ||||
github.com/remyoudompheng/bigfft v0.0.0-20190321074620-2f0d2b0e0001 // indirect | github.com/remyoudompheng/bigfft v0.0.0-20190321074620-2f0d2b0e0001 // indirect | ||||
github.com/satori/go.uuid v1.2.0 | github.com/satori/go.uuid v1.2.0 | ||||
github.com/sergi/go-diff v1.0.0 | |||||
github.com/sergi/go-diff v1.1.0 | |||||
github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b // indirect | github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b // indirect | ||||
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd | github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd | ||||
github.com/src-d/enry/v2 v2.1.0 | github.com/src-d/enry/v2 v2.1.0 | ||||
github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53 | github.com/yohcop/openid-go v0.0.0-20160914080427-2c050d2dae53 | ||||
github.com/yuin/goldmark v1.1.25 | github.com/yuin/goldmark v1.1.25 | ||||
go.etcd.io/bbolt v1.3.3 // indirect | go.etcd.io/bbolt v1.3.3 // indirect | ||||
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d | |||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa | |||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 | |||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a | |||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 | golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 | ||||
golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c | |||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 | |||||
golang.org/x/text v0.3.2 | golang.org/x/text v0.3.2 | ||||
golang.org/x/tools v0.0.0-20191213221258-04c2e8eff935 // indirect | golang.org/x/tools v0.0.0-20191213221258-04c2e8eff935 // indirect | ||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect | gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect | ||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df | gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df | ||||
gopkg.in/ini.v1 v1.52.0 | gopkg.in/ini.v1 v1.52.0 | ||||
gopkg.in/ldap.v3 v3.0.2 | gopkg.in/ldap.v3 v3.0.2 | ||||
gopkg.in/src-d/go-billy.v4 v4.3.2 | |||||
gopkg.in/src-d/go-git.v4 v4.13.1 | |||||
gopkg.in/testfixtures.v2 v2.5.0 | gopkg.in/testfixtures.v2 v2.5.0 | ||||
mvdan.cc/xurls/v2 v2.1.0 | mvdan.cc/xurls/v2 v2.1.0 | ||||
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 | strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 |
github.com/couchbaselabs/go-couchbase v0.0.0-20190708161019-23e7ca2ce2b7 h1:1XjEY/gnjQ+AfXef2U6dxCquhiRzkEpxZuWqs+QxTL8= | github.com/couchbaselabs/go-couchbase v0.0.0-20190708161019-23e7ca2ce2b7 h1:1XjEY/gnjQ+AfXef2U6dxCquhiRzkEpxZuWqs+QxTL8= | ||||
github.com/couchbaselabs/go-couchbase v0.0.0-20190708161019-23e7ca2ce2b7/go.mod h1:mby/05p8HE5yHEAKiIH/555NoblMs7PtW6NrYshDruc= | github.com/couchbaselabs/go-couchbase v0.0.0-20190708161019-23e7ca2ce2b7/go.mod h1:mby/05p8HE5yHEAKiIH/555NoblMs7PtW6NrYshDruc= | ||||
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= | github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= | ||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= | |||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= | |||||
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= | github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= | ||||
github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d h1:SwD98825d6bdB+pEuTxWOXiSjBrHdOl/UVp75eI7JT8= | github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d h1:SwD98825d6bdB+pEuTxWOXiSjBrHdOl/UVp75eI7JT8= | ||||
github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= | github.com/cznic/b v0.0.0-20181122101859-a26611c4d92d/go.mod h1:URriBxXwVq5ijiJ12C7iIZqlA69nTlI+LgI6/pwftG8= | ||||
github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= | github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= | ||||
github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 h1:gclg6gY70GLy3PbkQ1AERPfmLMMagS60DKF78eWwLn8= | github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 h1:gclg6gY70GLy3PbkQ1AERPfmLMMagS60DKF78eWwLn8= | ||||
github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= | github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= | ||||
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= | |||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= | |||||
github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agRrHM= | |||||
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= | |||||
github.com/go-git/go-git-fixtures/v4 v4.0.1 h1:q+IFMfLx200Q3scvt2hN79JsEzy4AmBTp/pqnefH+Bc= | |||||
github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= | |||||
github.com/go-git/go-git/v5 v5.0.0 h1:k5RWPm4iJwYtfWoxIJy4wJX9ON7ihPeZZYC1fLYDnpg= | |||||
github.com/go-git/go-git/v5 v5.0.0/go.mod h1:oYD8y9kWsGINPFJoLdaScGCN6dlKg23blmClfZwtUVA= | |||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= | github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= | ||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= | github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= | ||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= | github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= | ||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | ||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | ||||
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= | github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= | ||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= | |||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= | ||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | |||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | |||||
github.com/lafriks/xormstore v1.3.2 h1:hqi3F8s/B4rz8GuEZZDuHuOxRjeuOpEI/cC7vcnWwH4= | github.com/lafriks/xormstore v1.3.2 h1:hqi3F8s/B4rz8GuEZZDuHuOxRjeuOpEI/cC7vcnWwH4= | ||||
github.com/lafriks/xormstore v1.3.2/go.mod h1:mVNIwIa25QIr8rfR7YlVjrqN/apswHkVdtLCyVYBzXw= | github.com/lafriks/xormstore v1.3.2/go.mod h1:mVNIwIa25QIr8rfR7YlVjrqN/apswHkVdtLCyVYBzXw= | ||||
github.com/lestrrat-go/jwx v0.9.0/go.mod h1:iEoxlYfZjvoGpuWwxUz+eR5e6KTJGsaRcy/YNA/UnBk= | github.com/lestrrat-go/jwx v0.9.0/go.mod h1:iEoxlYfZjvoGpuWwxUz+eR5e6KTJGsaRcy/YNA/UnBk= | ||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= | github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= | ||||
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5 h1:BvoENQQU+fZ9uukda/RzCAL/191HHwJA5b13R6diVlY= | github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5 h1:BvoENQQU+fZ9uukda/RzCAL/191HHwJA5b13R6diVlY= | ||||
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= | github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= | ||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= | |||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= | |||||
github.com/niklasfasching/go-org v0.1.9 h1:Toz8WMIt+qJb52uYEk1YD/muLuOOmRt1CfkV+bKVMkI= | github.com/niklasfasching/go-org v0.1.9 h1:Toz8WMIt+qJb52uYEk1YD/muLuOOmRt1CfkV+bKVMkI= | ||||
github.com/niklasfasching/go-org v0.1.9/go.mod h1:AsLD6X7djzRIz4/RFZu8vwRL0VGjUvGZCCH1Nz0VdrU= | github.com/niklasfasching/go-org v0.1.9/go.mod h1:AsLD6X7djzRIz4/RFZu8vwRL0VGjUvGZCCH1Nz0VdrU= | ||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= | github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= | ||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= | github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= | ||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= | github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= | ||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= | github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= | ||||
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= | |||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= | github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= | ||||
github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= | github.com/pelletier/go-toml v1.4.0 h1:u3Z1r+oOXJIkxqw34zVhyPgjBsm6X2wn21NWs/HfSeg= | ||||
github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= | github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= | ||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= | github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= | ||||
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= | github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= | ||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= | github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= | ||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= | |||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= | |||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= | |||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= | |||||
github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b h1:4kg1wyftSKxLtnPAvcRWakIPpokB9w780/KwrNLnfPA= | github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b h1:4kg1wyftSKxLtnPAvcRWakIPpokB9w780/KwrNLnfPA= | ||||
github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= | github.com/shurcooL/httpfs v0.0.0-20190527155220-6a4d4a70508b/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= | ||||
github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd h1:ug7PpSOB5RBPK1Kg6qskGBoP3Vnj/aNYFTznWvlkGo0= | github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd h1:ug7PpSOB5RBPK1Kg6qskGBoP3Vnj/aNYFTznWvlkGo0= | ||||
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= | github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= | ||||
github.com/src-d/enry/v2 v2.1.0 h1:z1L8t+B8bh3mmjPkJrgOTnVRpFGmTPJsplHX9wAn6BI= | github.com/src-d/enry/v2 v2.1.0 h1:z1L8t+B8bh3mmjPkJrgOTnVRpFGmTPJsplHX9wAn6BI= | ||||
github.com/src-d/enry/v2 v2.1.0/go.mod h1:qQeCMRwzMF3ckeGr+h0tJLdxXnq+NVZsIDMELj0t028= | github.com/src-d/enry/v2 v2.1.0/go.mod h1:qQeCMRwzMF3ckeGr+h0tJLdxXnq+NVZsIDMELj0t028= | ||||
github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4= | |||||
github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= | |||||
github.com/src-d/go-oniguruma v1.1.0 h1:EG+Nm5n2JqWUaCjtM0NtutPxU7ZN5Tp50GWrrV8bTww= | github.com/src-d/go-oniguruma v1.1.0 h1:EG+Nm5n2JqWUaCjtM0NtutPxU7ZN5Tp50GWrrV8bTww= | ||||
github.com/src-d/go-oniguruma v1.1.0/go.mod h1:chVbff8kcVtmrhxtZ3yBVLLquXbzCS6DrxQaAK/CeqM= | github.com/src-d/go-oniguruma v1.1.0/go.mod h1:chVbff8kcVtmrhxtZ3yBVLLquXbzCS6DrxQaAK/CeqM= | ||||
github.com/steveyen/gtreap v0.0.0-20150807155958-0abe01ef9be2 h1:JNEGSiWg6D3lcBCMCBqN3ELniXujt+0QNHLhNnO0w3s= | github.com/steveyen/gtreap v0.0.0-20150807155958-0abe01ef9be2 h1:JNEGSiWg6D3lcBCMCBqN3ELniXujt+0QNHLhNnO0w3s= | ||||
golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad h1:5E5raQxcv+6CZ11RrBYQe5WRbUIWpScjh0kvHZkZIrQ= | golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad h1:5E5raQxcv+6CZ11RrBYQe5WRbUIWpScjh0kvHZkZIrQ= | ||||
golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | golang.org/x/crypto v0.0.0-20190927123631-a832865fa7ad/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | ||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | ||||
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d h1:1ZiEyfaQIg3Qh0EoqpwAakHVhecoE5wlSg5GjnafJGw= | |||||
golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | |||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM= | |||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | |||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= | ||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= | golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= | ||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= | golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= | ||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||||
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | ||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa h1:F+8P+gmewFQYRk6JoLQLwjBCTu3mcIURZfNkVweuRKA= | |||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | |||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= | |||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | |||||
golang.org/x/oauth2 v0.0.0-20180620175406-ef147856a6dd/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | golang.org/x/oauth2 v0.0.0-20180620175406-ef147856a6dd/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | ||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= | ||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= | golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= | ||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||||
golang.org/x/sys v0.0.0-20190730183949-1393eb018365/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190730183949-1393eb018365/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
golang.org/x/sys v0.0.0-20190907184412-d223b2b6db03/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190907184412-d223b2b6db03/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= | golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= | ||||
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c h1:jceGD5YNJGgGMkJz79agzOln1K9TaZUjv5ird16qniQ= | |||||
golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So= | |||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= | golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= | ||||
golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | golang.org/x/tools v0.0.0-20190614205625-5aca471b1d59/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | ||||
golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | golang.org/x/tools v0.0.0-20190617190820-da514acc4774/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | ||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= | ||||
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= | |||||
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= | ||||
golang.org/x/tools v0.0.0-20191213221258-04c2e8eff935 h1:kJQZhwFzSwJS2BxboKjdZzWczQOZx8VuH7Y8hhuGUtM= | golang.org/x/tools v0.0.0-20191213221258-04c2e8eff935 h1:kJQZhwFzSwJS2BxboKjdZzWczQOZx8VuH7Y8hhuGUtM= | ||||
golang.org/x/tools v0.0.0-20191213221258-04c2e8eff935/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= | golang.org/x/tools v0.0.0-20191213221258-04c2e8eff935/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= | ||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= | ||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= | |||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | |||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= | gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= | ||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= | gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= | ||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE= | gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df h1:n7WqCuqOuCbNr617RXOY0AWRXxgwEyPp2z+p0+hgMuE= | ||||
gopkg.in/ldap.v3 v3.0.2/go.mod h1:oxD7NyBuxchC+SgJDE1Q5Od05eGt29SDQVBmV+HYbzw= | gopkg.in/ldap.v3 v3.0.2/go.mod h1:oxD7NyBuxchC+SgJDE1Q5Od05eGt29SDQVBmV+HYbzw= | ||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= | gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= | ||||
gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= | gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= | ||||
gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg= | |||||
gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98= | |||||
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0 h1:ivZFOIltbce2Mo8IjzUHAFoq/IylO9WHhNOAJK+LsJg= | |||||
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g= | |||||
gopkg.in/src-d/go-git.v4 v4.13.1 h1:SRtFyV8Kxc0UP7aCHcijOMQGPxHSmMOPrzulQWolkYE= | |||||
gopkg.in/src-d/go-git.v4 v4.13.1/go.mod h1:nx5NYcxdKxq5fpltdHnPa2Exj4Sx0EclMWZQbYDu2z8= | |||||
gopkg.in/testfixtures.v2 v2.5.0 h1:N08B7l2GzFQenyYbzqthDnKAA+cmb17iAZhhFxr7JHw= | gopkg.in/testfixtures.v2 v2.5.0 h1:N08B7l2GzFQenyYbzqthDnKAA+cmb17iAZhhFxr7JHw= | ||||
gopkg.in/testfixtures.v2 v2.5.0/go.mod h1:vyAq+MYCgNpR29qitQdLZhdbLFf4mR/2MFJRFoQZZ2M= | gopkg.in/testfixtures.v2 v2.5.0/go.mod h1:vyAq+MYCgNpR29qitQdLZhdbLFf4mR/2MFJRFoQZZ2M= | ||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= | ||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= | gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= | ||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | ||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= | |||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | |||||
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | ||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | ||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= | honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= |
"code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
mc "gitea.com/macaron/cache" | mc "gitea.com/macaron/cache" | ||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
) | ) | ||||
// LastCommitCache represents a cache to store last commit | // LastCommitCache represents a cache to store last commit |
"io" | "io" | ||||
"io/ioutil" | "io/ioutil" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
) | ) | ||||
// Blob represents a Git object. | // Blob represents a Git object. |
package git | package git | ||||
import "gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
import "github.com/go-git/go-git/v5/plumbing/object" | |||||
// LastCommitCache cache | // LastCommitCache cache | ||||
type LastCommitCache interface { | type LastCommitCache interface { |
"strconv" | "strconv" | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
) | ) | ||||
// Commit represents a git commit. | // Commit represents a git commit. |
"path" | "path" | ||||
"github.com/emirpasic/gods/trees/binaryheap" | "github.com/emirpasic/gods/trees/binaryheap" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
cgobject "gopkg.in/src-d/go-git.v4/plumbing/object/commitgraph" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
cgobject "github.com/go-git/go-git/v5/plumbing/object/commitgraph" | |||||
) | ) | ||||
// GetCommitsInfo gets information of all commits that are corresponding to these entries | // GetCommitsInfo gets information of all commits that are corresponding to these entries |
"io" | "io" | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
) | ) | ||||
// CommitFromReader will generate a Commit from a provided reader | // CommitFromReader will generate a Commit from a provided reader |
import ( | import ( | ||||
"io/ioutil" | "io/ioutil" | ||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
) | ) | ||||
// NotesRef is the git ref where Gitea will look for git-notes data. | // NotesRef is the git ref where Gitea will look for git-notes data. |
"fmt" | "fmt" | ||||
"strconv" | "strconv" | ||||
"gopkg.in/src-d/go-git.v4/plumbing/filemode" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"github.com/go-git/go-git/v5/plumbing/filemode" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
) | ) | ||||
// ParseTreeEntries parses the output of a `git ls-tree` command. | // ParseTreeEntries parses the output of a `git ls-tree` command. |
import ( | import ( | ||||
"testing" | "testing" | ||||
"github.com/go-git/go-git/v5/plumbing/filemode" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
"github.com/stretchr/testify/assert" | "github.com/stretchr/testify/assert" | ||||
"gopkg.in/src-d/go-git.v4/plumbing/filemode" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
) | ) | ||||
func TestParseTreeEntries(t *testing.T) { | func TestParseTreeEntries(t *testing.T) { |
"time" | "time" | ||||
gitealog "code.gitea.io/gitea/modules/log" | gitealog "code.gitea.io/gitea/modules/log" | ||||
"github.com/go-git/go-billy/v5/osfs" | |||||
gogit "github.com/go-git/go-git/v5" | |||||
"github.com/go-git/go-git/v5/plumbing/cache" | |||||
"github.com/go-git/go-git/v5/storage/filesystem" | |||||
"github.com/unknwon/com" | "github.com/unknwon/com" | ||||
"gopkg.in/src-d/go-billy.v4/osfs" | |||||
gogit "gopkg.in/src-d/go-git.v4" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/cache" | |||||
"gopkg.in/src-d/go-git.v4/storage/filesystem" | |||||
) | ) | ||||
// Repository represents a Git repository. | // Repository represents a Git repository. |
package git | package git | ||||
import ( | import ( | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
) | ) | ||||
func (repo *Repository) getBlob(id SHA1) (*Blob, error) { | func (repo *Repository) getBlob(id SHA1) (*Blob, error) { |
"fmt" | "fmt" | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
) | ) | ||||
// BranchPrefix base dir of the branch information file store on git | // BranchPrefix base dir of the branch information file store on git |
"strconv" | "strconv" | ||||
"strings" | "strings" | ||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
"github.com/mcuadros/go-version" | "github.com/mcuadros/go-version" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
) | ) | ||||
// GetRefCommitID returns the last commit ID string of given reference (branch or tag). | // GetRefCommitID returns the last commit ID string of given reference (branch or tag). |
gitealog "code.gitea.io/gitea/modules/log" | gitealog "code.gitea.io/gitea/modules/log" | ||||
"gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph" | |||||
cgobject "gopkg.in/src-d/go-git.v4/plumbing/object/commitgraph" | |||||
"github.com/go-git/go-git/v5/plumbing/format/commitgraph" | |||||
cgobject "github.com/go-git/go-git/v5/plumbing/object/commitgraph" | |||||
) | ) | ||||
// CommitNodeIndex returns the index for walking commit graph | // CommitNodeIndex returns the index for walking commit graph |
"code.gitea.io/gitea/modules/analyze" | "code.gitea.io/gitea/modules/analyze" | ||||
"github.com/go-git/go-git/v5" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
"github.com/src-d/enry/v2" | "github.com/src-d/enry/v2" | ||||
"gopkg.in/src-d/go-git.v4" | |||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
) | ) | ||||
const fileSizeLimit int64 = 16 * 1024 * 1024 | const fileSizeLimit int64 = 16 * 1024 * 1024 |
import ( | import ( | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-git.v4" | |||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"github.com/go-git/go-git/v5" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
) | ) | ||||
// GetRefs returns all references of the repository. | // GetRefs returns all references of the repository. |
"fmt" | "fmt" | ||||
"strings" | "strings" | ||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/mcuadros/go-version" | "github.com/mcuadros/go-version" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
) | ) | ||||
// TagPrefix tags prefix path on the repository | // TagPrefix tags prefix path on the repository |
"fmt" | "fmt" | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
) | ) | ||||
// EmptySHA defines empty git SHA | // EmptySHA defines empty git SHA |
"strconv" | "strconv" | ||||
"time" | "time" | ||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
) | ) | ||||
// Signature represents the Author or Committer information. | // Signature represents the Author or Committer information. |
"io" | "io" | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
) | ) | ||||
// Tree represents a flat directory listing. | // Tree represents a flat directory listing. |
"path" | "path" | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-git.v4/plumbing/filemode" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"github.com/go-git/go-git/v5/plumbing/filemode" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
) | ) | ||||
// GetTreeEntryByPath get the tree entries according the sub dir | // GetTreeEntryByPath get the tree entries according the sub dir |
"sort" | "sort" | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/filemode" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing/filemode" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
) | ) | ||||
// EntryMode the type of the object in the git tree | // EntryMode the type of the object in the git tree |
import ( | import ( | ||||
"testing" | "testing" | ||||
"github.com/go-git/go-git/v5/plumbing/filemode" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
"github.com/stretchr/testify/assert" | "github.com/stretchr/testify/assert" | ||||
"gopkg.in/src-d/go-git.v4/plumbing/filemode" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
) | ) | ||||
func getTestEntries() Entries { | func getTestEntries() Entries { |
"code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
"code.gitea.io/gitea/modules/util" | "code.gitea.io/gitea/modules/util" | ||||
pull_service "code.gitea.io/gitea/services/pull" | pull_service "code.gitea.io/gitea/services/pull" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"gitea.com/macaron/macaron" | "gitea.com/macaron/macaron" | ||||
) | ) |
"code.gitea.io/gitea/modules/log" | "code.gitea.io/gitea/modules/log" | ||||
"code.gitea.io/gitea/modules/setting" | "code.gitea.io/gitea/modules/setting" | ||||
gogit "github.com/go-git/go-git/v5" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
"github.com/mcuadros/go-version" | "github.com/mcuadros/go-version" | ||||
"github.com/unknwon/com" | "github.com/unknwon/com" | ||||
gogit "gopkg.in/src-d/go-git.v4" | |||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
) | ) | ||||
const ( | const ( |
// - make error context accessible programmatically? | // - make error context accessible programmatically? | ||||
// - limit input size? | // - limit input size? | ||||
// | // | ||||
package gcfg // import "github.com/src-d/gcfg" | |||||
package gcfg // import "github.com/go-git/gcfg" |
"os" | "os" | ||||
"strings" | "strings" | ||||
"github.com/src-d/gcfg/scanner" | |||||
"github.com/src-d/gcfg/token" | |||||
"github.com/go-git/gcfg/scanner" | |||||
"github.com/go-git/gcfg/token" | |||||
"gopkg.in/warnings.v0" | "gopkg.in/warnings.v0" | ||||
) | ) | ||||
) | ) | ||||
import ( | import ( | ||||
"github.com/src-d/gcfg/token" | |||||
"github.com/go-git/gcfg/token" | |||||
) | ) | ||||
// In an ErrorList, an error is represented by an *Error. | // In an ErrorList, an error is represented by an *Error. |
) | ) | ||||
import ( | import ( | ||||
"github.com/src-d/gcfg/token" | |||||
"github.com/go-git/gcfg/token" | |||||
) | ) | ||||
// An ErrorHandler may be provided to Scanner.Init. If a syntax error is | // An ErrorHandler may be provided to Scanner.Init. If a syntax error is |
"unicode" | "unicode" | ||||
"unicode/utf8" | "unicode/utf8" | ||||
"github.com/src-d/gcfg/types" | |||||
"github.com/go-git/gcfg/types" | |||||
"gopkg.in/warnings.v0" | "gopkg.in/warnings.v0" | ||||
) | ) | ||||
# go-billy [![GoDoc](https://godoc.org/gopkg.in/src-d/go-billy.v4?status.svg)](https://godoc.org/gopkg.in/src-d/go-billy.v4) [![Build Status](https://travis-ci.com/src-d/go-billy.svg)](https://travis-ci.com/src-d/go-billy) [![Build status](https://ci.appveyor.com/api/projects/status/vx2qn6vlakbi724t?svg=true)](https://ci.appveyor.com/project/mcuadros/go-billy) [![codecov](https://codecov.io/gh/src-d/go-billy/branch/master/graph/badge.svg)](https://codecov.io/gh/src-d/go-billy) | |||||
# go-billy [![GoDoc](https://godoc.org/gopkg.in/go-git/go-billy.v5?status.svg)](https://pkg.go.dev/github.com/go-git/go-billy) [![Test](https://github.com/go-git/go-billy/workflows/Test/badge.svg)](https://github.com/go-git/go-billy/actions?query=workflow%3ATest) | |||||
The missing interface filesystem abstraction for Go. | The missing interface filesystem abstraction for Go. | ||||
Billy implements an interface based on the `os` standard library, allowing to develop applications without dependency on the underlying storage. Makes it virtually free to implement mocks and testing over filesystem operations. | Billy implements an interface based on the `os` standard library, allowing to develop applications without dependency on the underlying storage. Makes it virtually free to implement mocks and testing over filesystem operations. | ||||
Billy was born as part of [src-d/go-git](https://github.com/src-d/go-git) project. | |||||
Billy was born as part of [go-git/go-git](https://github.com/go-git/go-git) project. | |||||
## Installation | ## Installation | ||||
```go | ```go | ||||
go get -u gopkg.in/src-d/go-billy.v4/... | |||||
import "github.com/go-git/go-billy/v5" // with go modules enabled (GO111MODULE=on or outside GOPATH) | |||||
import "github.com/go-git/go-billy" // with go modules disabled | |||||
``` | ``` | ||||
## Usage | ## Usage | ||||
Billy exposes filesystems using the | Billy exposes filesystems using the | ||||
[`Filesystem` interface](https://godoc.org/github.com/src-d/go-billy#Filesystem). | |||||
[`Filesystem` interface](https://pkg.go.dev/github.com/go-git/go-billy/v5?tab=doc#Filesystem). | |||||
Each filesystem implementation gives you a `New` method, whose arguments depend on | Each filesystem implementation gives you a `New` method, whose arguments depend on | ||||
the implementation itself, that returns a new `Filesystem`. | the implementation itself, that returns a new `Filesystem`. | ||||
module github.com/go-git/go-billy/v5 | |||||
require ( | |||||
github.com/kr/text v0.2.0 // indirect | |||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect | |||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 | |||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f | |||||
) | |||||
go 1.13 |
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= | |||||
github.com/go-git/go-billy v1.0.0 h1:bXR6Zu3opPSg0R4dDxqaLglY4rxw7ja7wS16qSpOKL4= | |||||
github.com/go-git/go-billy v3.1.0+incompatible h1:dwrJ8G2Jt1srYgIJs+lRjA36qBY68O2Lg5idKG8ef5M= | |||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | |||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= | |||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | |||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | |||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | |||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= | |||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= | |||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So= | |||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= | |||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= |
"path/filepath" | "path/filepath" | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-billy.v4" | |||||
"gopkg.in/src-d/go-billy.v4/helper/polyfill" | |||||
"github.com/go-git/go-billy/v5" | |||||
"github.com/go-git/go-billy/v5/helper/polyfill" | |||||
) | ) | ||||
// ChrootHelper is a helper to implement billy.Chroot. | // ChrootHelper is a helper to implement billy.Chroot. |
"os" | "os" | ||||
"path/filepath" | "path/filepath" | ||||
"gopkg.in/src-d/go-billy.v4" | |||||
"github.com/go-git/go-billy/v5" | |||||
) | ) | ||||
// Polyfill is a helper that implements all missing method from billy.Filesystem. | // Polyfill is a helper that implements all missing method from billy.Filesystem. |
// Package osfs provides a billy filesystem for the OS. | // Package osfs provides a billy filesystem for the OS. | ||||
package osfs // import "gopkg.in/src-d/go-billy.v4/osfs" | |||||
package osfs // import "github.com/go-git/go-billy/v5/osfs" | |||||
import ( | import ( | ||||
"io/ioutil" | "io/ioutil" | ||||
"path/filepath" | "path/filepath" | ||||
"sync" | "sync" | ||||
"gopkg.in/src-d/go-billy.v4" | |||||
"gopkg.in/src-d/go-billy.v4/helper/chroot" | |||||
"github.com/go-git/go-billy/v5" | |||||
"github.com/go-git/go-billy/v5/helper/chroot" | |||||
) | ) | ||||
const ( | const ( | ||||
return err | return err | ||||
} | } | ||||
return os.Rename(from, to) | |||||
return rename(from, to) | |||||
} | } | ||||
func (fs *OS) MkdirAll(path string, perm os.FileMode) error { | func (fs *OS) MkdirAll(path string, perm os.FileMode) error { |
package osfs | |||||
import ( | |||||
"io" | |||||
"os" | |||||
"path/filepath" | |||||
"syscall" | |||||
) | |||||
func (f *file) Lock() error { | |||||
// Plan 9 uses a mode bit instead of explicit lock/unlock syscalls. | |||||
// | |||||
// Per http://man.cat-v.org/plan_9/5/stat: “Exclusive use files may be open | |||||
// for I/O by only one fid at a time across all clients of the server. If a | |||||
// second open is attempted, it draws an error.” | |||||
// | |||||
// There is no obvious way to implement this function using the exclusive use bit. | |||||
// See https://golang.org/src/cmd/go/internal/lockedfile/lockedfile_plan9.go | |||||
// for how file locking is done by the go tool on Plan 9. | |||||
return nil | |||||
} | |||||
func (f *file) Unlock() error { | |||||
return nil | |||||
} | |||||
func rename(from, to string) error { | |||||
// If from and to are in different directories, copy the file | |||||
// since Plan 9 does not support cross-directory rename. | |||||
if filepath.Dir(from) != filepath.Dir(to) { | |||||
fi, err := os.Stat(from) | |||||
if err != nil { | |||||
return &os.LinkError{"rename", from, to, err} | |||||
} | |||||
if fi.Mode().IsDir() { | |||||
return &os.LinkError{"rename", from, to, syscall.EISDIR} | |||||
} | |||||
fromFile, err := os.Open(from) | |||||
if err != nil { | |||||
return &os.LinkError{"rename", from, to, err} | |||||
} | |||||
toFile, err := os.OpenFile(to, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, fi.Mode()) | |||||
if err != nil { | |||||
return &os.LinkError{"rename", from, to, err} | |||||
} | |||||
_, err = io.Copy(toFile, fromFile) | |||||
if err != nil { | |||||
return &os.LinkError{"rename", from, to, err} | |||||
} | |||||
// Copy mtime and mode from original file. | |||||
// We need only one syscall if we avoid os.Chmod and os.Chtimes. | |||||
dir := fi.Sys().(*syscall.Dir) | |||||
var d syscall.Dir | |||||
d.Null() | |||||
d.Mtime = dir.Mtime | |||||
d.Mode = dir.Mode | |||||
if err = dirwstat(to, &d); err != nil { | |||||
return &os.LinkError{"rename", from, to, err} | |||||
} | |||||
// Remove original file. | |||||
err = os.Remove(from) | |||||
if err != nil { | |||||
return &os.LinkError{"rename", from, to, err} | |||||
} | |||||
return nil | |||||
} | |||||
return os.Rename(from, to) | |||||
} | |||||
func dirwstat(name string, d *syscall.Dir) error { | |||||
var buf [syscall.STATFIXLEN]byte | |||||
n, err := d.Marshal(buf[:]) | |||||
if err != nil { | |||||
return &os.PathError{"dirwstat", name, err} | |||||
} | |||||
if err = syscall.Wstat(name, buf[:n]); err != nil { | |||||
return &os.PathError{"dirwstat", name, err} | |||||
} | |||||
return nil | |||||
} |
// +build !windows | |||||
// +build !plan9,!windows | |||||
package osfs | package osfs | ||||
import ( | import ( | ||||
"os" | |||||
"golang.org/x/sys/unix" | "golang.org/x/sys/unix" | ||||
) | ) | ||||
return unix.Flock(int(f.File.Fd()), unix.LOCK_UN) | return unix.Flock(int(f.File.Fd()), unix.LOCK_UN) | ||||
} | } | ||||
func rename(from, to string) error { | |||||
return os.Rename(from, to) | |||||
} |
} | } | ||||
return nil | return nil | ||||
} | } | ||||
func rename(from, to string) error { | |||||
return os.Rename(from, to) | |||||
} |
"sort" | "sort" | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-billy.v4" | |||||
"github.com/go-git/go-billy/v5" | |||||
) | ) | ||||
// Glob returns the names of all files matching pattern or nil | // Glob returns the names of all files matching pattern or nil |
"sync" | "sync" | ||||
"time" | "time" | ||||
"gopkg.in/src-d/go-billy.v4" | |||||
"github.com/go-git/go-billy/v5" | |||||
) | ) | ||||
// RemoveAll removes path and any children it contains. It removes everything it | // RemoveAll removes path and any children it contains. It removes everything it |
| init | ✔ | Plain init and `--bare` are supported. Flags `--template`, `--separate-git-dir` and `--shared` are not. | | | init | ✔ | Plain init and `--bare` are supported. Flags `--template`, `--separate-git-dir` and `--shared` are not. | | ||||
| clone | ✔ | Plain clone and equivalents to `--progress`, `--single-branch`, `--depth`, `--origin`, `--recurse-submodules` are supported. Others are not. | | | clone | ✔ | Plain clone and equivalents to `--progress`, `--single-branch`, `--depth`, `--origin`, `--recurse-submodules` are supported. Others are not. | | ||||
| **basic snapshotting** | | | **basic snapshotting** | | ||||
| add | ✔ | Plain add is supported. Any other flag aren't supported | | |||||
| add | ✔ | Plain add is supported. Any other flags aren't supported | | |||||
| status | ✔ | | | status | ✔ | | ||||
| commit | ✔ | | | commit | ✔ | | ||||
| reset | ✔ | | | reset | ✔ | |
conventions on development workflow, commit message formatting, contact points, | conventions on development workflow, commit message formatting, contact points, | ||||
and other resources to make it easier to get your contribution accepted. | and other resources to make it easier to get your contribution accepted. | ||||
## Certificate of Origin | |||||
By contributing to this project you agree to the [Developer Certificate of | |||||
Origin (DCO)](DCO). This document was created by the Linux Kernel community and is a | |||||
simple statement that you, as a contributor, have the legal right to make the | |||||
contribution. | |||||
In order to show your agreement with the DCO you should include at the end of commit message, | |||||
the following line: `Signed-off-by: John Doe <john.doe@example.com>`, using your real name. | |||||
This can be done easily using the [`-s`](https://github.com/git/git/blob/b2c150d3aa82f6583b9aadfecc5f8fa1c74aca09/Documentation/git-commit.txt#L154-L161) flag on the `git commit`. | |||||
## Support Channels | ## Support Channels | ||||
The official support channels, for both users and contributors, are: | The official support channels, for both users and contributors, are: | ||||
- [StackOverflow go-git tag](https://stackoverflow.com/questions/tagged/go-git) for user questions. | - [StackOverflow go-git tag](https://stackoverflow.com/questions/tagged/go-git) for user questions. | ||||
- GitHub [Issues](https://github.com/src-d/go-git/issues)* for bug reports and feature requests. | - GitHub [Issues](https://github.com/src-d/go-git/issues)* for bug reports and feature requests. | ||||
- Slack: #go-git room in the [source{d} Slack](https://join.slack.com/t/sourced-community/shared_invite/enQtMjc4Njk5MzEyNzM2LTFjNzY4NjEwZGEwMzRiNTM4MzRlMzQ4MmIzZjkwZmZlM2NjODUxZmJjNDI1OTcxNDAyMmZlNmFjODZlNTg0YWM) | |||||
*Before opening a new issue or submitting a new pull request, it's helpful to | *Before opening a new issue or submitting a new pull request, it's helpful to | ||||
search the project - it's likely that another user has already reported the | search the project - it's likely that another user has already reported the | ||||
- They should in general include tests, and those shall pass. | - They should in general include tests, and those shall pass. | ||||
- If the PR is a bug fix, it has to include a suite of unit tests for the new functionality. | - If the PR is a bug fix, it has to include a suite of unit tests for the new functionality. | ||||
- If the PR is a new feature, it has to come with a suite of unit tests, that tests the new functionality. | - If the PR is a new feature, it has to come with a suite of unit tests, that tests the new functionality. | ||||
- In any case, all the PRs have to pass the personal evaluation of at least one of the [maintainers](MAINTAINERS) of go-git. | |||||
- In any case, all the PRs have to pass the personal evaluation of at least one of the maintainers of go-git. | |||||
### Format of the commit message | ### Format of the commit message | ||||
# General | |||||
WORKDIR = $(PWD) | |||||
# Go parameters | |||||
GOCMD = go | |||||
GOTEST = $(GOCMD) test | |||||
# Git config | |||||
GIT_VERSION ?= | |||||
GIT_DIST_PATH ?= $(PWD)/.git-dist | |||||
GIT_REPOSITORY = http://github.com/git/git.git | |||||
# Coverage | |||||
COVERAGE_REPORT = coverage.out | |||||
COVERAGE_MODE = count | |||||
build-git: | |||||
@if [ -f $(GIT_DIST_PATH)/git ]; then \ | |||||
echo "nothing to do, using cache $(GIT_DIST_PATH)"; \ | |||||
else \ | |||||
git clone $(GIT_REPOSITORY) -b $(GIT_VERSION) --depth 1 --single-branch $(GIT_DIST_PATH); \ | |||||
cd $(GIT_DIST_PATH); \ | |||||
make configure; \ | |||||
./configure; \ | |||||
make all; \ | |||||
fi | |||||
test: | |||||
@echo "running against `git version`"; \ | |||||
$(GOTEST) ./... | |||||
test-coverage: | |||||
@echo "running against `git version`"; \ | |||||
echo "" > $(COVERAGE_REPORT); \ | |||||
$(GOTEST) -coverprofile=$(COVERAGE_REPORT) -coverpkg=./... -covermode=$(COVERAGE_MODE) ./... | |||||
clean: | |||||
rm -rf $(GIT_DIST_PATH) |
![go-git logo](https://cdn.rawgit.com/src-d/artwork/02036484/go-git/files/go-git-github-readme-header.png) | ![go-git logo](https://cdn.rawgit.com/src-d/artwork/02036484/go-git/files/go-git-github-readme-header.png) | ||||
[![GoDoc](https://godoc.org/gopkg.in/src-d/go-git.v4?status.svg)](https://godoc.org/github.com/src-d/go-git) [![Build Status](https://travis-ci.org/src-d/go-git.svg)](https://travis-ci.org/src-d/go-git) [![Build status](https://ci.appveyor.com/api/projects/status/nyidskwifo4py6ub?svg=true)](https://ci.appveyor.com/project/mcuadros/go-git) [![codecov.io](https://codecov.io/github/src-d/go-git/coverage.svg)](https://codecov.io/github/src-d/go-git) [![Go Report Card](https://goreportcard.com/badge/github.com/src-d/go-git)](https://goreportcard.com/report/github.com/src-d/go-git) | |||||
[![GoDoc](https://godoc.org/github.com/go-git/go-git/v5?status.svg)](https://godoc.org/github.com/src-d/go-git) [![Build Status](https://github.com/go-git/go-git/workflows/Test%20&%20Coverage/badge.svg)](https://github.com/go-git/go-git/actions) [![Go Report Card](https://goreportcard.com/badge/github.com/src-d/go-git)](https://goreportcard.com/report/github.com/src-d/go-git) | |||||
*go-git* is a highly extensible git implementation library written in **pure Go**. | *go-git* is a highly extensible git implementation library written in **pure Go**. | ||||
It can be used to manipulate git repositories at low level *(plumbing)* or high level *(porcelain)*, through an idiomatic Go API. It also supports several types of storage, such as in-memory filesystems, or custom implementations thanks to the [`Storer`](https://godoc.org/gopkg.in/src-d/go-git.v4/plumbing/storer) interface. | |||||
It can be used to manipulate git repositories at low level *(plumbing)* or high level *(porcelain)*, through an idiomatic Go API. It also supports several types of storage, such as in-memory filesystems, or custom implementations, thanks to the [`Storer`](https://godoc.org/github.com/go-git/go-git/v5/plumbing/storer) interface. | |||||
It's being actively developed since 2015 and is being used extensively by [Keybase](https://keybase.io/blog/encrypted-git-for-everyone), [Gitea](https://gitea.io/en-us/) or [Pulumi](https://github.com/search?q=org%3Apulumi+go-git&type=Code), and by many other libraries and tools. | |||||
Project Status | |||||
-------------- | |||||
After the legal issues with the [`src-d`](https://github.com/src-d) organization, the lack of update for four months and the requirement to make a hard fork, the project is **now back to normality**. | |||||
The project is currently actively maintained by individual contributors, including several of the original authors, but also backed by a new company `gitsigth` where `go-git` is a critical component used at scale. | |||||
It's being actively developed since 2015 and is being used extensively by [source{d}](https://sourced.tech/) and [Keybase](https://keybase.io/blog/encrypted-git-for-everyone), and by many other libraries and tools. | |||||
Comparison with git | Comparison with git | ||||
------------------- | ------------------- | ||||
The recommended way to install *go-git* is: | The recommended way to install *go-git* is: | ||||
``` | |||||
go get -u gopkg.in/src-d/go-git.v4/... | |||||
```go | |||||
import "github.com/go-git/go-git/v5" // with go modules enabled (GO111MODULE=on or outside GOPATH) | |||||
import "github.com/go-git/go-git" // with go modules disabled | |||||
``` | ``` | ||||
> We use [gopkg.in](http://labix.org/gopkg.in) to version the API, this means that when `go get` clones the package, it's the latest tag matching `v4.*` that is cloned and not the master branch. | |||||
Examples | Examples | ||||
-------- | -------- | ||||
```go | ```go | ||||
// Clone the given repository to the given directory | // Clone the given repository to the given directory | ||||
Info("git clone https://github.com/src-d/go-git") | |||||
Info("git clone https://github.com/go-git/go-git") | |||||
_, err := git.PlainClone("/tmp/foo", false, &git.CloneOptions{ | _, err := git.PlainClone("/tmp/foo", false, &git.CloneOptions{ | ||||
URL: "https://github.com/src-d/go-git", | |||||
URL: "https://github.com/go-git/go-git", | |||||
Progress: os.Stdout, | Progress: os.Stdout, | ||||
}) | }) | ||||
```go | ```go | ||||
// Clones the given repository in memory, creating the remote, the local | // Clones the given repository in memory, creating the remote, the local | ||||
// branches and fetching the objects, exactly as: | // branches and fetching the objects, exactly as: | ||||
Info("git clone https://github.com/src-d/go-siva") | |||||
Info("git clone https://github.com/go-git/go-billy") | |||||
r, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{ | r, err := git.Clone(memory.NewStorage(), nil, &git.CloneOptions{ | ||||
URL: "https://github.com/src-d/go-siva", | |||||
URL: "https://github.com/go-git/go-billy", | |||||
}) | }) | ||||
CheckIfError(err) | CheckIfError(err) | ||||
Contribute | Contribute | ||||
---------- | ---------- | ||||
[Contributions](https://github.com/src-d/go-git/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) are more than welcome, if you are interested please take a look to | |||||
[Contributions](https://github.com/go-git/go-git/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) are more than welcome, if you are interested please take a look to | |||||
our [Contributing Guidelines](CONTRIBUTING.md). | our [Contributing Guidelines](CONTRIBUTING.md). | ||||
License | License |
"time" | "time" | ||||
"unicode/utf8" | "unicode/utf8" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"gopkg.in/src-d/go-git.v4/utils/diff" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
"github.com/go-git/go-git/v5/utils/diff" | |||||
) | ) | ||||
// BlameResult represents the result of a Blame operation. | // BlameResult represents the result of a Blame operation. |
import ( | import ( | ||||
"errors" | "errors" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
format "gopkg.in/src-d/go-git.v4/plumbing/format/config" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
format "github.com/go-git/go-git/v5/plumbing/format/config" | |||||
) | ) | ||||
var ( | var ( |
"sort" | "sort" | ||||
"strconv" | "strconv" | ||||
"gopkg.in/src-d/go-git.v4/internal/url" | |||||
format "gopkg.in/src-d/go-git.v4/plumbing/format/config" | |||||
"github.com/go-git/go-git/v5/internal/url" | |||||
format "github.com/go-git/go-git/v5/plumbing/format/config" | |||||
) | ) | ||||
const ( | const ( | ||||
) | ) | ||||
// Config contains the repository configuration | // Config contains the repository configuration | ||||
// ftp://www.kernel.org/pub/software/scm/git/docs/git-config.html#FILES | |||||
// https://www.kernel.org/pub/software/scm/git/docs/git-config.html#FILES | |||||
type Config struct { | type Config struct { | ||||
Core struct { | Core struct { | ||||
// IsBare if true this repository is assumed to be bare and has no | // IsBare if true this repository is assumed to be bare and has no |
"errors" | "errors" | ||||
"regexp" | "regexp" | ||||
format "gopkg.in/src-d/go-git.v4/plumbing/format/config" | |||||
format "github.com/go-git/go-git/v5/plumbing/format/config" | |||||
) | ) | ||||
var ( | var ( |
"errors" | "errors" | ||||
"strings" | "strings" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
) | ) | ||||
const ( | const ( |
// It is highly extensible, we have been following the open/close principle in | // It is highly extensible, we have been following the open/close principle in | ||||
// its design to facilitate extensions, mainly focusing the efforts on the | // its design to facilitate extensions, mainly focusing the efforts on the | ||||
// persistence of the objects. | // persistence of the objects. | ||||
package git // import "gopkg.in/src-d/go-git.v4" | |||||
package git |
module gopkg.in/src-d/go-git.v4 | |||||
module github.com/go-git/go-git/v5 | |||||
require ( | require ( | ||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 // indirect | |||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect | github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect | ||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 | github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 | ||||
github.com/emirpasic/gods v1.12.0 | github.com/emirpasic/gods v1.12.0 | ||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect | github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect | ||||
github.com/gliderlabs/ssh v0.2.2 | github.com/gliderlabs/ssh v0.2.2 | ||||
github.com/go-git/gcfg v1.5.0 | |||||
github.com/go-git/go-billy/v5 v5.0.0 | |||||
github.com/go-git/go-git-fixtures/v4 v4.0.1 | |||||
github.com/google/go-cmp v0.3.0 | github.com/google/go-cmp v0.3.0 | ||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 | github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 | ||||
github.com/jessevdk/go-flags v1.4.0 | github.com/jessevdk/go-flags v1.4.0 | ||||
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd | github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd | ||||
github.com/mitchellh/go-homedir v1.1.0 | github.com/mitchellh/go-homedir v1.1.0 | ||||
github.com/pelletier/go-buffruneio v0.2.0 // indirect | |||||
github.com/pkg/errors v0.8.1 // indirect | github.com/pkg/errors v0.8.1 // indirect | ||||
github.com/sergi/go-diff v1.0.0 | |||||
github.com/src-d/gcfg v1.4.0 | |||||
github.com/stretchr/objx v0.2.0 // indirect | |||||
github.com/sergi/go-diff v1.1.0 | |||||
github.com/xanzy/ssh-agent v0.2.1 | github.com/xanzy/ssh-agent v0.2.1 | ||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 | |||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 | |||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 | |||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a | |||||
golang.org/x/text v0.3.2 | golang.org/x/text v0.3.2 | ||||
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a // indirect | |||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 | |||||
gopkg.in/src-d/go-billy.v4 v4.3.2 | |||||
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0 | |||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f | |||||
gopkg.in/warnings.v0 v0.1.2 // indirect | gopkg.in/warnings.v0 v0.1.2 // indirect | ||||
) | ) | ||||
go 1.13 |
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= | github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= | ||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= | github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= | ||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= | github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= | ||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= | |||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= | |||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||||
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= | github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= | ||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= | github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= | ||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= | github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= | ||||
github.com/gliderlabs/ssh v0.1.3 h1:cBU46h1lYQk5f2Z+jZbewFKy+1zzE2aUX/ilcPDAm9M= | |||||
github.com/gliderlabs/ssh v0.1.3/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= | |||||
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= | github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0= | ||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= | github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= | ||||
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= | |||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= | |||||
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= | |||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= | |||||
github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agRrHM= | |||||
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= | |||||
github.com/go-git/go-git-fixtures/v4 v4.0.1 h1:q+IFMfLx200Q3scvt2hN79JsEzy4AmBTp/pqnefH+Bc= | |||||
github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw= | |||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= | |||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | ||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= | github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= | ||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= | github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= | ||||
github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= | github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= | ||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= | github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= | ||||
github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e h1:RgQk53JHp/Cjunrr1WlsXSZpqXn+uREuHvUVcK82CV8= | |||||
github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= | |||||
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd h1:Coekwdh0v2wtGp9Gmz1Ze3eVRAWJMLokvN3QjdzCHLY= | github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd h1:Coekwdh0v2wtGp9Gmz1Ze3eVRAWJMLokvN3QjdzCHLY= | ||||
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= | github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= | ||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= | github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= | ||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= | ||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= | ||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= | |||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= | ||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= | ||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= | |||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= | |||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= | github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= | ||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= | github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= | ||||
github.com/pelletier/go-buffruneio v0.2.0 h1:U4t4R6YkofJ5xHm3dJzuRpPZ0mr5MMCoAWooScCR7aA= | |||||
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo= | |||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= | |||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= | |||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= | github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= | ||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= | ||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= | |||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= | |||||
github.com/src-d/gcfg v1.4.0 h1:xXbNR5AlLSA315x2UO+fTSSAXCDf+Ar38/6oyGbDKQ4= | |||||
github.com/src-d/gcfg v1.4.0/go.mod h1:p/UMsR43ujA89BJY9duynAwIpvqEujIH/jFlfL7jWoI= | |||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= | |||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= | |||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= | |||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= | |||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | |||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= | |||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= | |||||
github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70= | github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70= | ||||
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= | github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= | ||||
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= | ||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= | ||||
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd h1:sMHc2rZHuzQmrbVoSpt9HgerkXPyIeCSO6k0zUMGfFk= | |||||
golang.org/x/crypto v0.0.0-20190422183909-d864b10871cd/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | |||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= | |||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= | |||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM= | |||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= | |||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | ||||
golang.org/x/net v0.0.0-20190420063019-afa5a82059c6 h1:HdqqaWmYAUI7/dmByKKEw+yxDksGSo+9GjkUc9Zp34E= | |||||
golang.org/x/net v0.0.0-20190420063019-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | |||||
golang.org/x/net v0.0.0-20190502183928-7f726cade0ab h1:9RfW3ktsOZxgo9YNbBAjq1FWzc/igwEcUzZz8IXgSbk= | |||||
golang.org/x/net v0.0.0-20190502183928-7f726cade0ab/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= | |||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | |||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk= | |||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | |||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | |||||
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9 h1:lkiLiLBHGoH3XnqSLUIaBsilGMUjI+Uy2Xu2JLUtTas= | |||||
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | |||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= | |||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= | |||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | ||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= | |||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e h1:D5TXcfTk7xF7hvieo4QErS3qqCB4teTffacDWr7CI+0= | |||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So= | |||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | |||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= | golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= | ||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= | ||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= | |||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= | ||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= | |||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= | |||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | |||||
gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek= | |||||
gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk= | |||||
gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg= | |||||
gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98= | |||||
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0 h1:ivZFOIltbce2Mo8IjzUHAFoq/IylO9WHhNOAJK+LsJg= | |||||
gopkg.in/src-d/go-git-fixtures.v3 v3.5.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g= | |||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | |||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | |||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= | |||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | |||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= | gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= | ||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= | gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= | ||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= | |||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= | |||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= |
// Package revision extracts git revision from string | // Package revision extracts git revision from string | ||||
// More informations about revision : https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html | |||||
// More information about revision : https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html | |||||
package revision | package revision | ||||
import ( | import ( |
// validates it belongs to a rune category | // validates it belongs to a rune category | ||||
type runeCategoryValidator func(r rune) bool | type runeCategoryValidator func(r rune) bool | ||||
// tokenizeExpression aggegates a series of runes matching check predicate into a single | |||||
// tokenizeExpression aggregates a series of runes matching check predicate into a single | |||||
// string and provides given tokenType as token type | // string and provides given tokenType as token type | ||||
func tokenizeExpression(ch rune, tokenType token, check runeCategoryValidator, r *bufio.Reader) (token, string, error) { | func tokenizeExpression(ch rune, tokenType token, check runeCategoryValidator, r *bufio.Reader) (token, string, error) { | ||||
var data []rune | var data []rune |
var ( | var ( | ||||
isSchemeRegExp = regexp.MustCompile(`^[^:]+://`) | isSchemeRegExp = regexp.MustCompile(`^[^:]+://`) | ||||
scpLikeUrlRegExp = regexp.MustCompile(`^(?:(?P<user>[^@]+)@)?(?P<host>[^:\s]+):(?:(?P<port>[0-9]{1,5})/)?(?P<path>[^\\].*)$`) | |||||
scpLikeUrlRegExp = regexp.MustCompile(`^(?:(?P<user>[^@]+)@)?(?P<host>[^:\s]+):(?:(?P<port>[0-9]{1,5})(?:\/|:))?(?P<path>[^\\].*\/[^\\].*)$`) | |||||
) | ) | ||||
// MatchesScheme returns true if the given string matches a URL-like | // MatchesScheme returns true if the given string matches a URL-like |
import ( | import ( | ||||
"fmt" | "fmt" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/filemode" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"gopkg.in/src-d/go-git.v4/storage" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing/filemode" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
"github.com/go-git/go-git/v5/storage" | |||||
) | ) | ||||
type objectWalker struct { | type objectWalker struct { | ||||
return &objectWalker{s, map[plumbing.Hash]struct{}{}} | return &objectWalker{s, map[plumbing.Hash]struct{}{}} | ||||
} | } | ||||
// walkAllRefs walks all (hash) refererences from the repo. | |||||
// walkAllRefs walks all (hash) references from the repo. | |||||
func (p *objectWalker) walkAllRefs() error { | func (p *objectWalker) walkAllRefs() error { | ||||
// Walk over all the references in the repo. | // Walk over all the references in the repo. | ||||
it, err := p.Storer.IterReferences() | it, err := p.Storer.IterReferences() |
"errors" | "errors" | ||||
"regexp" | "regexp" | ||||
"strings" | "strings" | ||||
"time" | |||||
"golang.org/x/crypto/openpgp" | "golang.org/x/crypto/openpgp" | ||||
"gopkg.in/src-d/go-git.v4/config" | |||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/object" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/protocol/packp/sideband" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/transport" | |||||
"github.com/go-git/go-git/v5/config" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing/object" | |||||
"github.com/go-git/go-git/v5/plumbing/protocol/packp/sideband" | |||||
"github.com/go-git/go-git/v5/plumbing/transport" | |||||
) | ) | ||||
// SubmoduleRescursivity defines how depth will affect any submodule recursive | // SubmoduleRescursivity defines how depth will affect any submodule recursive | ||||
// Show only those commits in which the specified file was inserted/updated. | // Show only those commits in which the specified file was inserted/updated. | ||||
// It is equivalent to running `git log -- <file-name>`. | // It is equivalent to running `git log -- <file-name>`. | ||||
// this field is kept for compatility, it can be replaced with PathFilter | |||||
FileName *string | FileName *string | ||||
// Filter commits based on the path of files that are updated | |||||
// takes file path as argument and should return true if the file is desired | |||||
// It can be used to implement `git log -- <path>` | |||||
// either <path> is a file path, or directory path, or a regexp of file/directory path | |||||
PathFilter func(string) bool | |||||
// Pretend as if all the refs in refs/, along with HEAD, are listed on the command line as <commit>. | // Pretend as if all the refs in refs/, along with HEAD, are listed on the command line as <commit>. | ||||
// It is equivalent to running `git log --all`. | // It is equivalent to running `git log --all`. | ||||
// If set on true, the From option will be ignored. | // If set on true, the From option will be ignored. | ||||
All bool | All bool | ||||
// Show commits more recent than a specific date. | |||||
// It is equivalent to running `git log --since <date>` or `git log --after <date>`. | |||||
Since *time.Time | |||||
// Show commits older than a specific date. | |||||
// It is equivalent to running `git log --until <date>` or `git log --before <date>`. | |||||
Until *time.Time | |||||
} | } | ||||
var ( | var ( |
package cache | package cache | ||||
import "gopkg.in/src-d/go-git.v4/plumbing" | |||||
import "github.com/go-git/go-git/v5/plumbing" | |||||
const ( | const ( | ||||
Byte FileSize = 1 << (iota * 10) | Byte FileSize = 1 << (iota * 10) |
"container/list" | "container/list" | ||||
"sync" | "sync" | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
) | ) | ||||
// ObjectLRU implements an object cache with an LRU eviction policy and a | // ObjectLRU implements an object cache with an LRU eviction policy and a |
Regular FileMode = 0100644 | Regular FileMode = 0100644 | ||||
// Deprecated represent non-executable files with the group writable | // Deprecated represent non-executable files with the group writable | ||||
// bit set. This mode was supported by the first versions of git, | // bit set. This mode was supported by the first versions of git, | ||||
// but it has been deprecatred nowadays. This library uses them | |||||
// but it has been deprecated nowadays. This library uses them | |||||
// internally, so you can read old packfiles, but will treat them as | // internally, so you can read old packfiles, but will treat them as | ||||
// Regulars when interfacing with the outside world. This is the | // Regulars when interfacing with the outside world. This is the | ||||
// standard git behaviuor. | |||||
// standard git behaviour. | |||||
Deprecated FileMode = 0100664 | Deprecated FileMode = 0100664 | ||||
// Executable represents executable files. | // Executable represents executable files. | ||||
Executable FileMode = 0100755 | Executable FileMode = 0100755 | ||||
} | } | ||||
// IsFile returns if the FileMode represents that of a file, this is, | // IsFile returns if the FileMode represents that of a file, this is, | ||||
// Regular, Deprecated, Excutable or Link. | |||||
// Regular, Deprecated, Executable or Link. | |||||
func (m FileMode) IsFile() bool { | func (m FileMode) IsFile() bool { | ||||
return m == Regular || | return m == Regular || | ||||
m == Deprecated || | m == Deprecated || |
package commitgraph | |||||
import ( | |||||
"time" | |||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
) | |||||
// CommitData is a reduced representation of Commit as presented in the commit graph | |||||
// file. It is merely useful as an optimization for walking the commit graphs. | |||||
type CommitData struct { | |||||
// TreeHash is the hash of the root tree of the commit. | |||||
TreeHash plumbing.Hash | |||||
// ParentIndexes are the indexes of the parent commits of the commit. | |||||
ParentIndexes []int | |||||
// ParentHashes are the hashes of the parent commits of the commit. | |||||
ParentHashes []plumbing.Hash | |||||
// Generation number is the pre-computed generation in the commit graph | |||||
// or zero if not available | |||||
Generation int | |||||
// When is the timestamp of the commit. | |||||
When time.Time | |||||
} | |||||
// Index represents a representation of commit graph that allows indexed | |||||
// access to the nodes using commit object hash | |||||
type Index interface { | |||||
// GetIndexByHash gets the index in the commit graph from commit hash, if available | |||||
GetIndexByHash(h plumbing.Hash) (int, error) | |||||
// GetNodeByIndex gets the commit node from the commit graph using index | |||||
// obtained from child node, if available | |||||
GetCommitDataByIndex(i int) (*CommitData, error) | |||||
// Hashes returns all the hashes that are available in the index | |||||
Hashes() []plumbing.Hash | |||||
} | |||||
package commitgraph | |||||
import ( | |||||
"time" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
) | |||||
// CommitData is a reduced representation of Commit as presented in the commit graph | |||||
// file. It is merely useful as an optimization for walking the commit graphs. | |||||
type CommitData struct { | |||||
// TreeHash is the hash of the root tree of the commit. | |||||
TreeHash plumbing.Hash | |||||
// ParentIndexes are the indexes of the parent commits of the commit. | |||||
ParentIndexes []int | |||||
// ParentHashes are the hashes of the parent commits of the commit. | |||||
ParentHashes []plumbing.Hash | |||||
// Generation number is the pre-computed generation in the commit graph | |||||
// or zero if not available | |||||
Generation int | |||||
// When is the timestamp of the commit. | |||||
When time.Time | |||||
} | |||||
// Index represents a representation of commit graph that allows indexed | |||||
// access to the nodes using commit object hash | |||||
type Index interface { | |||||
// GetIndexByHash gets the index in the commit graph from commit hash, if available | |||||
GetIndexByHash(h plumbing.Hash) (int, error) | |||||
// GetNodeByIndex gets the commit node from the commit graph using index | |||||
// obtained from child node, if available | |||||
GetCommitDataByIndex(i int) (*CommitData, error) | |||||
// Hashes returns all the hashes that are available in the index | |||||
Hashes() []plumbing.Hash | |||||
} |
package commitgraph | |||||
import ( | |||||
"crypto/sha1" | |||||
"hash" | |||||
"io" | |||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/utils/binary" | |||||
) | |||||
// Encoder writes MemoryIndex structs to an output stream. | |||||
type Encoder struct { | |||||
io.Writer | |||||
hash hash.Hash | |||||
} | |||||
// NewEncoder returns a new stream encoder that writes to w. | |||||
func NewEncoder(w io.Writer) *Encoder { | |||||
h := sha1.New() | |||||
mw := io.MultiWriter(w, h) | |||||
return &Encoder{mw, h} | |||||
} | |||||
// Encode writes an index into the commit-graph file | |||||
func (e *Encoder) Encode(idx Index) error { | |||||
// Get all the hashes in the input index | |||||
hashes := idx.Hashes() | |||||
// Sort the inout and prepare helper structures we'll need for encoding | |||||
hashToIndex, fanout, extraEdgesCount := e.prepare(idx, hashes) | |||||
chunkSignatures := [][]byte{oidFanoutSignature, oidLookupSignature, commitDataSignature} | |||||
chunkSizes := []uint64{4 * 256, uint64(len(hashes)) * 20, uint64(len(hashes)) * 36} | |||||
if extraEdgesCount > 0 { | |||||
chunkSignatures = append(chunkSignatures, extraEdgeListSignature) | |||||
chunkSizes = append(chunkSizes, uint64(extraEdgesCount)*4) | |||||
} | |||||
if err := e.encodeFileHeader(len(chunkSignatures)); err != nil { | |||||
return err | |||||
} | |||||
if err := e.encodeChunkHeaders(chunkSignatures, chunkSizes); err != nil { | |||||
return err | |||||
} | |||||
if err := e.encodeFanout(fanout); err != nil { | |||||
return err | |||||
} | |||||
if err := e.encodeOidLookup(hashes); err != nil { | |||||
return err | |||||
} | |||||
if extraEdges, err := e.encodeCommitData(hashes, hashToIndex, idx); err == nil { | |||||
if err = e.encodeExtraEdges(extraEdges); err != nil { | |||||
return err | |||||
} | |||||
} else { | |||||
return err | |||||
} | |||||
return e.encodeChecksum() | |||||
} | |||||
func (e *Encoder) prepare(idx Index, hashes []plumbing.Hash) (hashToIndex map[plumbing.Hash]uint32, fanout []uint32, extraEdgesCount uint32) { | |||||
// Sort the hashes and build our index | |||||
plumbing.HashesSort(hashes) | |||||
hashToIndex = make(map[plumbing.Hash]uint32) | |||||
fanout = make([]uint32, 256) | |||||
for i, hash := range hashes { | |||||
hashToIndex[hash] = uint32(i) | |||||
fanout[hash[0]]++ | |||||
} | |||||
// Convert the fanout to cumulative values | |||||
for i := 1; i <= 0xff; i++ { | |||||
fanout[i] += fanout[i-1] | |||||
} | |||||
// Find out if we will need extra edge table | |||||
for i := 0; i < len(hashes); i++ { | |||||
v, _ := idx.GetCommitDataByIndex(i) | |||||
if len(v.ParentHashes) > 2 { | |||||
extraEdgesCount += uint32(len(v.ParentHashes) - 1) | |||||
break | |||||
} | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeFileHeader(chunkCount int) (err error) { | |||||
if _, err = e.Write(commitFileSignature); err == nil { | |||||
_, err = e.Write([]byte{1, 1, byte(chunkCount), 0}) | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeChunkHeaders(chunkSignatures [][]byte, chunkSizes []uint64) (err error) { | |||||
// 8 bytes of file header, 12 bytes for each chunk header and 12 byte for terminator | |||||
offset := uint64(8 + len(chunkSignatures)*12 + 12) | |||||
for i, signature := range chunkSignatures { | |||||
if _, err = e.Write(signature); err == nil { | |||||
err = binary.WriteUint64(e, offset) | |||||
} | |||||
if err != nil { | |||||
return | |||||
} | |||||
offset += chunkSizes[i] | |||||
} | |||||
if _, err = e.Write(lastSignature); err == nil { | |||||
err = binary.WriteUint64(e, offset) | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeFanout(fanout []uint32) (err error) { | |||||
for i := 0; i <= 0xff; i++ { | |||||
if err = binary.WriteUint32(e, fanout[i]); err != nil { | |||||
return | |||||
} | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeOidLookup(hashes []plumbing.Hash) (err error) { | |||||
for _, hash := range hashes { | |||||
if _, err = e.Write(hash[:]); err != nil { | |||||
return err | |||||
} | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeCommitData(hashes []plumbing.Hash, hashToIndex map[plumbing.Hash]uint32, idx Index) (extraEdges []uint32, err error) { | |||||
for _, hash := range hashes { | |||||
origIndex, _ := idx.GetIndexByHash(hash) | |||||
commitData, _ := idx.GetCommitDataByIndex(origIndex) | |||||
if _, err = e.Write(commitData.TreeHash[:]); err != nil { | |||||
return | |||||
} | |||||
var parent1, parent2 uint32 | |||||
if len(commitData.ParentHashes) == 0 { | |||||
parent1 = parentNone | |||||
parent2 = parentNone | |||||
} else if len(commitData.ParentHashes) == 1 { | |||||
parent1 = hashToIndex[commitData.ParentHashes[0]] | |||||
parent2 = parentNone | |||||
} else if len(commitData.ParentHashes) == 2 { | |||||
parent1 = hashToIndex[commitData.ParentHashes[0]] | |||||
parent2 = hashToIndex[commitData.ParentHashes[1]] | |||||
} else if len(commitData.ParentHashes) > 2 { | |||||
parent1 = hashToIndex[commitData.ParentHashes[0]] | |||||
parent2 = uint32(len(extraEdges)) | parentOctopusUsed | |||||
for _, parentHash := range commitData.ParentHashes[1:] { | |||||
extraEdges = append(extraEdges, hashToIndex[parentHash]) | |||||
} | |||||
extraEdges[len(extraEdges)-1] |= parentLast | |||||
} | |||||
if err = binary.WriteUint32(e, parent1); err == nil { | |||||
err = binary.WriteUint32(e, parent2) | |||||
} | |||||
if err != nil { | |||||
return | |||||
} | |||||
unixTime := uint64(commitData.When.Unix()) | |||||
unixTime |= uint64(commitData.Generation) << 34 | |||||
if err = binary.WriteUint64(e, unixTime); err != nil { | |||||
return | |||||
} | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeExtraEdges(extraEdges []uint32) (err error) { | |||||
for _, parent := range extraEdges { | |||||
if err = binary.WriteUint32(e, parent); err != nil { | |||||
return | |||||
} | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeChecksum() error { | |||||
_, err := e.Write(e.hash.Sum(nil)[:20]) | |||||
return err | |||||
} | |||||
package commitgraph | |||||
import ( | |||||
"crypto/sha1" | |||||
"hash" | |||||
"io" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/utils/binary" | |||||
) | |||||
// Encoder writes MemoryIndex structs to an output stream. | |||||
type Encoder struct { | |||||
io.Writer | |||||
hash hash.Hash | |||||
} | |||||
// NewEncoder returns a new stream encoder that writes to w. | |||||
func NewEncoder(w io.Writer) *Encoder { | |||||
h := sha1.New() | |||||
mw := io.MultiWriter(w, h) | |||||
return &Encoder{mw, h} | |||||
} | |||||
// Encode writes an index into the commit-graph file | |||||
func (e *Encoder) Encode(idx Index) error { | |||||
// Get all the hashes in the input index | |||||
hashes := idx.Hashes() | |||||
// Sort the inout and prepare helper structures we'll need for encoding | |||||
hashToIndex, fanout, extraEdgesCount := e.prepare(idx, hashes) | |||||
chunkSignatures := [][]byte{oidFanoutSignature, oidLookupSignature, commitDataSignature} | |||||
chunkSizes := []uint64{4 * 256, uint64(len(hashes)) * 20, uint64(len(hashes)) * 36} | |||||
if extraEdgesCount > 0 { | |||||
chunkSignatures = append(chunkSignatures, extraEdgeListSignature) | |||||
chunkSizes = append(chunkSizes, uint64(extraEdgesCount)*4) | |||||
} | |||||
if err := e.encodeFileHeader(len(chunkSignatures)); err != nil { | |||||
return err | |||||
} | |||||
if err := e.encodeChunkHeaders(chunkSignatures, chunkSizes); err != nil { | |||||
return err | |||||
} | |||||
if err := e.encodeFanout(fanout); err != nil { | |||||
return err | |||||
} | |||||
if err := e.encodeOidLookup(hashes); err != nil { | |||||
return err | |||||
} | |||||
if extraEdges, err := e.encodeCommitData(hashes, hashToIndex, idx); err == nil { | |||||
if err = e.encodeExtraEdges(extraEdges); err != nil { | |||||
return err | |||||
} | |||||
} else { | |||||
return err | |||||
} | |||||
return e.encodeChecksum() | |||||
} | |||||
func (e *Encoder) prepare(idx Index, hashes []plumbing.Hash) (hashToIndex map[plumbing.Hash]uint32, fanout []uint32, extraEdgesCount uint32) { | |||||
// Sort the hashes and build our index | |||||
plumbing.HashesSort(hashes) | |||||
hashToIndex = make(map[plumbing.Hash]uint32) | |||||
fanout = make([]uint32, 256) | |||||
for i, hash := range hashes { | |||||
hashToIndex[hash] = uint32(i) | |||||
fanout[hash[0]]++ | |||||
} | |||||
// Convert the fanout to cumulative values | |||||
for i := 1; i <= 0xff; i++ { | |||||
fanout[i] += fanout[i-1] | |||||
} | |||||
// Find out if we will need extra edge table | |||||
for i := 0; i < len(hashes); i++ { | |||||
v, _ := idx.GetCommitDataByIndex(i) | |||||
if len(v.ParentHashes) > 2 { | |||||
extraEdgesCount += uint32(len(v.ParentHashes) - 1) | |||||
break | |||||
} | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeFileHeader(chunkCount int) (err error) { | |||||
if _, err = e.Write(commitFileSignature); err == nil { | |||||
_, err = e.Write([]byte{1, 1, byte(chunkCount), 0}) | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeChunkHeaders(chunkSignatures [][]byte, chunkSizes []uint64) (err error) { | |||||
// 8 bytes of file header, 12 bytes for each chunk header and 12 byte for terminator | |||||
offset := uint64(8 + len(chunkSignatures)*12 + 12) | |||||
for i, signature := range chunkSignatures { | |||||
if _, err = e.Write(signature); err == nil { | |||||
err = binary.WriteUint64(e, offset) | |||||
} | |||||
if err != nil { | |||||
return | |||||
} | |||||
offset += chunkSizes[i] | |||||
} | |||||
if _, err = e.Write(lastSignature); err == nil { | |||||
err = binary.WriteUint64(e, offset) | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeFanout(fanout []uint32) (err error) { | |||||
for i := 0; i <= 0xff; i++ { | |||||
if err = binary.WriteUint32(e, fanout[i]); err != nil { | |||||
return | |||||
} | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeOidLookup(hashes []plumbing.Hash) (err error) { | |||||
for _, hash := range hashes { | |||||
if _, err = e.Write(hash[:]); err != nil { | |||||
return err | |||||
} | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeCommitData(hashes []plumbing.Hash, hashToIndex map[plumbing.Hash]uint32, idx Index) (extraEdges []uint32, err error) { | |||||
for _, hash := range hashes { | |||||
origIndex, _ := idx.GetIndexByHash(hash) | |||||
commitData, _ := idx.GetCommitDataByIndex(origIndex) | |||||
if _, err = e.Write(commitData.TreeHash[:]); err != nil { | |||||
return | |||||
} | |||||
var parent1, parent2 uint32 | |||||
if len(commitData.ParentHashes) == 0 { | |||||
parent1 = parentNone | |||||
parent2 = parentNone | |||||
} else if len(commitData.ParentHashes) == 1 { | |||||
parent1 = hashToIndex[commitData.ParentHashes[0]] | |||||
parent2 = parentNone | |||||
} else if len(commitData.ParentHashes) == 2 { | |||||
parent1 = hashToIndex[commitData.ParentHashes[0]] | |||||
parent2 = hashToIndex[commitData.ParentHashes[1]] | |||||
} else if len(commitData.ParentHashes) > 2 { | |||||
parent1 = hashToIndex[commitData.ParentHashes[0]] | |||||
parent2 = uint32(len(extraEdges)) | parentOctopusUsed | |||||
for _, parentHash := range commitData.ParentHashes[1:] { | |||||
extraEdges = append(extraEdges, hashToIndex[parentHash]) | |||||
} | |||||
extraEdges[len(extraEdges)-1] |= parentLast | |||||
} | |||||
if err = binary.WriteUint32(e, parent1); err == nil { | |||||
err = binary.WriteUint32(e, parent2) | |||||
} | |||||
if err != nil { | |||||
return | |||||
} | |||||
unixTime := uint64(commitData.When.Unix()) | |||||
unixTime |= uint64(commitData.Generation) << 34 | |||||
if err = binary.WriteUint64(e, unixTime); err != nil { | |||||
return | |||||
} | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeExtraEdges(extraEdges []uint32) (err error) { | |||||
for _, parent := range extraEdges { | |||||
if err = binary.WriteUint32(e, parent); err != nil { | |||||
return | |||||
} | |||||
} | |||||
return | |||||
} | |||||
func (e *Encoder) encodeChecksum() error { | |||||
_, err := e.Write(e.hash.Sum(nil)[:20]) | |||||
return err | |||||
} |
package commitgraph | |||||
import ( | |||||
"bytes" | |||||
encbin "encoding/binary" | |||||
"errors" | |||||
"io" | |||||
"time" | |||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/utils/binary" | |||||
) | |||||
var ( | |||||
// ErrUnsupportedVersion is returned by OpenFileIndex when the commit graph | |||||
// file version is not supported. | |||||
ErrUnsupportedVersion = errors.New("Unsupported version") | |||||
// ErrUnsupportedHash is returned by OpenFileIndex when the commit graph | |||||
// hash function is not supported. Currently only SHA-1 is defined and | |||||
// supported | |||||
ErrUnsupportedHash = errors.New("Unsupported hash algorithm") | |||||
// ErrMalformedCommitGraphFile is returned by OpenFileIndex when the commit | |||||
// graph file is corrupted. | |||||
ErrMalformedCommitGraphFile = errors.New("Malformed commit graph file") | |||||
commitFileSignature = []byte{'C', 'G', 'P', 'H'} | |||||
oidFanoutSignature = []byte{'O', 'I', 'D', 'F'} | |||||
oidLookupSignature = []byte{'O', 'I', 'D', 'L'} | |||||
commitDataSignature = []byte{'C', 'D', 'A', 'T'} | |||||
extraEdgeListSignature = []byte{'E', 'D', 'G', 'E'} | |||||
lastSignature = []byte{0, 0, 0, 0} | |||||
parentNone = uint32(0x70000000) | |||||
parentOctopusUsed = uint32(0x80000000) | |||||
parentOctopusMask = uint32(0x7fffffff) | |||||
parentLast = uint32(0x80000000) | |||||
) | |||||
type fileIndex struct { | |||||
reader io.ReaderAt | |||||
fanout [256]int | |||||
oidFanoutOffset int64 | |||||
oidLookupOffset int64 | |||||
commitDataOffset int64 | |||||
extraEdgeListOffset int64 | |||||
} | |||||
// OpenFileIndex opens a serialized commit graph file in the format described at | |||||
// https://github.com/git/git/blob/master/Documentation/technical/commit-graph-format.txt | |||||
func OpenFileIndex(reader io.ReaderAt) (Index, error) { | |||||
fi := &fileIndex{reader: reader} | |||||
if err := fi.verifyFileHeader(); err != nil { | |||||
return nil, err | |||||
} | |||||
if err := fi.readChunkHeaders(); err != nil { | |||||
return nil, err | |||||
} | |||||
if err := fi.readFanout(); err != nil { | |||||
return nil, err | |||||
} | |||||
return fi, nil | |||||
} | |||||
func (fi *fileIndex) verifyFileHeader() error { | |||||
// Verify file signature | |||||
var signature = make([]byte, 4) | |||||
if _, err := fi.reader.ReadAt(signature, 0); err != nil { | |||||
return err | |||||
} | |||||
if !bytes.Equal(signature, commitFileSignature) { | |||||
return ErrMalformedCommitGraphFile | |||||
} | |||||
// Read and verify the file header | |||||
var header = make([]byte, 4) | |||||
if _, err := fi.reader.ReadAt(header, 4); err != nil { | |||||
return err | |||||
} | |||||
if header[0] != 1 { | |||||
return ErrUnsupportedVersion | |||||
} | |||||
if header[1] != 1 { | |||||
return ErrUnsupportedHash | |||||
} | |||||
return nil | |||||
} | |||||
func (fi *fileIndex) readChunkHeaders() error { | |||||
var chunkID = make([]byte, 4) | |||||
for i := 0; ; i++ { | |||||
chunkHeader := io.NewSectionReader(fi.reader, 8+(int64(i)*12), 12) | |||||
if _, err := io.ReadAtLeast(chunkHeader, chunkID, 4); err != nil { | |||||
return err | |||||
} | |||||
chunkOffset, err := binary.ReadUint64(chunkHeader) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
if bytes.Equal(chunkID, oidFanoutSignature) { | |||||
fi.oidFanoutOffset = int64(chunkOffset) | |||||
} else if bytes.Equal(chunkID, oidLookupSignature) { | |||||
fi.oidLookupOffset = int64(chunkOffset) | |||||
} else if bytes.Equal(chunkID, commitDataSignature) { | |||||
fi.commitDataOffset = int64(chunkOffset) | |||||
} else if bytes.Equal(chunkID, extraEdgeListSignature) { | |||||
fi.extraEdgeListOffset = int64(chunkOffset) | |||||
} else if bytes.Equal(chunkID, lastSignature) { | |||||
break | |||||
} | |||||
} | |||||
if fi.oidFanoutOffset <= 0 || fi.oidLookupOffset <= 0 || fi.commitDataOffset <= 0 { | |||||
return ErrMalformedCommitGraphFile | |||||
} | |||||
return nil | |||||
} | |||||
func (fi *fileIndex) readFanout() error { | |||||
fanoutReader := io.NewSectionReader(fi.reader, fi.oidFanoutOffset, 256*4) | |||||
for i := 0; i < 256; i++ { | |||||
fanoutValue, err := binary.ReadUint32(fanoutReader) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
if fanoutValue > 0x7fffffff { | |||||
return ErrMalformedCommitGraphFile | |||||
} | |||||
fi.fanout[i] = int(fanoutValue) | |||||
} | |||||
return nil | |||||
} | |||||
func (fi *fileIndex) GetIndexByHash(h plumbing.Hash) (int, error) { | |||||
var oid plumbing.Hash | |||||
// Find the hash in the oid lookup table | |||||
var low int | |||||
if h[0] == 0 { | |||||
low = 0 | |||||
} else { | |||||
low = fi.fanout[h[0]-1] | |||||
} | |||||
high := fi.fanout[h[0]] | |||||
for low < high { | |||||
mid := (low + high) >> 1 | |||||
offset := fi.oidLookupOffset + int64(mid)*20 | |||||
if _, err := fi.reader.ReadAt(oid[:], offset); err != nil { | |||||
return 0, err | |||||
} | |||||
cmp := bytes.Compare(h[:], oid[:]) | |||||
if cmp < 0 { | |||||
high = mid | |||||
} else if cmp == 0 { | |||||
return mid, nil | |||||
} else { | |||||
low = mid + 1 | |||||
} | |||||
} | |||||
return 0, plumbing.ErrObjectNotFound | |||||
} | |||||
func (fi *fileIndex) GetCommitDataByIndex(idx int) (*CommitData, error) { | |||||
if idx >= fi.fanout[0xff] { | |||||
return nil, plumbing.ErrObjectNotFound | |||||
} | |||||
offset := fi.commitDataOffset + int64(idx)*36 | |||||
commitDataReader := io.NewSectionReader(fi.reader, offset, 36) | |||||
treeHash, err := binary.ReadHash(commitDataReader) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
parent1, err := binary.ReadUint32(commitDataReader) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
parent2, err := binary.ReadUint32(commitDataReader) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
genAndTime, err := binary.ReadUint64(commitDataReader) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
var parentIndexes []int | |||||
if parent2&parentOctopusUsed == parentOctopusUsed { | |||||
// Octopus merge | |||||
parentIndexes = []int{int(parent1 & parentOctopusMask)} | |||||
offset := fi.extraEdgeListOffset + 4*int64(parent2&parentOctopusMask) | |||||
buf := make([]byte, 4) | |||||
for { | |||||
_, err := fi.reader.ReadAt(buf, offset) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
parent := encbin.BigEndian.Uint32(buf) | |||||
offset += 4 | |||||
parentIndexes = append(parentIndexes, int(parent&parentOctopusMask)) | |||||
if parent&parentLast == parentLast { | |||||
break | |||||
} | |||||
} | |||||
} else if parent2 != parentNone { | |||||
parentIndexes = []int{int(parent1 & parentOctopusMask), int(parent2 & parentOctopusMask)} | |||||
} else if parent1 != parentNone { | |||||
parentIndexes = []int{int(parent1 & parentOctopusMask)} | |||||
} | |||||
parentHashes, err := fi.getHashesFromIndexes(parentIndexes) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
return &CommitData{ | |||||
TreeHash: treeHash, | |||||
ParentIndexes: parentIndexes, | |||||
ParentHashes: parentHashes, | |||||
Generation: int(genAndTime >> 34), | |||||
When: time.Unix(int64(genAndTime&0x3FFFFFFFF), 0), | |||||
}, nil | |||||
} | |||||
func (fi *fileIndex) getHashesFromIndexes(indexes []int) ([]plumbing.Hash, error) { | |||||
hashes := make([]plumbing.Hash, len(indexes)) | |||||
for i, idx := range indexes { | |||||
if idx >= fi.fanout[0xff] { | |||||
return nil, ErrMalformedCommitGraphFile | |||||
} | |||||
offset := fi.oidLookupOffset + int64(idx)*20 | |||||
if _, err := fi.reader.ReadAt(hashes[i][:], offset); err != nil { | |||||
return nil, err | |||||
} | |||||
} | |||||
return hashes, nil | |||||
} | |||||
// Hashes returns all the hashes that are available in the index | |||||
func (fi *fileIndex) Hashes() []plumbing.Hash { | |||||
hashes := make([]plumbing.Hash, fi.fanout[0xff]) | |||||
for i := 0; i < fi.fanout[0xff]; i++ { | |||||
offset := fi.oidLookupOffset + int64(i)*20 | |||||
if n, err := fi.reader.ReadAt(hashes[i][:], offset); err != nil || n < 20 { | |||||
return nil | |||||
} | |||||
} | |||||
return hashes | |||||
} | |||||
package commitgraph | |||||
import ( | |||||
"bytes" | |||||
encbin "encoding/binary" | |||||
"errors" | |||||
"io" | |||||
"time" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/utils/binary" | |||||
) | |||||
var ( | |||||
// ErrUnsupportedVersion is returned by OpenFileIndex when the commit graph | |||||
// file version is not supported. | |||||
ErrUnsupportedVersion = errors.New("Unsupported version") | |||||
// ErrUnsupportedHash is returned by OpenFileIndex when the commit graph | |||||
// hash function is not supported. Currently only SHA-1 is defined and | |||||
// supported | |||||
ErrUnsupportedHash = errors.New("Unsupported hash algorithm") | |||||
// ErrMalformedCommitGraphFile is returned by OpenFileIndex when the commit | |||||
// graph file is corrupted. | |||||
ErrMalformedCommitGraphFile = errors.New("Malformed commit graph file") | |||||
commitFileSignature = []byte{'C', 'G', 'P', 'H'} | |||||
oidFanoutSignature = []byte{'O', 'I', 'D', 'F'} | |||||
oidLookupSignature = []byte{'O', 'I', 'D', 'L'} | |||||
commitDataSignature = []byte{'C', 'D', 'A', 'T'} | |||||
extraEdgeListSignature = []byte{'E', 'D', 'G', 'E'} | |||||
lastSignature = []byte{0, 0, 0, 0} | |||||
parentNone = uint32(0x70000000) | |||||
parentOctopusUsed = uint32(0x80000000) | |||||
parentOctopusMask = uint32(0x7fffffff) | |||||
parentLast = uint32(0x80000000) | |||||
) | |||||
type fileIndex struct { | |||||
reader io.ReaderAt | |||||
fanout [256]int | |||||
oidFanoutOffset int64 | |||||
oidLookupOffset int64 | |||||
commitDataOffset int64 | |||||
extraEdgeListOffset int64 | |||||
} | |||||
// OpenFileIndex opens a serialized commit graph file in the format described at | |||||
// https://github.com/git/git/blob/master/Documentation/technical/commit-graph-format.txt | |||||
func OpenFileIndex(reader io.ReaderAt) (Index, error) { | |||||
fi := &fileIndex{reader: reader} | |||||
if err := fi.verifyFileHeader(); err != nil { | |||||
return nil, err | |||||
} | |||||
if err := fi.readChunkHeaders(); err != nil { | |||||
return nil, err | |||||
} | |||||
if err := fi.readFanout(); err != nil { | |||||
return nil, err | |||||
} | |||||
return fi, nil | |||||
} | |||||
func (fi *fileIndex) verifyFileHeader() error { | |||||
// Verify file signature | |||||
var signature = make([]byte, 4) | |||||
if _, err := fi.reader.ReadAt(signature, 0); err != nil { | |||||
return err | |||||
} | |||||
if !bytes.Equal(signature, commitFileSignature) { | |||||
return ErrMalformedCommitGraphFile | |||||
} | |||||
// Read and verify the file header | |||||
var header = make([]byte, 4) | |||||
if _, err := fi.reader.ReadAt(header, 4); err != nil { | |||||
return err | |||||
} | |||||
if header[0] != 1 { | |||||
return ErrUnsupportedVersion | |||||
} | |||||
if header[1] != 1 { | |||||
return ErrUnsupportedHash | |||||
} | |||||
return nil | |||||
} | |||||
func (fi *fileIndex) readChunkHeaders() error { | |||||
var chunkID = make([]byte, 4) | |||||
for i := 0; ; i++ { | |||||
chunkHeader := io.NewSectionReader(fi.reader, 8+(int64(i)*12), 12) | |||||
if _, err := io.ReadAtLeast(chunkHeader, chunkID, 4); err != nil { | |||||
return err | |||||
} | |||||
chunkOffset, err := binary.ReadUint64(chunkHeader) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
if bytes.Equal(chunkID, oidFanoutSignature) { | |||||
fi.oidFanoutOffset = int64(chunkOffset) | |||||
} else if bytes.Equal(chunkID, oidLookupSignature) { | |||||
fi.oidLookupOffset = int64(chunkOffset) | |||||
} else if bytes.Equal(chunkID, commitDataSignature) { | |||||
fi.commitDataOffset = int64(chunkOffset) | |||||
} else if bytes.Equal(chunkID, extraEdgeListSignature) { | |||||
fi.extraEdgeListOffset = int64(chunkOffset) | |||||
} else if bytes.Equal(chunkID, lastSignature) { | |||||
break | |||||
} | |||||
} | |||||
if fi.oidFanoutOffset <= 0 || fi.oidLookupOffset <= 0 || fi.commitDataOffset <= 0 { | |||||
return ErrMalformedCommitGraphFile | |||||
} | |||||
return nil | |||||
} | |||||
func (fi *fileIndex) readFanout() error { | |||||
fanoutReader := io.NewSectionReader(fi.reader, fi.oidFanoutOffset, 256*4) | |||||
for i := 0; i < 256; i++ { | |||||
fanoutValue, err := binary.ReadUint32(fanoutReader) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
if fanoutValue > 0x7fffffff { | |||||
return ErrMalformedCommitGraphFile | |||||
} | |||||
fi.fanout[i] = int(fanoutValue) | |||||
} | |||||
return nil | |||||
} | |||||
func (fi *fileIndex) GetIndexByHash(h plumbing.Hash) (int, error) { | |||||
var oid plumbing.Hash | |||||
// Find the hash in the oid lookup table | |||||
var low int | |||||
if h[0] == 0 { | |||||
low = 0 | |||||
} else { | |||||
low = fi.fanout[h[0]-1] | |||||
} | |||||
high := fi.fanout[h[0]] | |||||
for low < high { | |||||
mid := (low + high) >> 1 | |||||
offset := fi.oidLookupOffset + int64(mid)*20 | |||||
if _, err := fi.reader.ReadAt(oid[:], offset); err != nil { | |||||
return 0, err | |||||
} | |||||
cmp := bytes.Compare(h[:], oid[:]) | |||||
if cmp < 0 { | |||||
high = mid | |||||
} else if cmp == 0 { | |||||
return mid, nil | |||||
} else { | |||||
low = mid + 1 | |||||
} | |||||
} | |||||
return 0, plumbing.ErrObjectNotFound | |||||
} | |||||
func (fi *fileIndex) GetCommitDataByIndex(idx int) (*CommitData, error) { | |||||
if idx >= fi.fanout[0xff] { | |||||
return nil, plumbing.ErrObjectNotFound | |||||
} | |||||
offset := fi.commitDataOffset + int64(idx)*36 | |||||
commitDataReader := io.NewSectionReader(fi.reader, offset, 36) | |||||
treeHash, err := binary.ReadHash(commitDataReader) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
parent1, err := binary.ReadUint32(commitDataReader) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
parent2, err := binary.ReadUint32(commitDataReader) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
genAndTime, err := binary.ReadUint64(commitDataReader) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
var parentIndexes []int | |||||
if parent2&parentOctopusUsed == parentOctopusUsed { | |||||
// Octopus merge | |||||
parentIndexes = []int{int(parent1 & parentOctopusMask)} | |||||
offset := fi.extraEdgeListOffset + 4*int64(parent2&parentOctopusMask) | |||||
buf := make([]byte, 4) | |||||
for { | |||||
_, err := fi.reader.ReadAt(buf, offset) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
parent := encbin.BigEndian.Uint32(buf) | |||||
offset += 4 | |||||
parentIndexes = append(parentIndexes, int(parent&parentOctopusMask)) | |||||
if parent&parentLast == parentLast { | |||||
break | |||||
} | |||||
} | |||||
} else if parent2 != parentNone { | |||||
parentIndexes = []int{int(parent1 & parentOctopusMask), int(parent2 & parentOctopusMask)} | |||||
} else if parent1 != parentNone { | |||||
parentIndexes = []int{int(parent1 & parentOctopusMask)} | |||||
} | |||||
parentHashes, err := fi.getHashesFromIndexes(parentIndexes) | |||||
if err != nil { | |||||
return nil, err | |||||
} | |||||
return &CommitData{ | |||||
TreeHash: treeHash, | |||||
ParentIndexes: parentIndexes, | |||||
ParentHashes: parentHashes, | |||||
Generation: int(genAndTime >> 34), | |||||
When: time.Unix(int64(genAndTime&0x3FFFFFFFF), 0), | |||||
}, nil | |||||
} | |||||
func (fi *fileIndex) getHashesFromIndexes(indexes []int) ([]plumbing.Hash, error) { | |||||
hashes := make([]plumbing.Hash, len(indexes)) | |||||
for i, idx := range indexes { | |||||
if idx >= fi.fanout[0xff] { | |||||
return nil, ErrMalformedCommitGraphFile | |||||
} | |||||
offset := fi.oidLookupOffset + int64(idx)*20 | |||||
if _, err := fi.reader.ReadAt(hashes[i][:], offset); err != nil { | |||||
return nil, err | |||||
} | |||||
} | |||||
return hashes, nil | |||||
} | |||||
// Hashes returns all the hashes that are available in the index | |||||
func (fi *fileIndex) Hashes() []plumbing.Hash { | |||||
hashes := make([]plumbing.Hash, fi.fanout[0xff]) | |||||
for i := 0; i < fi.fanout[0xff]; i++ { | |||||
offset := fi.oidLookupOffset + int64(i)*20 | |||||
if n, err := fi.reader.ReadAt(hashes[i][:], offset); err != nil || n < 20 { | |||||
return nil | |||||
} | |||||
} | |||||
return hashes | |||||
} |
package commitgraph | |||||
import ( | |||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
) | |||||
// MemoryIndex provides a way to build the commit-graph in memory | |||||
// for later encoding to file. | |||||
type MemoryIndex struct { | |||||
commitData []*CommitData | |||||
indexMap map[plumbing.Hash]int | |||||
} | |||||
// NewMemoryIndex creates in-memory commit graph representation | |||||
func NewMemoryIndex() *MemoryIndex { | |||||
return &MemoryIndex{ | |||||
indexMap: make(map[plumbing.Hash]int), | |||||
} | |||||
} | |||||
// GetIndexByHash gets the index in the commit graph from commit hash, if available | |||||
func (mi *MemoryIndex) GetIndexByHash(h plumbing.Hash) (int, error) { | |||||
i, ok := mi.indexMap[h] | |||||
if ok { | |||||
return i, nil | |||||
} | |||||
return 0, plumbing.ErrObjectNotFound | |||||
} | |||||
// GetCommitDataByIndex gets the commit node from the commit graph using index | |||||
// obtained from child node, if available | |||||
func (mi *MemoryIndex) GetCommitDataByIndex(i int) (*CommitData, error) { | |||||
if i >= len(mi.commitData) { | |||||
return nil, plumbing.ErrObjectNotFound | |||||
} | |||||
commitData := mi.commitData[i] | |||||
// Map parent hashes to parent indexes | |||||
if commitData.ParentIndexes == nil { | |||||
parentIndexes := make([]int, len(commitData.ParentHashes)) | |||||
for i, parentHash := range commitData.ParentHashes { | |||||
var err error | |||||
if parentIndexes[i], err = mi.GetIndexByHash(parentHash); err != nil { | |||||
return nil, err | |||||
} | |||||
} | |||||
commitData.ParentIndexes = parentIndexes | |||||
} | |||||
return commitData, nil | |||||
} | |||||
// Hashes returns all the hashes that are available in the index | |||||
func (mi *MemoryIndex) Hashes() []plumbing.Hash { | |||||
hashes := make([]plumbing.Hash, 0, len(mi.indexMap)) | |||||
for k := range mi.indexMap { | |||||
hashes = append(hashes, k) | |||||
} | |||||
return hashes | |||||
} | |||||
// Add adds new node to the memory index | |||||
func (mi *MemoryIndex) Add(hash plumbing.Hash, commitData *CommitData) { | |||||
// The parent indexes are calculated lazily in GetNodeByIndex | |||||
// which allows adding nodes out of order as long as all parents | |||||
// are eventually resolved | |||||
commitData.ParentIndexes = nil | |||||
mi.indexMap[hash] = len(mi.commitData) | |||||
mi.commitData = append(mi.commitData, commitData) | |||||
} | |||||
package commitgraph | |||||
import ( | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
) | |||||
// MemoryIndex provides a way to build the commit-graph in memory | |||||
// for later encoding to file. | |||||
type MemoryIndex struct { | |||||
commitData []*CommitData | |||||
indexMap map[plumbing.Hash]int | |||||
} | |||||
// NewMemoryIndex creates in-memory commit graph representation | |||||
func NewMemoryIndex() *MemoryIndex { | |||||
return &MemoryIndex{ | |||||
indexMap: make(map[plumbing.Hash]int), | |||||
} | |||||
} | |||||
// GetIndexByHash gets the index in the commit graph from commit hash, if available | |||||
func (mi *MemoryIndex) GetIndexByHash(h plumbing.Hash) (int, error) { | |||||
i, ok := mi.indexMap[h] | |||||
if ok { | |||||
return i, nil | |||||
} | |||||
return 0, plumbing.ErrObjectNotFound | |||||
} | |||||
// GetCommitDataByIndex gets the commit node from the commit graph using index | |||||
// obtained from child node, if available | |||||
func (mi *MemoryIndex) GetCommitDataByIndex(i int) (*CommitData, error) { | |||||
if i >= len(mi.commitData) { | |||||
return nil, plumbing.ErrObjectNotFound | |||||
} | |||||
commitData := mi.commitData[i] | |||||
// Map parent hashes to parent indexes | |||||
if commitData.ParentIndexes == nil { | |||||
parentIndexes := make([]int, len(commitData.ParentHashes)) | |||||
for i, parentHash := range commitData.ParentHashes { | |||||
var err error | |||||
if parentIndexes[i], err = mi.GetIndexByHash(parentHash); err != nil { | |||||
return nil, err | |||||
} | |||||
} | |||||
commitData.ParentIndexes = parentIndexes | |||||
} | |||||
return commitData, nil | |||||
} | |||||
// Hashes returns all the hashes that are available in the index | |||||
func (mi *MemoryIndex) Hashes() []plumbing.Hash { | |||||
hashes := make([]plumbing.Hash, 0, len(mi.indexMap)) | |||||
for k := range mi.indexMap { | |||||
hashes = append(hashes, k) | |||||
} | |||||
return hashes | |||||
} | |||||
// Add adds new node to the memory index | |||||
func (mi *MemoryIndex) Add(hash plumbing.Hash, commitData *CommitData) { | |||||
// The parent indexes are calculated lazily in GetNodeByIndex | |||||
// which allows adding nodes out of order as long as all parents | |||||
// are eventually resolved | |||||
commitData.ParentIndexes = nil | |||||
mi.indexMap[hash] = len(mi.commitData) | |||||
mi.commitData = append(mi.commitData, commitData) | |||||
} |
import ( | import ( | ||||
"io" | "io" | ||||
"github.com/src-d/gcfg" | |||||
"github.com/go-git/gcfg" | |||||
) | ) | ||||
// A Decoder reads and decodes config files from an input stream. | // A Decoder reads and decodes config files from an input stream. |
package diff | package diff | ||||
import ( | import ( | ||||
"gopkg.in/src-d/go-git.v4/plumbing" | |||||
"gopkg.in/src-d/go-git.v4/plumbing/filemode" | |||||
"github.com/go-git/go-git/v5/plumbing" | |||||
"github.com/go-git/go-git/v5/plumbing/filemode" | |||||
) | ) | ||||
// Operation defines the operation of a diff item. | // Operation defines the operation of a diff item. |