Merge branch 'tg/ce-namelen-field'
authorJunio C Hamano <gitster@pobox.com>
Tue, 24 Jul 2012 03:55:16 +0000 (20:55 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Jul 2012 03:55:21 +0000 (20:55 -0700)
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

1  2 
builtin/apply.c
cache.h
read-cache.c
unpack-trees.c

diff --cc builtin/apply.c
index 069cf341b653080e2bae64faa0a00b387f88c961,19e824255594732aabcefaf5055552ca350a303c..d453c833782c6aae4dd04fb9f9f68c3a8211d3d5
@@@ -3871,32 -3613,6 +3872,33 @@@ static void create_one_file(char *path
        die_errno(_("unable to write file '%s' mode %o"), path, mode);
  }
  
-               ce->ce_flags = create_ce_flags(namelen, stage);
 +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(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;
diff --cc cache.h
Simple merge
diff --cc read-cache.c
Simple merge
diff --cc unpack-trees.c
Simple merge