diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-12-09 00:53:38 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruen@linbit.com> | 2011-12-09 00:53:38 +0100 |
commit | 5ca55b84143a840218bcdc78120b44b02d8ef561 (patch) | |
tree | 0195e4d4851446ab08e00d30a0e8bc67b299e1be /tests/preserve-mode-and-timestamp | |
parent | 17086c5cf2656df6f1dd4db7970a20ed519267ea (diff) | |
download | patch-5ca55b84143a840218bcdc78120b44b02d8ef561.tar.gz |
Timestamp not set when creating files with --set-time or --set-utc
* src/util.h (enum file_attributes): Add FA_XATTRS flag for extended
attributes.
* src/patch.c (main): Use set_file_attributes() even when the infile doesn't
exist: it may still set the file time (FA_TIMES). Omit all other FA_ flags if
infile doesn't exist. Otherwise, add FA_XATTRS as well.
* src/util.c (set_file_attributes): Only copy extended attributes if FA_XATTRS
is set. Avoid using st where it may be undefined.
* tests/preserve-mode-and-timestamp: Add file create test.
Diffstat (limited to 'tests/preserve-mode-and-timestamp')
-rw-r--r-- | tests/preserve-mode-and-timestamp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/preserve-mode-and-timestamp b/tests/preserve-mode-and-timestamp index 9e27955..855d95c 100644 --- a/tests/preserve-mode-and-timestamp +++ b/tests/preserve-mode-and-timestamp @@ -102,3 +102,20 @@ EOF check 'ls -l f.rej | sed "s,\(..........\).*,\1,"' <<EOF -rw-r----- EOF + +# ============================================================== + +cat > f.diff <<EOF +--- /dev/null ++++ b/f $timestamp2 +@@ -0,0 +1 @@ ++one +EOF + +rm -f f + +check 'patch -p1 --backup --set-utc < f.diff' <<EOF +patching file f +EOF + +ncheck 'test ! \( f -ot f.compare -o f -nt f.compare \) || echo "timstamp differs"' |