Skip to content

Commit

Permalink
stat/md5: allow op on depth=0 for dir children
Browse files Browse the repository at this point in the history
Fixes #783.

Ensures that for a directory, after decrementing the depth
by 1 in the parent's first pass that we at least operate on
passed in files instead of erraneously ending on that depth.
Traversal depth is meant for traversing directories/folders
and less on actual files.

This change leads us to conform to the proper behavior exhibited
by  `drive list`.
  • Loading branch information
odeke-em committed Jan 7, 2017
1 parent bf5b270 commit 7ee7c96
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ func prettyFileStat(logf log.Loggerf, relToRootPath string, file *File) {
}

func (g *Commands) stat(relToRootPath string, file *File, depth int) error {
if depth == 0 {
return nil
}

if g.opts.Md5sum {
if file.Md5Checksum != "" {
g.log.Logf("%32s %s\n", file.Md5Checksum, strings.TrimPrefix(relToRootPath, "/"))
Expand All @@ -153,6 +149,10 @@ func (g *Commands) stat(relToRootPath string, file *File, depth int) error {
}
}

if depth == 0 {
return nil
}

if !file.IsDir {
return nil
}
Expand Down

0 comments on commit 7ee7c96

Please sign in to comment.