summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2011-06-26 17:54:11 +0000
committerkientzle <kientzle@FreeBSD.org>2011-06-26 17:54:11 +0000
commit63ee2d30481a6cfa0ebc55582ca3b122de4d53c1 (patch)
tree13fb3eeb511e68901eb9641dacac873c54eb5611 /usr.bin/tar
parent173e40756b0a87ae6de3b59b385bd2738df7e4cf (diff)
downloadFreeBSD-src-63ee2d30481a6cfa0ebc55582ca3b122de4d53c1.zip
FreeBSD-src-63ee2d30481a6cfa0ebc55582ca3b122de4d53c1.tar.gz
The --newer-than test should descend into old
directories to look for new files. PR: bin/150890 Submitted by: Tobias Herre MFC after: 3 weeks
Diffstat (limited to 'usr.bin/tar')
-rw-r--r--usr.bin/tar/write.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c
index 838dffb..9d9025a 100644
--- a/usr.bin/tar/write.c
+++ b/usr.bin/tar/write.c
@@ -752,6 +752,9 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
break;
}
+ if (bsdtar->option_no_subdirs)
+ descend = 0;
+
/*
* Are we about to cross to a new filesystem?
*/
@@ -764,7 +767,6 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
} else if (descend == 0) {
/* We're not descending, so no need to check. */
} else if (bsdtar->option_dont_traverse_mounts) {
- /* User has asked us not to cross mount points. */
descend = 0;
} else {
/* We're prepared to cross a mount point. */
@@ -791,8 +793,15 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
* In -u mode, check that the file is newer than what's
* already in the archive; in all modes, obey --newerXXX flags.
*/
- if (!new_enough(bsdtar, name, st))
+ if (!new_enough(bsdtar, name, st)) {
+ if (!descend)
+ continue;
+ if (bsdtar->option_interactive &&
+ !yes("add '%s'", name))
+ continue;
+ tree_descend(tree);
continue;
+ }
archive_entry_free(entry);
entry = archive_entry_new();
@@ -868,8 +877,7 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
!yes("add '%s'", name))
continue;
- /* Note: if user vetoes, we won't descend. */
- if (descend && !bsdtar->option_no_subdirs)
+ if (descend)
tree_descend(tree);
/*
OpenPOWER on IntegriCloud