Index: include/svn_repos.h =================================================================== --- include/svn_repos.h (revision 8000) +++ include/svn_repos.h (working copy) @@ -213,8 +213,8 @@ * Specifically, the report will create a transaction made by @a username, * relative to @a fs_base in the filesystem. @a target is a single path * component, used to limit the scope of the report to a single entry of - * @a fs_base, or @c NULL if all of @a fs_base itself is the main subject - * of the report. + * @a fs_base, or "" if all of @a fs_base itself is the main subject of + * the report. * * @a tgt_path and @a revnum is the fs path/revision pair that is the * "target" of @c dir_delta. In other words, a tree delta will be @@ -340,13 +340,13 @@ /** Use the provided @a editor and @a edit_baton to describe the changes * necessary for making a given node (and its descendants, if it is a * directory) under @a src_root look exactly like @a tgt_path under - * @a tgt_root. @a src_entry is the node to update, and is either @c NULL - * or a single path component. If @a src_entry is @c NULL, then compute - * the difference between the entire tree anchored at @a src_parent_dir - * under @a src_root and @a tgt_path under @a target_root. Else, describe - * the changes needed to update only that entry in @a src_parent_dir. - * Typically, callers of this function will use a @a tgt_path that is the - * concatenation of @a src_parent_dir and @a src_entry. + * @a tgt_root. @a src_entry is the node to update. If @a src_entry + * is empty, then compute the difference between the entire tree + * anchored at @a src_parent_dir under @a src_root and @a tgt_path + * under @a target_root. Else, describe the changes needed to update + * only that entry in @a src_parent_dir. Typically, callers of this + * function will use a @a tgt_path that is the concatenation of @a + * src_parent_dir and @a src_entry. * * @a src_root and @a tgt_root can both be either revision or transaction * roots. If @a tgt_root is a revision, @a editor's @c set_target_revision() Index: include/svn_wc.h =================================================================== --- include/svn_wc.h (revision 8000) +++ include/svn_wc.h (working copy) @@ -1129,7 +1129,7 @@ * svn_wc_status_t structures and sends them through @a status_func / * @a status_baton. @a anchor is an access baton, with a tree lock, * for the local path to the working copy which will be used as the - * root of our editor. If @a target is not @c NULL, it represents an + * root of our editor. If @a target is not empty, it represents an * entry in the @a anchor path which is the subject of the editor * drive (otherwise, the @a anchor is the subject). * @@ -1516,7 +1516,7 @@ * should be rooted. * * @a target is the actual subject (relative to the @a anchor) of the - * update/commit, or @c NULL if the @a anchor itself is the subject. + * update/commit, or "" if the @a anchor itself is the subject. * * Allocate @a anchor and @a target in @a pool. */ @@ -1542,7 +1542,7 @@ * when the editor driver calls @c close_edit. * * @a target is the entry in @a anchor that will actually be updated, or - * @c NULL if all of @a anchor should be updated. + * empty if all of @a anchor should be updated. * * The editor invokes @a notify_func with @a notify_baton as the update * progresses, if @a notify_func is non-null. @@ -1595,7 +1595,7 @@ * when the editor driver calls @c close_edit. * * @a target is the entry in @a anchor that will actually be updated, or - * @c NULL if all of @a anchor should be updated. + * empty if all of @a anchor should be updated. * * The editor invokes @a notify_func with @a notify_baton as the switch * progresses, if @a notify_func is non-null. Index: include/svn_ra.h =================================================================== --- include/svn_ra.h (revision 8000) +++ include/svn_ra.h (working copy) @@ -441,7 +441,7 @@ * * @a update_target is an optional single path component will restrict * the scope of things affected by the update to an entry in the - * directory represented by the @a session_baton's URL, or @c NULL if the + * directory represented by the @a session_baton's URL, or empty if the * entire directory is meant to be updated. * * The working copy will be updated to @a revision_to_update_to, or the @@ -482,7 +482,7 @@ * * @a switch_target is an optional single path component will restrict * the scope of things affected by the switch to an entry in the - * directory represented by the @a session_baton's URL, or @c NULL if the + * directory represented by the @a session_baton's URL, or empty if the * entire directory is meant to be switched. * * The working copy will be switched to @a revision_to_switch_to, or the @@ -525,7 +525,7 @@ * the working copy were the client to call @c do_update(). * @a status_target is an optional single path component will restrict * the scope of the status report to an entry in the directory - * represented by the @a session_baton's URL, or @c NULL if the entire + * represented by the @a session_baton's URL, or empty if the entire * directory is meant to be examined. * * The caller may not perform any RA operations using @@ -568,7 +568,7 @@ * * @a diff_target is an optional single path component will restrict * the scope of the diff to an entry in the directory represented by - * the @a session_baton's URL, or @c NULL if the entire directory is + * the @a session_baton's URL, or empty if the entire directory is * meant to be one of the diff paths. * * The working copy will be diffed against @a versus_url as it exists Index: libsvn_wc/diff.c =================================================================== --- libsvn_wc/diff.c (revision 8000) +++ libsvn_wc/diff.c (working copy) @@ -637,7 +637,7 @@ directory and if this is that directory the non-target entries must be skipped. */ in_anchor_not_target = - (dir_baton->edit_baton->target + (! svn_path_is_empty (dir_baton->edit_baton->target) && (! svn_path_compare_paths (dir_baton->path, svn_wc_adm_access_path (dir_baton->edit_baton->anchor)))); @@ -1363,11 +1363,8 @@ eb = make_editor_baton (anchor, target, callbacks, callback_baton, recurse, FALSE, FALSE, pool); - if (target) - target_path = svn_path_join (svn_wc_adm_access_path (anchor), target, - eb->pool); - else - target_path = apr_pstrdup (eb->pool, svn_wc_adm_access_path (anchor)); + target_path = svn_path_join (svn_wc_adm_access_path (anchor), target, + eb->pool); SVN_ERR (svn_wc_adm_probe_retrieve (&adm_access, anchor, target_path, eb->pool)); Index: libsvn_wc/status.c =================================================================== --- libsvn_wc/status.c (revision 8000) +++ libsvn_wc/status.c (working copy) @@ -1217,7 +1217,7 @@ /* Mark the parent dir -- it lost an entry (unless that parent dir is the root node and we're not supposed to report on the root node). */ - if ((db->parent_baton) && (! eb->target)) + if (db->parent_baton && svn_path_is_empty (eb->target)) SVN_ERR (tweak_statushash (db->parent_baton->statii, eb->adm_access, db->path, kind == svn_node_dir, svn_wc_status_modified, 0)); @@ -1336,7 +1336,7 @@ { /* If this is the top-most directory, and the operation had a target, we should only report the target. */ - if (eb->target) + if (! svn_path_is_empty (eb->target)) { svn_wc_status_t *tgt_status; const char *path = svn_path_join (eb->anchor, eb->target, pool); Index: libsvn_wc/update_editor.c =================================================================== --- libsvn_wc/update_editor.c (revision 8000) +++ libsvn_wc/update_editor.c (working copy) @@ -251,7 +251,7 @@ another target). */ if (! pb) { - if (eb->target) /* the anchor is also the target */ + if (! svn_path_is_empty (eb->target)) /* anchor is also target */ d->new_URL = apr_pstrdup (pool, eb->switch_url); else d->new_URL = svn_path_dirname (eb->switch_url, pool); @@ -335,7 +335,7 @@ /* If this is the root directory, and there was a target, we should only be modifying that target! */ - if (is_root_dir && eb->target) + if (is_root_dir && (! svn_path_is_empty (eb->target))) { name = eb->target; current_entry = apr_hash_get (entries, name, APR_HASH_KEY_STRING); @@ -759,7 +759,7 @@ eb->root_opened = TRUE; *dir_baton = d = make_dir_baton (NULL, eb, NULL, FALSE, pool); - if (! eb->target) + if (svn_path_is_empty (eb->target)) { /* For an update with a NULL target, this is equivalent to open_dir(): */ svn_wc_adm_access_t *adm_access; @@ -890,8 +890,7 @@ /* If the thing being deleted is the *target* of this update, then we need to recreate a 'deleted' entry, so that parent can give accurate reports about itself in the future. */ - if (eb->target - && (strcmp (path, eb->target) == 0)) + if (strcmp (path, eb->target) == 0) { tgt_rev_str = apr_psprintf (pool, "%" SVN_REVNUM_T_FMT, *(eb->target_revision)); @@ -2386,7 +2385,8 @@ bug was fixed): open_root, delete_entry, close_dir. The helper function do_entry_deletion() will take care of the necessary steps. */ - if ((eb->target) && (svn_wc__adm_missing (eb->adm_access, target_path))) + if (! svn_path_is_empty (eb->target) + && (svn_wc__adm_missing (eb->adm_access, target_path))) SVN_ERR (do_entry_deletion (eb, eb->anchor, eb->target, pool)); /* We need to "un-incomplete" the root directory. */ @@ -2769,13 +2769,11 @@ if ((! is_wc_root) || (kind == svn_node_file)) { svn_path_split (path, anchor, target, pool); - if ((*anchor)[0] == '\0') - *anchor = ""; } else { *anchor = apr_pstrdup (pool, path); - *target = NULL; + *target = ""; } return SVN_NO_ERROR; Index: libsvn_client/switch.c =================================================================== --- libsvn_client/switch.c (revision 8000) +++ libsvn_client/switch.c (working copy) @@ -135,7 +135,7 @@ itself, and thus PATH's name will never change, which is exactly what we want. */ anchor = path; - target = NULL; + target = ""; session_entry = entry; } Index: libsvn_client/export.c =================================================================== --- libsvn_client/export.c (revision 8000) +++ libsvn_client/export.c (working copy) @@ -689,7 +689,7 @@ SVN_ERR (ra_lib->do_update (session, &reporter, &report_baton, revnum, - NULL, /* no sub-target */ + "", /* no sub-target */ TRUE, /* recurse */ export_editor, edit_baton, pool)); Index: libsvn_client/diff.c =================================================================== --- libsvn_client/diff.c (revision 8000) +++ libsvn_client/diff.c (working copy) @@ -1266,7 +1266,7 @@ SVN_ERR (ra_lib->do_diff (session, &reporter, &report_baton, end_revnum, - NULL, + "", recurse, ignore_ancestry, URL2, @@ -1477,9 +1477,9 @@ SVN_ERR (svn_wc_get_actual_target (path1, &anchor, &target, pool)); SVN_ERR (svn_io_check_path (path1, &kind, pool)); SVN_ERR (svn_wc_adm_open (&adm_access, NULL, anchor, FALSE, - (recurse && (! target)), pool)); + (recurse && svn_path_is_empty (target)), pool)); - if (target && (kind == svn_node_dir)) + if (! svn_path_is_empty (target) && (kind == svn_node_dir)) { /* Associate a potentially tree-locked access baton for the target with the anchor's access baton. Note that we don't @@ -1575,8 +1575,8 @@ that both sides of the diff exist. */ anchor1 = url1; anchor2 = url2; - target1 = NULL; - target2 = NULL; + target1 = ""; + target2 = ""; SVN_ERR (ra_lib->check_path (session1, "", rev1, &kind1, temppool)); SVN_ERR (ra_lib->check_path (session2, "", rev2, &kind2, temppool)); if (kind1 == svn_node_none) @@ -1691,8 +1691,8 @@ must split URL1 as well. */ anchor1 = url1; anchor2 = path2; - target1 = NULL; - target2 = NULL; + target1 = ""; + target2 = ""; SVN_ERR (svn_io_check_path (path2, &kind, pool)); if (kind == svn_node_file) { @@ -1709,8 +1709,8 @@ /* Set up diff editor according to path2's anchor/target. */ SVN_ERR (svn_wc_adm_open (&adm_access, NULL, anchor2, FALSE, - (recurse && (! target2)), pool)); - if (target2 && (kind == svn_node_dir)) + (recurse && svn_path_is_empty (target2)), pool)); + if (! svn_path_is_empty (target2) && (kind == svn_node_dir)) { /* Associate a potentially tree-locked access baton for the target with the anchor's access baton. Note that we don't Index: libsvn_client/commit.c =================================================================== --- libsvn_client/commit.c (revision 8000) +++ libsvn_client/commit.c (working copy) @@ -921,7 +921,7 @@ SVN_ERR (svn_wc_get_actual_target (base_dir, &parent_dir, &name, pool)); - if (name) + if (! svn_path_is_empty (name)) { /* Our new "grandfather directory" is the parent directory of the former one. */ @@ -1003,7 +1003,7 @@ const char *parent_dir, *name; SVN_ERR (svn_wc_get_actual_target (base_dir, &parent_dir, &name, pool)); - if (name) + if (! svn_path_is_empty (name)) { svn_node_kind_t kind; @@ -1053,7 +1053,7 @@ SVN_ERR (svn_wc_get_actual_target (target, &parent_dir, &name, pool)); - if (name) + if (! svn_path_is_empty (name)) { svn_node_kind_t kind; Index: mod_dav_svn/update.c =================================================================== --- mod_dav_svn/update.c (revision 8000) +++ mod_dav_svn/update.c (working copy) @@ -998,7 +998,7 @@ const char *src_path = NULL; const char *dst_path = NULL; const dav_svn_repos *repos = resource->info->repos; - const char *target = NULL; + const char *target = ""; svn_boolean_t recurse = TRUE; svn_boolean_t resource_walk = FALSE; svn_boolean_t ignore_ancestry = FALSE; @@ -1195,7 +1195,7 @@ uc.pathmap = NULL; if (dst_path) /* we're doing a 'switch' */ { - if (target) + if (! svn_path_is_empty(target)) { /* if the src is split into anchor/target, so must the telescoping dst_path be. */ @@ -1307,10 +1307,7 @@ { const char *this_path = svn_path_join_many(resource->pool, - src_path, - target ? target : path, - target ? path : NULL, - NULL); + src_path, target, path, NULL); if (! uc.pathmap) uc.pathmap = apr_hash_make(resource->pool); add_to_path_map(uc.pathmap, this_path, linkpath); @@ -1373,7 +1370,7 @@ revision 0. This should result in nothing but 'add' calls to the editor. */ serr = svn_repos_dir_delta(/* source is revision 0: */ - zero_root, "", NULL, + zero_root, "", "", /* target is 'switch' location: */ uc.rev_root, dst_path, /* re-use the editor */ Index: clients/cmdline/commit-cmd.c =================================================================== --- clients/cmdline/commit-cmd.c (revision 8000) +++ clients/cmdline/commit-cmd.c (working copy) @@ -74,7 +74,7 @@ SVN_ERR (svn_wc_get_actual_target (base_dir, &parent_dir, &base_name, pool)); - if (base_name) + if (! svn_path_is_empty (base_name)) base_dir = apr_pstrdup (pool, parent_dir); } Index: tests/libsvn_repos/repos-test.c =================================================================== --- tests/libsvn_repos/repos-test.c (revision 8000) +++ tests/libsvn_repos/repos-test.c (working copy) @@ -317,7 +317,7 @@ SVN_ERR (svn_fs_revision_root (&revision_root, fs, j, subpool)); SVN_ERR (svn_repos_dir_delta (txn_root, "", - NULL, + "", revision_root, "", editor, Index: libsvn_ra_svn/client.c =================================================================== --- libsvn_ra_svn/client.c (revision 8000) +++ libsvn_ra_svn/client.c (working copy) @@ -892,9 +892,6 @@ ra_svn_session_baton_t *sess = baton; svn_ra_svn_conn_t *conn = sess->conn; - if (target == NULL) - target = ""; - /* Tell the server we want to start an update. */ SVN_ERR(svn_ra_svn_write_cmd(conn, pool, "update", "(?r)cb", rev, target, recurse)); @@ -918,9 +915,6 @@ ra_svn_session_baton_t *sess = baton; svn_ra_svn_conn_t *conn = sess->conn; - if (target == NULL) - target = ""; - /* Tell the server we want to start a switch. */ SVN_ERR(svn_ra_svn_write_cmd(conn, pool, "switch", "(?r)cbc", rev, target, recurse, switch_url)); @@ -944,9 +938,6 @@ ra_svn_session_baton_t *sess = baton; svn_ra_svn_conn_t *conn = sess->conn; - if (target == NULL) - target = ""; - /* Tell the server we want to start a status operation. */ SVN_ERR(svn_ra_svn_write_cmd(conn, pool, "status", "cb(?r)", target, recurse, rev)); @@ -972,9 +963,6 @@ ra_svn_session_baton_t *sess = baton; svn_ra_svn_conn_t *conn = sess->conn; - if (target == NULL) - target = ""; - /* Tell the server we want to start a diff. */ SVN_ERR(svn_ra_svn_write_cmd(conn, pool, "diff", "(?r)cbbc", rev, target, recurse, ignore_ancestry, versus_url)); Index: libsvn_repos/delta.c =================================================================== --- libsvn_repos/delta.c (revision 8000) +++ libsvn_repos/delta.c (working copy) @@ -228,21 +228,14 @@ return svn_error_create (SVN_ERR_FS_PATH_SYNTAX, 0, "svn_repos_dir_delta: invalid target path"); - /* If SRC_ENTRY is supplied, it must not be empty. */ - if (src_entry && svn_path_is_empty (src_entry)) - return svn_error_create - (SVN_ERR_FS_PATH_SYNTAX, 0, - "svn_repos_dir_delta: source entry may not be the empty string"); - /* Calculate the fs path implicitly used for editor->open_root, so we can do an authz check on that path first. */ - if (src_entry) + if (! svn_path_is_empty (src_entry)) authz_root_path = svn_path_dirname (tgt_fullpath, pool); else authz_root_path = tgt_fullpath; - /* Construct the full path of the source item (SRC_ENTRY may be - NULL, which is fine). */ + /* Construct the full path of the source item. */ src_fullpath = svn_path_join_many (pool, src_parent_dir, src_entry, NULL); /* Get the node kinds for the source and target paths. */ @@ -255,8 +248,8 @@ /* If either the source or the target is a non-directory, we require that a SRC_ENTRY be supplied. */ - if ((! src_entry) && ((src_kind != svn_node_dir) - || tgt_kind != svn_node_dir)) + if (svn_path_is_empty (src_entry) && ((src_kind != svn_node_dir) + || tgt_kind != svn_node_dir)) return svn_error_create (SVN_ERR_FS_PATH_SYNTAX, 0, "svn_repos_dir_delta: invalid editor anchoring; at least one of the " @@ -345,7 +338,7 @@ /* They are the same node! No-op (you gotta love those). */ goto cleanup; } - else if (src_entry) + else if (! svn_path_is_empty (src_entry)) { /* If the nodes have different kinds, we must delete the one and add the other. Also, if they are completely unrelated and Index: libsvn_ra_dav/fetch.c =================================================================== --- libsvn_ra_dav/fetch.c (revision 8000) +++ libsvn_ra_dav/fetch.c (working copy) @@ -173,7 +173,7 @@ svn_boolean_t is_switch; /* Named target, or NULL if none. For example, in 'svn up wc/foo', - this is "wc/foo", but in 'svn up' it is NULL. + this is "wc/foo", but in 'svn up' it is "". The target helps us determine whether a response received from the server should be acted on. Take 'svn up wc/foo': the server @@ -1498,8 +1498,7 @@ if (rb->is_switch && rb->ras->callbacks->invalidate_wc_props) { CHKERR( rb->ras->callbacks->invalidate_wc_props - (rb->ras->callback_baton, - rb->target ? rb->target : "", + (rb->ras->callback_baton, rb->target, SVN_RA_DAV__LP_VSN_URL, rb->ras->pool) ); } @@ -1945,7 +1944,7 @@ /* fetch node props, unless this is the top dir and the real target of the operation is not the top dir. */ - if (! ((rb->dirs->nelts == 1) && rb->target)) + if (! ((rb->dirs->nelts == 1) && ! svn_path_is_empty(rb->target))) CHKERR( add_node_props(rb, TOP_DIR(rb).pool)); /* Close the directory on top of the stack, and pop it. Also, @@ -2094,7 +2093,7 @@ /* Update the wcprop here, unless this is the top directory and the real target of this operation is something other than the top directory. */ - if (! ((rb->dirs->nelts == 1) && rb->target)) + if (! ((rb->dirs->nelts == 1) && !svn_path_is_empty(rb->target))) { CHKERR( simple_store_vsn_url(rb->href->data, TOP_DIR(rb).baton, rb->editor->change_dir_prop, @@ -2395,8 +2394,8 @@ SVN_ERR( svn_io_file_write_full(rb->tmpfile, s, strlen(s), NULL, pool) ); } - /* A NULL target is no problem. */ - if (target) + /* Pre-0.36 servers don't like to see an empty target string. */ + if (! svn_path_is_empty(target)) { s = apr_psprintf(pool, "%s", Index: svnserve/serve.c =================================================================== --- svnserve/serve.c (revision 8000) +++ svnserve/serve.c (working copy) @@ -754,8 +754,6 @@ SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "(?r)cb", &rev, &target, &recurse)); SVN_ERR(trivial_auth_request(conn, pool, b)); - if (svn_path_is_empty(target)) - target = NULL; /* ### Compatibility hack, shouldn't be needed */ if (!SVN_IS_VALID_REVNUM(rev)) SVN_CMD_ERR(svn_fs_youngest_rev(&rev, b->fs, pool)); @@ -775,8 +773,6 @@ SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "(?r)cbc", &rev, &target, &recurse, &switch_url)); SVN_ERR(trivial_auth_request(conn, pool, b)); - if (svn_path_is_empty(target)) - target = NULL; /* ### Compatibility hack, shouldn't be needed */ if (!SVN_IS_VALID_REVNUM(rev)) SVN_CMD_ERR(svn_fs_youngest_rev(&rev, b->fs, pool)); SVN_CMD_ERR(get_fs_path(b->repos_url, switch_url, &switch_path, pool)); @@ -797,8 +793,6 @@ SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "cb?(?r)", &target, &recurse, &rev)); SVN_ERR(trivial_auth_request(conn, pool, b)); - if (svn_path_is_empty(target)) - target = NULL; /* ### Compatibility hack, shouldn't be needed */ if (!SVN_IS_VALID_REVNUM(rev)) SVN_CMD_ERR(svn_fs_youngest_rev(&rev, b->fs, pool)); return accept_report(conn, pool, b, rev, target, NULL, FALSE, recurse, @@ -817,8 +811,6 @@ SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "(?r)cbbc", &rev, &target, &recurse, &ignore_ancestry, &versus_url)); SVN_ERR(trivial_auth_request(conn, pool, b)); - if (svn_path_is_empty(target)) - target = NULL; /* ### Compatibility hack, shouldn't be needed */ if (!SVN_IS_VALID_REVNUM(rev)) SVN_CMD_ERR(svn_fs_youngest_rev(&rev, b->fs, pool)); SVN_CMD_ERR(get_fs_path(b->repos_url, versus_url, &versus_path, pool));