Add --keep-newer-files option (as in GNU tar: When in -x mode, ignore
files if the existing file is newer than the archive entry). Currently if any files are ignored, bsdtar will exit with a non-zero exit status; this is likely to change in the future, but requires some API changes in libarchive. Discussed with: kientzle Obtained from: tarsnap
This commit is contained in:
parent
5e9c239f57
commit
c890e8f252
@ -225,6 +225,10 @@ automatically when reading archives.
|
||||
Do not overwrite existing files.
|
||||
In particular, if a file appears more than once in an archive,
|
||||
later copies will not overwrite earlier copies.
|
||||
.It Fl -keep-newer-files ( Fl W Cm keep-newer-files )
|
||||
(x mode only)
|
||||
Do not overwrite existing files that are newer than the
|
||||
versions appearing in the archive being extracted.
|
||||
.It Fl L
|
||||
(c and r mode only)
|
||||
All symbolic links will be followed.
|
||||
|
@ -142,6 +142,7 @@ enum {
|
||||
OPTION_FORMAT,
|
||||
OPTION_HELP,
|
||||
OPTION_INCLUDE,
|
||||
OPTION_KEEP_NEWER_FILES,
|
||||
OPTION_NEWER_CTIME,
|
||||
OPTION_NEWER_CTIME_THAN,
|
||||
OPTION_NEWER_MTIME,
|
||||
@ -190,6 +191,7 @@ static const struct option tar_longopts[] = {
|
||||
{ "include", required_argument, NULL, OPTION_INCLUDE },
|
||||
{ "interactive", no_argument, NULL, 'w' },
|
||||
{ "insecure", no_argument, NULL, 'P' },
|
||||
{ "keep-newer-files", no_argument, NULL, OPTION_KEEP_NEWER_FILES },
|
||||
{ "keep-old-files", no_argument, NULL, 'k' },
|
||||
{ "list", no_argument, NULL, 't' },
|
||||
{ "modification-time", no_argument, NULL, 'm' },
|
||||
@ -392,6 +394,9 @@ main(int argc, char **argv)
|
||||
case 'k': /* GNU tar */
|
||||
bsdtar->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE;
|
||||
break;
|
||||
case OPTION_KEEP_NEWER_FILES: /* GNU tar */
|
||||
bsdtar->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
|
||||
break;
|
||||
case 'L': /* BSD convention */
|
||||
bsdtar->symlink_mode = 'L';
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user