"git-apply --check" should not report "fixed"
[gitweb.git] / entry.c
diff --git a/entry.c b/entry.c
index 4a8c73bfaee14c84866f1a20b7fcd8421d3812f1..257ab46e943f1f8b7445f01c10d949224c17112f 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -119,9 +119,10 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
                 */
                strbuf_init(&buf, 0);
                if (convert_to_working_tree(ce->name, new, size, &buf)) {
+                       size_t newsize = 0;
                        free(new);
-                       new = buf.buf;
-                       size = buf.len;
+                       new = strbuf_detach(&buf, &newsize);
+                       size = newsize;
                }
 
                if (to_tempfile) {
@@ -202,7 +203,7 @@ int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *t
        strcpy(path + len, ce->name);
 
        if (!lstat(path, &st)) {
-               unsigned changed = ce_match_stat(ce, &st, 1);
+               unsigned changed = ce_match_stat(ce, &st, CE_MATCH_IGNORE_VALID);
                if (!changed)
                        return 0;
                if (!state->force) {