Revamp tar_getcwd/normalize_filename stuff.

The changes are based on the discussion with Nathan.

* src/common.h (normalize_filename): Take two arguments. All
callers updated.
(tar_getcwd): Replaced with ..
(tar_getcdpath): New proto.
* src/misc.c (normalize_filename): Take two arguments.
(chdir_arg): Populate cwd along with creating the
structure.
(tar_getcwd): Removed.
(tar_getcdpath): New function.

* tests/incr09.at: New test case.
* tests/Makefile.am: Add new tests.
* tests/testsuite.at: Likewise.
This commit is contained in:
Sergey Poznyakoff
2013-10-01 21:48:30 +03:00
parent d3fd92c6fb
commit d28eee6b4f
7 changed files with 84 additions and 39 deletions

View File

@@ -113,6 +113,7 @@ TESTSUITE_AT = \
incr06.at\
incr07.at\
incr08.at\
incr09.at\
indexfile.at\
ignfail.at\
label01.at\

59
tests/incr09.at Normal file
View File

@@ -0,0 +1,59 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright 2013 Free Software Foundation, Inc.
#
# GNU tar is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# GNU tar is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
AT_SETUP([incremental with alternating -C])
AT_KEYWORDS([incremental create incr09])
AT_TAR_CHECK([
AT_SORT_PREREQ
mkdir foo bar middle
echo foo/foo_file > foo/foo_file
echo bar/bar_file > bar/bar_file
echo middle/file > middle/middle_file
decho A
tar -cvf foo.tar --incremental -C foo . -C `pwd` middle -C bar .
rm foo.tar
>toplevel_file
decho B
tar -cvf foo.tar --incremental -C foo . -C `pwd` toplevel_file -C bar .
],
[0],
[A
./
./
middle/
./bar_file
./foo_file
middle/middle_file
B
./
./
toplevel_file
./bar_file
./foo_file
],
[A
tar: .: Directory is new
tar: middle: Directory is new
tar: .: Directory is new
B
tar: .: Directory is new
tar: .: Directory is new
],[],[],[gnu])
AT_CLEANUP

View File

@@ -298,6 +298,7 @@ m4_include([incr05.at])
m4_include([incr06.at])
m4_include([incr07.at])
m4_include([incr08.at])
m4_include([incr09.at])
AT_BANNER([Files removed while archiving])
m4_include([filerem01.at])