Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: client/archiver/directory.go

Issue 2981223003: Reuse blacklisting code in exp_archive. (Closed)
Patch Set: address review comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | client/cmd/isolate/exp_archive.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. 1 // Copyright 2015 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if err != nil { 67 if err != nil {
68 return fmt.Errorf("walk(%q): %v", path, err) 68 return fmt.Errorf("walk(%q): %v", path, err)
69 } 69 }
70 70
71 relPath, err := fsView.RelativePath(path) 71 relPath, err := fsView.RelativePath(path)
72 if err != nil { 72 if err != nil {
73 return fmt.Errorf("walk(%q): %v", path, err) 73 return fmt.Errorf("walk(%q): %v", path, err)
74 } 74 }
75 75
76 if relPath == "" { // empty string indicates skip. 76 if relPath == "" { // empty string indicates skip.
77 » » » return returnSkip(info) 77 » » » return common.WalkFuncSkipFile(info)
78 } 78 }
79 79
80 if !info.IsDir() { 80 if !info.IsDir() {
81 c <- &walkItem{fullPath: path, relPath: relPath, info: i nfo} 81 c <- &walkItem{fullPath: path, relPath: relPath, info: i nfo}
82 } 82 }
83 return nil 83 return nil
84 }) 84 })
85 85
86 if err != nil { 86 if err != nil {
87 // No point continuing if an error occurred during walk. 87 // No point continuing if an error occurred during walk.
88 log.Fatalf("Unable to walk %q: %v", root, err) 88 log.Fatalf("Unable to walk %q: %v", root, err)
89 } 89 }
90 90
91 } 91 }
92 92
93 // returnSkip returns the return value expected from a filepath.WalkFunc in the case where no more processing of file should occur.
94 func returnSkip(file os.FileInfo) error {
95 if file.IsDir() {
96 // Must not return io.SkipDir for file, filepath.walk() handles this badly.
97 return filepath.SkipDir
98 }
99 return nil
100 }
101
102 // PushDirectory walks a directory at root and creates a .isolated file. 93 // PushDirectory walks a directory at root and creates a .isolated file.
103 // 94 //
104 // It walks the directories synchronously, then returns a *Item to signal when 95 // It walks the directories synchronously, then returns a *Item to signal when
105 // the background work is completed. The Item is signaled once all files are 96 // the background work is completed. The Item is signaled once all files are
106 // hashed. In particular, the *Item is signaled before server side cache 97 // hashed. In particular, the *Item is signaled before server side cache
107 // lookups and upload is completed. Use archiver.Close() to wait for 98 // lookups and upload is completed. Use archiver.Close() to wait for
108 // completion. 99 // completion.
109 // 100 //
110 // relDir is a relative directory to offset relative paths against in the 101 // relDir is a relative directory to offset relative paths against in the
111 // generated .isolated file. 102 // generated .isolated file.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 181 }
191 } 182 }
192 } 183 }
193 } 184 }
194 if err != nil { 185 if err != nil {
195 s.SetErr(err) 186 s.SetErr(err)
196 } 187 }
197 }() 188 }()
198 return s 189 return s
199 } 190 }
OLDNEW
« no previous file with comments | « no previous file | client/cmd/isolate/exp_archive.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698