/* automatically update cleanly resolved paths to the index */
static int rerere_autoupdate;
-static char *merge_rr_path;
-
const char *rerere_path(const char *hex, const char *file)
{
return git_path("rr-cache/%s/%s", hex, file);
{
unsigned char sha1[20];
char buf[PATH_MAX];
- FILE *in = fopen(merge_rr_path, "r");
+ FILE *in = fopen(git_path_merge_rr(), "r");
if (!in)
return;
while (fread(buf, 40, 1, in) == 1) {
git_config(git_default_config, NULL);
}
+static GIT_PATH_FUNC(git_path_rr_cache, "rr-cache")
+
static int is_rerere_enabled(void)
{
- const char *rr_cache;
int rr_cache_exists;
if (!rerere_enabled)
return 0;
- rr_cache = git_path("rr-cache");
- rr_cache_exists = is_directory(rr_cache);
+ rr_cache_exists = is_directory(git_path_rr_cache());
if (rerere_enabled < 0)
return rr_cache_exists;
- if (!rr_cache_exists && mkdir_in_gitdir(rr_cache))
- die("Could not create directory %s", rr_cache);
+ if (!rr_cache_exists && mkdir_in_gitdir(git_path_rr_cache()))
+ die("Could not create directory %s", git_path_rr_cache());
return 1;
}
if (flags & (RERERE_AUTOUPDATE|RERERE_NOAUTOUPDATE))
rerere_autoupdate = !!(flags & RERERE_AUTOUPDATE);
- merge_rr_path = git_pathdup("MERGE_RR");
- fd = hold_lock_file_for_update(&write_lock, merge_rr_path,
+ fd = hold_lock_file_for_update(&write_lock, git_path_merge_rr(),
LOCK_DIE_ON_ERROR);
read_rr(merge_rr);
return fd;
if (!has_rerere_resolution(name))
unlink_rr_item(name);
}
- unlink_or_warn(git_path("MERGE_RR"));
+ unlink_or_warn(git_path_merge_rr());
}