Skip to content

Conversation

MetalBlueberry
Copy link

This request ensures the order returned by ReadDir for memfs.

The entries are sorted lexicographically because this is how to strings are automatically sorted, The interface does not specify how the filename is sorted, but I think it makes sense to use the default behavior.

type Dir interface {
	// ReadDir reads the directory named by dirname and returns a list of
	// directory entries sorted by filename.
	ReadDir(path string) ([]os.FileInfo, error)
}

Reference: https://golang.org/src/strings/compare.go

@mcuadros mcuadros changed the title Fix #12, MemFS ReadDir sorted by filename memfs: ReadDir sorted by filename Mar 10, 2021
@mcuadros mcuadros merged commit b791567 into go-git:master Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants