43
43
#include "private/svn_wc_private.h"
44
44
#include "private/svn_sqlite.h"
46
#define SVN_WC_NG_CHECK_ENV_VAR "SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_CHECK_FOR_WC_NG"
49
is_inside_wc_ng(const char *abspath,
50
const char *target_path,
55
const char *wc_db_path;
56
char *wc_ng_check_env_var;
59
wc_ng_check_env_var = getenv(SVN_WC_NG_CHECK_ENV_VAR);
60
if (wc_ng_check_env_var &&
61
apr_strnatcasecmp(wc_ng_check_env_var, "yes") == 0)
62
return SVN_NO_ERROR; /* Allow skipping for testing */
64
wc_db_path = svn_path_join_many(pool, abspath, SVN_WC_ADM_DIR_NAME,
66
err = svn_io_check_path(wc_db_path, &kind, pool);
73
if (kind == svn_node_file)
75
/* This value is completely bogus, but it is much higher than 1.6 will
76
have any prayer of reading. */
79
return svn_error_createf(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL,
80
_("The path '%s' appears to be part of a Subversion 1.7 or greater\n"
81
"working copy rooted at '%s'.\n"
82
"Please upgrade your Subversion client to use this working copy."
84
svn_path_local_style(target_path, pool),
85
svn_path_local_style(abspath, pool));
88
if (svn_dirent_is_root(abspath, strlen(abspath)))
91
return is_inside_wc_ng(svn_path_dirname(abspath, pool), target_path,
96
46
/* ### todo: make this compare repository too? Or do so in parallel
149
/* Let's check for the future. */
154
SVN_ERR(svn_path_get_absolute(&abspath, path, pool));
155
SVN_ERR(is_inside_wc_ng(abspath, path, wc_format, pool));
158
99
if (*wc_format > 0)
160
101
/* If we managed to read the format file we assume that we