Closed donny-dont closed 6 years ago
Thanks @jmccann it appears that @tboerger needs to add us both to the approved reviewers for this repo though 😢
Sorry about that my bad.
@tonglil no worries. Found it relatively quick. One thing I'm not sure of though now that I'm looking a bit more at whats going on. Should it always append the root path? Currently its only doing it when it generates the path.
The root is prefixed onto the paths if it's specified (for example setting the base bucket).
Sorry I guess I wasn't clear. Would users expect root to be appended if path is not length 0?
// Get the path to place the cache files
path := c.GlobalString("path")
// Defaults to <owner>/<repo>/<branch>/
if len(path) == 0 {
log.Info("No path specified. Creating default")
path = fmt.Sprintf(
"%s/%s/%s",
c.String("repo.owner"),
c.String("repo.name"),
c.String("commit.branch"),
)
path = prefixRoot(root, path)
}
If they specify a path, then the final location is: path If they specify a root, then the final location is: root + default path If they specify nothing, then the final location is: default path
Does that make sense/am I interpreting your question correctly?
EDIT: ah I see, path = prefixRoot(root, path)
should be outside of if len(path) == 0 {
if they specify a root and a path for the final location: root + path
@donny-dont I think we should leave it as is; the root prefix only applies to default path
, fallbackPath
, and flushPath
parameters. One can specify those parameters to override the root.
What do you think?
Its fine as long as its documented why you would do it. Guessing primarily for setting the bucket manually.
Looks like the paths got screwed up after @tonglil 's commit. This uses
path
to join the filename to the paths