forked from RsyncProject/rsync
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ignore-non-existing-directory: add variant of ignore-non-existing
Add new option --ignore-non-existing-directory, that is a variant of --ignore-non-existing, but applies ONLY to directories. This was previously proposed in bug #8366, but I independently had a use case for it in the Gentoo infrastructure. Reference: https://bugzilla.samba.org/show_bug.cgi?id=8366 Reference: http://superuser.com/questions/316561/rsync-synchronizing-files-only-without-creating-folders-on-destination Reference: RsyncProject/rsync-patches#8 Reference: https://lists.samba.org/archive/rsync/2015-November/030455.html Signed-off-by: Robin H. Johnson <[email protected]>
- Loading branch information
Showing
4 changed files
with
77 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#! /bin/sh | ||
|
||
# This program is distributable under the terms of the GNU GPL (see | ||
# COPYING). | ||
|
||
. $suitedir/rsync.fns | ||
|
||
makepath "$fromdir/subdir1" "$fromdir/subdir2" "$todir/subdir1" | ||
echo data >"$fromdir/subdir1/file" | ||
echo data >"$todir/subdir1/file2" | ||
echo data >"$fromdir/subdir2/file" | ||
|
||
# Test 1: Ensure subdir2 and content under it are not created | ||
$RSYNC -r --ignore-non-existing-directory -vv "$fromdir/" "$todir/" | tee "$scratchdir/out" | ||
if [ ! -d "$todir/subdir1" ]; then | ||
test_fail 'test 1 failed: subdir1 should have been created' | ||
fi | ||
if [ ! -f "$todir/subdir1/file" ]; then | ||
test_fail 'test 1 failed: subdir1/file should have been created' | ||
fi | ||
if [ ! -f "$todir/subdir1/file2" ]; then | ||
test_fail 'test 1 failed: subdir1/file2 should not have been removed' | ||
fi | ||
if [ -d "$todir/subdir2" ]; then | ||
test_fail 'test 1 failed: subdir2 should not have been created' | ||
fi | ||
if [ -f "$todir/subdir2/file" ]; then | ||
test_fail 'test 1 failed: subdir2/file should not have been created' | ||
fi | ||
|
||
# Test 2: Also ensure that other delete handling was not impacted | ||
$RSYNC -r --delete --ignore-non-existing-directory -vv "$fromdir/" "$todir/" | tee "$scratchdir/out" | ||
if [ ! -d "$todir/subdir1" ]; then | ||
test_fail 'test 2 failed: subdir1 should have been created' | ||
fi | ||
if [ ! -f "$todir/subdir1/file" ]; then | ||
test_fail 'test 2 failed: subdir1/file should have been created' | ||
fi | ||
if [ -f "$todir/subdir1/file2" ]; then | ||
test_fail 'test 2 failed: subdir1/file2 should have been removed' | ||
fi | ||
if [ -d "$todir/subdir2" ]; then | ||
test_fail 'test 2 failed: subdir2 should not have been created' | ||
fi | ||
if [ -f "$todir/subdir2/file" ]; then | ||
test_fail 'test 2 failed: subdir2/file should not have been created' | ||
fi |