camput: Skip base directories where IsIgnoredFile() returns true.

camput currently panics if a base directory is ignored.  Fixes issue 314.

Change-Id: I9466b4576b1134994e5e53e1067e0435ddba0fdf
This commit is contained in:
Aaron Racine 2014-01-02 17:55:17 -08:00
parent f6f7fb2ff3
commit 07a42aaa40
1 changed files with 6 additions and 3 deletions

View File

@ -230,6 +230,12 @@ func (c *fileCmd) RunCommand(args []string) error {
if err != nil {
return err
}
// Skip ignored files or base directories. Failing to skip the
// latter results in a panic.
if up.Client.IsIgnoredFile(filename) {
log.Printf("Client configured to ignore %s; skipping.", filename)
continue
}
if fi.IsDir() {
if up.fileOpts.wantVivify() {
vlog.Printf("Directories not supported in vivify mode; skipping %v\n", filename)
@ -239,9 +245,6 @@ func (c *fileCmd) RunCommand(args []string) error {
t.Start()
lastPut, err = t.Wait()
} else {
if up.Client.IsIgnoredFile(filename) {
continue
}
lastPut, err = up.UploadFile(filename)
if err == nil && c.deleteAfterUpload {
if err := os.Remove(filename); err != nil {