Show 25 quoted lines
> @@ -1994,20 +2014,18 @@ static int apply_data(struct patch *patch, struct stat *st, struct cache_entry *
> alloc = 0;
> buf = NULL;
> if (cached) {
> - if (ce) {
> - enum object_type type;
> - buf = read_sha1_file(ce->sha1, &type, &size);
> - if (!buf)
> - return error("read of %s failed",
> - patch->old_name);
> - alloc = size;
> - }
> + if (read_file_or_gitlink(ce, &buf, &size))
> + return error("read of %s failed", patch->old_name);
> + alloc = size;
> }
> else if (patch->old_name) {
> size = xsize_t(st->st_size);
> alloc = size + 8192;
> buf = xmalloc(alloc);
> - if (read_old_data(st, patch->old_name, &buf, &alloc, &size))
> + if (S_ISGITLINK(patch->old_mode))
> + size = snprintf(buf, alloc,
> + "Subproject commit %s\n", sha1_to_hex(ce->sha1));
> + else if (read_old_data(st, patch->old_name, &buf, &alloc, &size))