From: Junio C Hamano Date: Tue, 24 Jul 2012 03:55:16 +0000 (-0700) Subject: Merge branch 'tg/ce-namelen-field' X-Git-Tag: v1.7.12-rc0~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=30ea575876f61c38c59cd578afd8e8789857094b;p=git.git Merge branch 'tg/ce-namelen-field' Split lower bits of ce_flags field and creates a new ce_namelen field in the in-core index structure. * tg/ce-namelen-field: Strip namelen out of ce_flags into a ce_namelen field --- 30ea575876f61c38c59cd578afd8e8789857094b diff --cc builtin/apply.c index 069cf341b,19e824255..d453c8337 --- a/builtin/apply.c +++ b/builtin/apply.c @@@ -3871,32 -3613,6 +3872,33 @@@ static void create_one_file(char *path die_errno(_("unable to write file '%s' mode %o"), path, mode); } +static void add_conflicted_stages_file(struct patch *patch) +{ + int stage, namelen; + unsigned ce_size, mode; + struct cache_entry *ce; + + if (!update_index) + return; + namelen = strlen(patch->new_name); + ce_size = cache_entry_size(namelen); + mode = patch->new_mode ? patch->new_mode : (S_IFREG | 0644); + + remove_file_from_cache(patch->new_name); + for (stage = 1; stage < 4; stage++) { + if (is_null_sha1(patch->threeway_stage[stage - 1])) + continue; + ce = xcalloc(1, ce_size); + memcpy(ce->name, patch->new_name, namelen); + ce->ce_mode = create_ce_mode(mode); - ce->ce_flags = create_ce_flags(namelen, stage); ++ ce->ce_flags = create_ce_flags(stage); ++ ce->ce_namelen = namelen; + hashcpy(ce->sha1, patch->threeway_stage[stage - 1]); + if (add_cache_entry(ce, ADD_CACHE_OK_TO_ADD) < 0) + die(_("unable to add cache entry for %s"), patch->new_name); + } +} + static void create_file(struct patch *patch) { char *path = patch->new_name;