This patch fixes the following anomaly:
~/src/subversion/svn-status-tests> mkdir ignored-dir
~/src/subversion/svn-status-tests> touch ignored-file
~/src/subversion/svn-status-tests> svn propset svn:ignore 'ignored-*' .
property `svn:ignore' set on ''
~/src/subversion/svn-status-tests> svn status --no-ignore
A .
I ignored-dir
I ignored-file
~/src/subversion/svn-status-tests> svn status ignored-dir ignored-file
? ignored-dir
I ignored-file
The fix duplicates a block of code from further up in the same function (which handled a file rather than a directory). I could not see an elegant way to avoid that, but would like it if someone else can.
The test that I added is a copy-paste-modify of the existing "status_for_unignored_file" test. I tried combining them into a single test but could not do this elegantly without rewriting the existing test significantly. I feared that rewriting an existing test is a bad idea because of the risk of breaking it. Is there a policy or a feeling on this?
Also I added the new test immediately after the test that it is similar to, thus renumbering the tests that come after it. Should I have added it at the end instead to preserve the numbering?
Log message:
[[[
--------10--------20--------30--------40--------50--------60--------70--------80
Fix status indicator "I": when an ignored directory was given as an explicit
argument, its status was reported as "?".
* subversion/libsvn_wc/status.c
(svn_wc_statuses)
* subversion/tests/clients/cmdline/stat_tests.py
(status_for_unignored_dir) New function.
(test_list) Add the new test.
]]]
- Julian
Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 6567)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -831,10 +831,20 @@
/* A wc format of 0 means this directory is not being versioned
at all (not by Subversion, anyway). */
if (wc_format_version == 0)
- return add_status_structure
- (statushash, path, NULL, NULL, NULL,
- svn_node_dir, FALSE, FALSE, notify_func, notify_baton, pool);
+ {
+ char *name;
+ apr_array_header_t *patterns;
+ patterns = apr_array_make (pool, 1, sizeof(const char *));
+ SVN_ERR (collect_ignore_patterns (patterns, ignores,
+ adm_access, pool));
+
+ name = svn_path_basename (path, pool);
+ return add_unversioned_item (name, kind, statushash,
+ adm_access, patterns, TRUE,
+ notify_func, notify_baton, pool);
+ }
+
SVN_ERR (svn_wc_is_wc_root (&is_root, path, adm_access, pool));
if (! is_root)
{
Index: subversion/tests/clients/cmdline/stat_tests.py
===================================================================
--- subversion/tests/clients/cmdline/stat_tests.py (revision 6567)
+++ subversion/tests/clients/cmdline/stat_tests.py (working copy)
@@ -361,6 +361,55 @@
os.chdir(was_cwd)
+# Regression: in r6550, "svn status unversioned-ignored-dir" was reporting
+# "? unversioned-ignored-dir"
+# while "svn status --no-ignore" was correctly reporting
+# "I unversioned-ignored-dir"
+
+def status_for_unignored_dir(sbox):
+ "status for unignored dir"
+
+ sbox.build()
+
+ wc_dir = sbox.wc_dir
+ was_cwd = os.getcwd()
+
+ os.chdir(wc_dir)
+
+ try:
+ os.makedirs('newdir')
+ svntest.main.run_svn(None, 'propset', 'svn:ignore', 'newdir', '.')
+
+ # status on the parent directory with --no-ignore
+ stat_output, err_output = svntest.main.run_svn(None, 'status',
+ '--no-ignore', '.')
+ if err_output:
+ raise svntest.Failure
+ status = 1
+ for line in stat_output:
+ if re.match("I +newdir", line):
+ status = 0
+
+ if (status == 1):
+ raise svntest.Failure
+
+ # status specifying the new dir explicitly on the command line
+ stat_output, err_output = svntest.main.run_svn(None, 'status', 'newdir')
+
+ if err_output:
+ raise svntest.Failure
+ status = 1
+ for line in stat_output:
+ if re.match("I +newdir", line):
+ status = 0
+
+ if (status == 1):
+ raise svntest.Failure
+
+ finally:
+ os.chdir(was_cwd)
+
+
def status_for_nonexistent_file(sbox):
"status for a file neither on disk nor under version control"
@@ -532,6 +581,7 @@
Skip(status_type_change_to_symlink, (os.name != 'posix')),
status_with_new_files_pending,
status_for_unignored_file,
+ status_for_unignored_dir,
status_for_nonexistent_file,
status_file_needs_update,
status_uninvited_parent_directory,
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jul 25 18:46:35 2003