Created
November 21, 2011 18:36
-
-
Save nall/1383470 to your computer and use it in GitHub Desktop.
SVN env var snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define SVN_WC_NG_CHECK_ENV_VAR "SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_CHECK_FOR_WC_NG" | |
static svn_error_t * | |
is_inside_wc_ng(const char *abspath, | |
const char *target_path, | |
int *wc_format, | |
apr_pool_t *pool) | |
{ | |
svn_node_kind_t kind; | |
const char *wc_db_path; | |
char *wc_ng_check_env_var; | |
svn_error_t *err; | |
wc_ng_check_env_var = getenv(SVN_WC_NG_CHECK_ENV_VAR); | |
if (wc_ng_check_env_var && | |
apr_strnatcasecmp(wc_ng_check_env_var, "yes") == 0) | |
return SVN_NO_ERROR; /* Allow skipping for testing */ | |
wc_db_path = svn_path_join_many(pool, abspath, SVN_WC_ADM_DIR_NAME, | |
"wc.db", NULL); | |
err = svn_io_check_path(wc_db_path, &kind, pool); | |
if (err) | |
{ | |
svn_error_clear(err); | |
return SVN_NO_ERROR; | |
} | |
if (kind == svn_node_file) | |
{ | |
/* This value is completely bogus, but it is much higher than 1.6 will | |
have any prayer of reading. */ | |
*wc_format = 9999; | |
return svn_error_createf(SVN_ERR_WC_UNSUPPORTED_FORMAT, NULL, | |
_("The path '%s' appears to be part of a Subversion 1.7 or greater\n" | |
"working copy rooted at '%s'.\n" | |
"Please upgrade your Subversion client to use this working copy." | |
), | |
svn_path_local_style(target_path, pool), | |
svn_path_local_style(abspath, pool)); | |
} | |
if (svn_dirent_is_root(abspath, strlen(abspath))) | |
return SVN_NO_ERROR; | |
else | |
return is_inside_wc_ng(svn_path_dirname(abspath, pool), target_path, | |
wc_format, pool); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment