Merge branch 'maint-1.8.5' into maint-1.9
[gitweb.git] / builtin / cat-file.c
index f8288c830cad215af63dd6d575c9bd4bf7aeaf6c..d5a93e0e911ccbe4560a03ed78436bfb174e0f68 100644 (file)
@@ -118,6 +118,7 @@ struct expand_data {
        unsigned long size;
        unsigned long disk_size;
        const char *rest;
+       unsigned char delta_base_sha1[20];
 
        /*
         * If mark_query is true, we do not expand anything, but rather
@@ -174,6 +175,11 @@ static void expand_atom(struct strbuf *sb, const char *atom, int len,
                        data->split_on_whitespace = 1;
                else if (data->rest)
                        strbuf_addstr(sb, data->rest);
+       } else if (is_atom("deltabase", atom, len)) {
+               if (data->mark_query)
+                       data->info.delta_base_sha1 = data->delta_base_sha1;
+               else
+                       strbuf_addstr(sb, sha1_to_hex(data->delta_base_sha1));
        } else
                die("unknown format element: %.*s", len, atom);
 }
@@ -241,7 +247,7 @@ static int batch_one_object(const char *obj_name, struct batch_options *opt,
                return 0;
        }
 
-       if (sha1_object_info_extended(data->sha1, &data->info) < 0) {
+       if (sha1_object_info_extended(data->sha1, &data->info, LOOKUP_REPLACE_OBJECT) < 0) {
                printf("%s missing\n", obj_name);
                fflush(stdout);
                return 0;