Skip to content

Commit

Permalink
Clarify a few things in the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia authored and salemhilal committed Jun 17, 2023
1 parent 3b3e729 commit b240489
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,13 @@ func indexAllFiles(opt *IndexOptions, dst, src string) error {
}
defer fileHandle.Close()

// Resolve the symbolic link
if fi, err := os.Stat(src); err == nil && fi.Mode()|os.ModeSymlink != 0 {
if s, err := os.Readlink(src); err == nil {
src = s
}
}

if err := filepath.Walk(src, func(path string, info os.FileInfo, err error) error {
name := info.Name()
rel, err := filepath.Rel(src, path) //nolint
Expand Down
2 changes: 2 additions & 0 deletions vcs/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ func newLocal(b []byte) (Driver, error) {
}

// Adapted from: https://github.com/golang/mod/blob/ad6fd61f94f8fdf6926f5dee6e45bdd13add2f9f/sumdb/dirhash/hash.go#L44
// The original function returns a base64 encoded string and uses the (slower) SHA256 algorithm. For our purposes
// SHA1 is good enough, since all we really need is a checksum to signal something changed
func myHash(files []string, open func(string) (io.ReadCloser, error)) (string, error) {
h := sha1.New()
files = append([]string(nil), files...)
Expand Down

0 comments on commit b240489

Please sign in to comment.