Fix interaction between --listed-incremental and -C

* src/incremen.c (read_directory_file): Execute eventual -C dir
after opening the snapshot file.
(collect_and_sort_names): Remove call to chdir_do
* tests/incr05.at, tests/incr06.at: Use relative file names for
snapshot files.
This commit is contained in:
Sergey Poznyakoff
2009-08-13 16:45:49 +03:00
parent aeffa4f266
commit 006c1efbe8
4 changed files with 14 additions and 11 deletions

View File

@@ -1324,6 +1324,13 @@ read_directory_file (void)
return;
}
/* Consume the first name from the name list and reset the
list afterwards. This is done to change to the new
directory, if the first name is a chdir request (-C dir),
which is necessary to recreate absolute file names. */
name_from_list ();
blank_name_list ();
if (0 < getline (&buf, &bufsize, listed_incremental_stream))
{
char *ebuf;

View File

@@ -903,7 +903,7 @@ collect_and_sort_names (void)
_("Only one -C option is allowed with "
"--listed-incremental")));
}
chdir_do (namelist->change_dir);
read_directory_file ();
}

View File

@@ -25,14 +25,12 @@ mkdir dir/sub
genfile --file dir/file1
genfile --file dir/sub/file2
dbfile=`pwd`/db
echo Level 0
tar -c -f archive.tar -g $dbfile -C dir -v --warning=no-new-dir .
tar -c -f archive.tar -g db -C dir -v --warning=no-new-dir .
genfile --file dir/file3
echo Level 1
tar -c -f archive.tar -g $dbfile -C dir -v --warning=no-new-dir .
tar -c -f archive.tar -g db -C dir -v --warning=no-new-dir .
],
[0],
[Level 0

View File

@@ -28,20 +28,18 @@ genfile --file dir/file1
genfile --file dir/sub/file2
genfile --file dir/sub/a/file3
dbfile=`pwd`/db
echo Level 0 . sub
tar -c -f archive-0.1.tar -g $dbfile.1 -C dir -v --warning=no-new-dir . sub
tar -c -f archive-0.1.tar -g db.1 -C dir -v --warning=no-new-dir . sub
echo Level 0 sub .
tar -c -f archive-0.2.tar -g $dbfile.2 -C dir -v --warning=no-new-dir sub .
tar -c -f archive-0.2.tar -g db.2 -C dir -v --warning=no-new-dir sub .
mkdir dir/c
genfile --file dir/sub/b/file4
echo Level 1 . sub
tar -c -f archive-1.1.tar -g $dbfile.1 -C dir -v --warning=no-new-dir . sub
tar -c -f archive-1.1.tar -g db.1 -C dir -v --warning=no-new-dir . sub
echo Level 1 sub .
tar -c -f archive-1.2.tar -g $dbfile.2 -C dir -v --warning=no-new-dir sub .
tar -c -f archive-1.2.tar -g db.2 -C dir -v --warning=no-new-dir sub .
],
[0],
[Level 0 . sub