Skip to content

Commit

Permalink
touch: skip touching root "/" which is immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel Odeke committed Jan 10, 2015
1 parent 65e3875 commit 1f2cf17
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion help.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"fmt"
)

var Version = "0.0.4c"
var Version = "0.0.4d"

const (
DiffKey = "diff"
Expand Down
10 changes: 8 additions & 2 deletions push.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ func (g *Commands) Push() (err error) {
}

func (g *Commands) Touch() (err error) {
srcLen := len(g.opts.Sources)
root := "/"
chunkSize := 4
q, r := srcLen/chunkSize, srcLen%chunkSize
srcLen := len(g.opts.Sources)
q, r := srcLen / chunkSize, srcLen % chunkSize
i, chunkCount := 0, q

if r != 0 {
chunkCount += 1
}
Expand All @@ -108,6 +110,10 @@ func (g *Commands) Touch() (err error) {
chunk := g.opts.Sources[i:end]
go func(wg *sync.WaitGroup, chunk []string) {
for _, relToRootPath := range chunk {
// Ignore the case in which root is to be touched.
if relToRootPath == root {
continue
}
if tErr := g.touch(relToRootPath); tErr != nil {
fmt.Printf("touch: %s %v\n", relToRootPath, tErr)
}
Expand Down

0 comments on commit 1f2cf17

Please sign in to comment.