зеркало из https://github.com/microsoft/git.git
Rename static variable write_index to update_index in builtin-apply.c
This is an internal variable used to tell if we need to write out the resulting index. I'll be introducing write_index() function which would collide with it. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Родитель
81e1bc4768
Коммит
7da3bf372c
|
@ -30,7 +30,7 @@ static int unidiff_zero;
|
||||||
static int p_value = 1;
|
static int p_value = 1;
|
||||||
static int p_value_known;
|
static int p_value_known;
|
||||||
static int check_index;
|
static int check_index;
|
||||||
static int write_index;
|
static int update_index;
|
||||||
static int cached;
|
static int cached;
|
||||||
static int diffstat;
|
static int diffstat;
|
||||||
static int numstat;
|
static int numstat;
|
||||||
|
@ -2308,7 +2308,7 @@ static void patch_stats(struct patch *patch)
|
||||||
|
|
||||||
static void remove_file(struct patch *patch, int rmdir_empty)
|
static void remove_file(struct patch *patch, int rmdir_empty)
|
||||||
{
|
{
|
||||||
if (write_index) {
|
if (update_index) {
|
||||||
if (remove_file_from_cache(patch->old_name) < 0)
|
if (remove_file_from_cache(patch->old_name) < 0)
|
||||||
die("unable to remove %s from index", patch->old_name);
|
die("unable to remove %s from index", patch->old_name);
|
||||||
cache_tree_invalidate_path(active_cache_tree, patch->old_name);
|
cache_tree_invalidate_path(active_cache_tree, patch->old_name);
|
||||||
|
@ -2335,7 +2335,7 @@ static void add_index_file(const char *path, unsigned mode, void *buf, unsigned
|
||||||
int namelen = strlen(path);
|
int namelen = strlen(path);
|
||||||
unsigned ce_size = cache_entry_size(namelen);
|
unsigned ce_size = cache_entry_size(namelen);
|
||||||
|
|
||||||
if (!write_index)
|
if (!update_index)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ce = xcalloc(1, ce_size);
|
ce = xcalloc(1, ce_size);
|
||||||
|
@ -2662,8 +2662,8 @@ static int apply_patch(int fd, const char *filename, int inaccurate_eof)
|
||||||
if (whitespace_error && (new_whitespace == error_on_whitespace))
|
if (whitespace_error && (new_whitespace == error_on_whitespace))
|
||||||
apply = 0;
|
apply = 0;
|
||||||
|
|
||||||
write_index = check_index && apply;
|
update_index = check_index && apply;
|
||||||
if (write_index && newfd < 0)
|
if (update_index && newfd < 0)
|
||||||
newfd = hold_lock_file_for_update(&lock_file,
|
newfd = hold_lock_file_for_update(&lock_file,
|
||||||
get_index_file(), 1);
|
get_index_file(), 1);
|
||||||
if (check_index) {
|
if (check_index) {
|
||||||
|
@ -2870,7 +2870,7 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
|
||||||
whitespace_error == 1 ? "s" : "");
|
whitespace_error == 1 ? "s" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write_index) {
|
if (update_index) {
|
||||||
if (write_cache(newfd, active_cache, active_nr) ||
|
if (write_cache(newfd, active_cache, active_nr) ||
|
||||||
close(newfd) || commit_lock_file(&lock_file))
|
close(newfd) || commit_lock_file(&lock_file))
|
||||||
die("Unable to write new index file");
|
die("Unable to write new index file");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче