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
feat(cp): support update flag when recursing #889
Changes from 3 commits
c40496a
4ca5694
dface6c
8d5811d
3f2d0fd
3283d5e
ee59552
cdb269f
d4c27fc
0b1579b
f590747
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -451,6 +451,19 @@ test('-R implies -P', t => { | |
}); | ||
}); | ||
|
||
test('-Ru no longer ignores -u', t => { | ||
const [source, dest] = ['foo', 'bar'].map(s => `test/resources/cp/cp-Ru/${s}/file`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should copy to |
||
// First, update the dest file | ||
shell.touch(dest); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You also need to update the source directory to an older time stamp, right? Otherwise, we'll see race conditions in very-fresh checkouts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a later comment, you've mentioned checking file contents. That would resolve this issue as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, file contents is fine to use here as well. |
||
// Get the old mtime for dest | ||
const oldTime = fs.statSync(dest).mtimeMs; | ||
// Now, copy the old dir to the new one | ||
shell.cp('-Ru', source, dest); | ||
// Get the new mtime for dest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I think this comment is leftover from a previous commit (you're not checking mtimes anymore) |
||
const newTime = fs.statSync(dest).mtimeMs; | ||
t.is(oldTime, newTime); | ||
}); | ||
|
||
joshi-sh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
test('using -P explicitly works', t => { | ||
utils.skipOnWin(t, () => { | ||
shell.cp('-P', 'test/resources/cp/links/sym.lnk', t.context.tmp); | ||
|
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.
nit:
-Ru respects the -u flag recursively