Code

Fix 'git remote show' regression on empty repository in 1.5.4
[git.git] / entry.c
diff --git a/entry.c b/entry.c
index 98f5f6d4ecfc0dabae9a920bdf3beadbf20abcaf..257ab46e943f1f8b7445f01c10d949224c17112f 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -119,8 +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 = strbuf_detach(&buf, &size);
+                       new = strbuf_detach(&buf, &newsize);
+                       size = newsize;
                }
 
                if (to_tempfile) {
@@ -201,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) {