New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix recursive put file logic #9744
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #9744 +/- ##
==========================================
+ Coverage 59.37% 59.40% +0.02%
==========================================
Files 583 583
Lines 71139 71139
==========================================
+ Hits 42242 42258 +16
+ Misses 28277 28249 -28
- Partials 620 632 +12 ☔ View full report in Codecov by Sentry. |
src/server/pfs/cmds/cmds.go
Outdated
} | ||
if err := putFileHelper(mf, finalPath, source, recursive, appendFile, untar); err != nil { | ||
return err | ||
if recursive { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could just be
finalPath := file.Path
if recursive && fullPath || !recursive && strings.HasSuffix(file.Path, "/") {
finalPath = joinPaths(file.Path, target)
}
if err := putFileHelper(mf, finalPath, source, recursive, appendFile, untar); err != nil {
return err
}
Co-Authored-By: Bryce McAnally <bryce@pachyderm.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This PR corrects an issue introduced in #9636. - Before #9636 when you ran `pachctl put file repo@branch:/ -r -f /path/to/dir` and `/path/to/dir` has files `a.txt` and `b.txt` you would end up with two files `repo@branch:/a.txt` and `repo@branch:/b.txt"` - After #9636 when running `pachctl put file repo@branch:/ -r -f /path/to/dir` and `/path/to/dir` has files `a.txt` and `b.txt` you end up with two files with the `dir` prefix: `repo@branch:/dir/a.txt` and `repo@branch:/dir/b.txt` Now after this PR the behavior has been corrected so the files are put at the root. This PR also adds two tests that cover `pachctl put file repo@branch:/ -r -f /path/to/dir --full-path` and `pachctl put file repo@branch:/ -r -f /path/to/dir` --------- Co-authored-by: Bryce McAnally <bryce@pachyderm.io>
This PR corrects an issue introduced in #9636. - Before #9636 when you ran `pachctl put file repo@branch:/ -r -f /path/to/dir` and `/path/to/dir` has files `a.txt` and `b.txt` you would end up with two files `repo@branch:/a.txt` and `repo@branch:/b.txt"` - After #9636 when running `pachctl put file repo@branch:/ -r -f /path/to/dir` and `/path/to/dir` has files `a.txt` and `b.txt` you end up with two files with the `dir` prefix: `repo@branch:/dir/a.txt` and `repo@branch:/dir/b.txt` Now after this PR the behavior has been corrected so the files are put at the root. This PR also adds two tests that cover `pachctl put file repo@branch:/ -r -f /path/to/dir --full-path` and `pachctl put file repo@branch:/ -r -f /path/to/dir` --------- Co-authored-by: Bryce McAnally <bryce@pachyderm.io>
This PR corrects an issue introduced in #9636. - Before #9636 when you ran `pachctl put file repo@branch:/ -r -f /path/to/dir` and `/path/to/dir` has files `a.txt` and `b.txt` you would end up with two files `repo@branch:/a.txt` and `repo@branch:/b.txt"` - After #9636 when running `pachctl put file repo@branch:/ -r -f /path/to/dir` and `/path/to/dir` has files `a.txt` and `b.txt` you end up with two files with the `dir` prefix: `repo@branch:/dir/a.txt` and `repo@branch:/dir/b.txt` Now after this PR the behavior has been corrected so the files are put at the root. This PR also adds two tests that cover `pachctl put file repo@branch:/ -r -f /path/to/dir --full-path` and `pachctl put file repo@branch:/ -r -f /path/to/dir` --------- Co-authored-by: Bryce McAnally <bryce@pachyderm.io>
This PR corrects an issue introduced in #9636. - Before #9636 when you ran `pachctl put file repo@branch:/ -r -f /path/to/dir` and `/path/to/dir` has files `a.txt` and `b.txt` you would end up with two files `repo@branch:/a.txt` and `repo@branch:/b.txt"` - After #9636 when running `pachctl put file repo@branch:/ -r -f /path/to/dir` and `/path/to/dir` has files `a.txt` and `b.txt` you end up with two files with the `dir` prefix: `repo@branch:/dir/a.txt` and `repo@branch:/dir/b.txt` Now after this PR the behavior has been corrected so the files are put at the root. This PR also adds two tests that cover `pachctl put file repo@branch:/ -r -f /path/to/dir --full-path` and `pachctl put file repo@branch:/ -r -f /path/to/dir` --------- Co-authored-by: Bryce McAnally <bryce@pachyderm.io>
This PR corrects an issue introduced in #9636. - Before #9636 when you ran `pachctl put file repo@branch:/ -r -f /path/to/dir` and `/path/to/dir` has files `a.txt` and `b.txt` you would end up with two files `repo@branch:/a.txt` and `repo@branch:/b.txt"` - After #9636 when running `pachctl put file repo@branch:/ -r -f /path/to/dir` and `/path/to/dir` has files `a.txt` and `b.txt` you end up with two files with the `dir` prefix: `repo@branch:/dir/a.txt` and `repo@branch:/dir/b.txt` Now after this PR the behavior has been corrected so the files are put at the root. This PR also adds two tests that cover `pachctl put file repo@branch:/ -r -f /path/to/dir --full-path` and `pachctl put file repo@branch:/ -r -f /path/to/dir` --------- Co-authored-by: Bryce McAnally <bryce@pachyderm.io>
This PR corrects an issue I introduced in #9636.
pachctl put file repo@branch:/ -r -f /path/to/dir
and/path/to/dir
has filesa.txt
andb.txt
you would end up with two filesrepo@branch:/a.txt
andrepo@branch:/b.txt"
pachctl put file repo@branch:/ -r -f /path/to/dir
and/path/to/dir
has filesa.txt
andb.txt
you end up with two files with thedir
prefix:repo@branch:/dir/a.txt
andrepo@branch:/dir/b.txt
Now after this PR the behavior has been corrected so the files are put at the root.
This PR also adds two tests that cover
pachctl put file repo@branch:/ -r -f /path/to/dir --full-path
andpachctl put file repo@branch:/ -r -f /path/to/dir