Fix tests under GETTEXT_POISON on git-apply
[gitweb.git] / builtin / apply.c
index ace04c453be447b62b4907c45247f82ef4344033..d453c833782c6aae4dd04fb9f9f68c3a8211d3d5 100644 (file)
@@ -3589,7 +3589,7 @@ static void build_fake_ancestor(struct patch *list, const char *filename)
                name = patch->old_name ? patch->old_name : patch->new_name;
                if (0 < patch->is_new)
                        continue;
-               else if (get_sha1(patch->old_sha1_prefix, sha1))
+               else if (get_sha1_blob(patch->old_sha1_prefix, sha1))
                        /* git diff has no index line for mode/type changes */
                        if (!patch->lines_added && !patch->lines_deleted) {
                                if (get_current_sha1(patch->old_name, sha1))
@@ -3769,7 +3769,8 @@ static void add_index_file(const char *path, unsigned mode, void *buf, unsigned
        ce = xcalloc(1, ce_size);
        memcpy(ce->name, path, namelen);
        ce->ce_mode = create_ce_mode(mode);
-       ce->ce_flags = namelen;
+       ce->ce_flags = create_ce_flags(0);
+       ce->ce_namelen = namelen;
        if (S_ISGITLINK(mode)) {
                const char *s = buf;
 
@@ -3890,7 +3891,8 @@ static void add_conflicted_stages_file(struct patch *patch)
                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);