Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Plan 9 Support #756

Open
henesy opened this issue Feb 21, 2018 · 1 comment · May be fixed by #1269
Open

Plan 9 Support #756

henesy opened this issue Feb 21, 2018 · 1 comment · May be fixed by #1269

Comments

@henesy
Copy link

henesy commented Feb 21, 2018

You can get go-git to build on Plan 9 by adding a file:

worktree_plan9.go

// +build plan9

package git

import (
	"syscall"
	"time"

	"gopkg.in/src-d/go-git.v4/plumbing/format/index"
)

func init() {
	fillSystemInfo = func(e *index.Entry, sys interface{}) {
		// Plan 9		
		sysi, ok := sys.(*syscall.Dir)

                // Problem because CreatedAt isn't a field
		e.CreatedAt = time.Unix(int64(sysi.Atime), 0)

		e.Dev = uint32(sysi.Dev)

                // Problem because Plan 9 has no Inode
		e.Inode = sysi.Qid.Vers
		
                // Problem because Plan 9 has string UID/GID
		e.GID = uint32(0)
		e.UID = uint32(0)
	}
}

This doesn't fix Plan 9 support fully, however, and is only a placeholder. I'm not sure what the best integration approach is, but sys isn't a Stat_t on Plan 9, it is the syscall.Dir type seen here: https://golang.org/src/syscall/dir_plan9.go

Looking at plumbing/format/index/index.go leads me to believe that some part of the git implementation assumes posix, so I was wondering if there was a clean work around that could be made compatible with the Plan 9 model.

@mcuadros
Copy link
Contributor

Happy to have a PR with Plan9 support

fhs added a commit to fhs/go-git that referenced this issue Dec 25, 2019
Not all the tests pass yet but this makes go-git usable on Plan 9.
Please merge this after src-d/go-billy#78.

Fixes src-d#756

Signed-off-by: Fazlul Shahriar <[email protected]>
@fhs fhs linked a pull request Dec 25, 2019 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants