fork of go-git with some jj specific features
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add Plan 9 support

Not all the tests pass yet but this makes go-git usable on Plan 9.
Please merge this after https://github.com/src-d/go-billy/pull/78.

Fixes #756

Signed-off-by: Fazlul Shahriar <fshahriar@gmail.com>

+80
+2
go.sum
··· 18 18 github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= 19 19 github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= 20 20 github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 21 + github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= 21 22 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 22 23 github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= 23 24 github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= ··· 77 78 golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 78 79 golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= 79 80 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 81 + golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= 80 82 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= 81 83 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 82 84 golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
+47
repository_plan9_test.go
··· 1 + package git 2 + 3 + import ( 4 + "fmt" 5 + "strings" 6 + ) 7 + 8 + // preReceiveHook returns the bytes of a pre-receive hook script 9 + // that prints m before exiting successfully 10 + func preReceiveHook(m string) []byte { 11 + return []byte(fmt.Sprintf("#!/bin/rc\necho -n %s\n", quote(m))) 12 + } 13 + 14 + const quoteChar = '\'' 15 + 16 + func needsQuote(s string) bool { 17 + for i := 0; i < len(s); i++ { 18 + c := s[i] 19 + if c == quoteChar || c <= ' ' { // quote, blanks, or control characters 20 + return true 21 + } 22 + } 23 + return false 24 + } 25 + 26 + // Quote adds single quotes to s in the style of rc(1) if they are needed. 27 + // The behaviour should be identical to Plan 9's quote(3). 28 + func quote(s string) string { 29 + if s == "" { 30 + return "''" 31 + } 32 + if !needsQuote(s) { 33 + return s 34 + } 35 + var b strings.Builder 36 + b.Grow(10 + len(s)) // Enough room for few quotes 37 + b.WriteByte(quoteChar) 38 + for i := 0; i < len(s); i++ { 39 + c := s[i] 40 + if c == quoteChar { 41 + b.WriteByte(quoteChar) 42 + } 43 + b.WriteByte(c) 44 + } 45 + b.WriteByte(quoteChar) 46 + return b.String() 47 + }
+31
worktree_plan9.go
··· 1 + package git 2 + 3 + import ( 4 + "syscall" 5 + "time" 6 + 7 + "gopkg.in/src-d/go-git.v4/plumbing/format/index" 8 + ) 9 + 10 + func init() { 11 + fillSystemInfo = func(e *index.Entry, sys interface{}) { 12 + if os, ok := sys.(*syscall.Dir); ok { 13 + // Plan 9 doesn't have a CreatedAt field. 14 + e.CreatedAt = time.Unix(int64(os.Mtime), 0) 15 + 16 + e.Dev = uint32(os.Dev) 17 + 18 + // Plan 9 has no Inode. 19 + // ext2srv(4) appears to store Inode in Qid.Path. 20 + e.Inode = uint32(os.Qid.Path) 21 + 22 + // Plan 9 has string UID/GID 23 + e.GID = 0 24 + e.UID = 0 25 + } 26 + } 27 + } 28 + 29 + func isSymlinkWindowsNonAdmin(err error) bool { 30 + return true 31 + }