Commit 867f7c9b by Russell Belfer

Rename new fn to git_repository_reinit_filesystem

parent 92dac975
...@@ -52,10 +52,10 @@ GIT_EXTERN(void) git_repository__cleanup(git_repository *repo); ...@@ -52,10 +52,10 @@ GIT_EXTERN(void) git_repository__cleanup(git_repository *repo);
* properties to compensate for the current filesystem of the repo. * properties to compensate for the current filesystem of the repo.
* *
* @param repo A repository object * @param repo A repository object
* @param recurse_submodules Should submodules be reset recursively * @param recurse_submodules Should submodules be updated recursively
* @returrn 0 on success, < 0 on error * @returrn 0 on success, < 0 on error
*/ */
GIT_EXTERN(int) git_repository_reset_filesystem( GIT_EXTERN(int) git_repository_reinit_filesystem(
git_repository *repo, git_repository *repo,
int recurse_submodules); int recurse_submodules);
......
...@@ -1097,20 +1097,20 @@ cleanup: ...@@ -1097,20 +1097,20 @@ cleanup:
return error; return error;
} }
static int repo_reset_submodule_fs(git_submodule *sm, const char *n, void *p) static int repo_reinit_submodule_fs(git_submodule *sm, const char *n, void *p)
{ {
git_repository *smrepo = NULL; git_repository *smrepo = NULL;
GIT_UNUSED(n); GIT_UNUSED(p); GIT_UNUSED(n); GIT_UNUSED(p);
if (git_submodule_open(&smrepo, sm) < 0 || if (git_submodule_open(&smrepo, sm) < 0 ||
git_repository_reset_filesystem(smrepo, true) < 0) git_repository_reinit_filesystem(smrepo, true) < 0)
giterr_clear(); giterr_clear();
git_repository_free(smrepo); git_repository_free(smrepo);
return 0; return 0;
} }
int git_repository_reset_filesystem(git_repository *repo, int recurse) int git_repository_reinit_filesystem(git_repository *repo, int recurse)
{ {
int error = 0; int error = 0;
git_buf path = GIT_BUF_INIT; git_buf path = GIT_BUF_INIT;
...@@ -1127,7 +1127,7 @@ int git_repository_reset_filesystem(git_repository *repo, int recurse) ...@@ -1127,7 +1127,7 @@ int git_repository_reset_filesystem(git_repository *repo, int recurse)
git_repository__cvar_cache_clear(repo); git_repository__cvar_cache_clear(repo);
if (!repo->is_bare && recurse) if (!repo->is_bare && recurse)
(void)git_submodule_foreach(repo, repo_reset_submodule_fs, NULL); (void)git_submodule_foreach(repo, repo_reinit_submodule_fs, NULL);
return error; return error;
} }
......
...@@ -192,7 +192,7 @@ git_repository *cl_git_sandbox_init(const char *sandbox) ...@@ -192,7 +192,7 @@ git_repository *cl_git_sandbox_init(const char *sandbox)
cl_git_pass(git_repository_open(&_cl_repo, sandbox)); cl_git_pass(git_repository_open(&_cl_repo, sandbox));
/* Adjust configs after copying to new filesystem */ /* Adjust configs after copying to new filesystem */
cl_git_pass(git_repository_reset_filesystem(_cl_repo, 0)); cl_git_pass(git_repository_reinit_filesystem(_cl_repo, 0));
return _cl_repo; return _cl_repo;
} }
......
...@@ -240,7 +240,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void) ...@@ -240,7 +240,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
git_repository_set_config(g_repo, cfg); git_repository_set_config(g_repo, cfg);
git_config_free(cfg); git_config_free(cfg);
git_repository_reset_filesystem(g_repo, false); git_repository_reinit_filesystem(g_repo, false);
cl_git_pass( cl_git_pass(
git_futils_readbuffer(&old_content, "renames/songof7cities.txt")); git_futils_readbuffer(&old_content, "renames/songof7cities.txt"));
...@@ -524,7 +524,7 @@ void test_diff_patch__line_counts_with_eofnl(void) ...@@ -524,7 +524,7 @@ void test_diff_patch__line_counts_with_eofnl(void)
git_repository_set_config(g_repo, cfg); git_repository_set_config(g_repo, cfg);
git_config_free(cfg); git_config_free(cfg);
git_repository_reset_filesystem(g_repo, false); git_repository_reinit_filesystem(g_repo, false);
cl_git_pass(git_futils_readbuffer(&content, "renames/songof7cities.txt")); cl_git_pass(git_futils_readbuffer(&content, "renames/songof7cities.txt"));
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "util.h" #include "util.h"
#include "posix.h" #include "posix.h"
#include "submodule_helpers.h" #include "submodule_helpers.h"
#include "git2/sys/repository.h"
/* rewrite gitmodules -> .gitmodules /* rewrite gitmodules -> .gitmodules
* rewrite the empty or relative urls inside each module * rewrite the empty or relative urls inside each module
...@@ -102,7 +103,7 @@ git_repository *setup_fixture_submodules(void) ...@@ -102,7 +103,7 @@ git_repository *setup_fixture_submodules(void)
cl_set_cleanup(cleanup_fixture_submodules, "testrepo.git"); cl_set_cleanup(cleanup_fixture_submodules, "testrepo.git");
cl_git_pass(git_repository_reset_filesystem(repo, 1)); cl_git_pass(git_repository_reinit_filesystem(repo, 1));
return repo; return repo;
} }
...@@ -120,7 +121,7 @@ git_repository *setup_fixture_submod2(void) ...@@ -120,7 +121,7 @@ git_repository *setup_fixture_submod2(void)
cl_set_cleanup(cleanup_fixture_submodules, "submod2_target"); cl_set_cleanup(cleanup_fixture_submodules, "submod2_target");
cl_git_pass(git_repository_reset_filesystem(repo, 1)); cl_git_pass(git_repository_reinit_filesystem(repo, 1));
return repo; return repo;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment