diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-01-10 22:33:11 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-01-10 22:33:11 +0400 |
commit | b2132068c6df38b24b49dfc6fbbf0645b21ec037 (patch) | |
tree | 56fc704257887e0788cc73e654393605da8171c2 /builtin | |
parent | f06a5e607dde266884db4a99b70fbee09d5c5efc (diff) | |
parent | 65ea9c3c3d0e74b1f8c0c1d9fea6988550133dba (diff) |
Merge branch 'jk/oi-delta-base'
Teach "cat-file --batch" to show delta-base object name for a
packed object that is represented as a delta.
* jk/oi-delta-base:
cat-file: provide %(deltabase) batch format
sha1_object_info_extended: provide delta base sha1s
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/cat-file.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c index f12071adc4..d5a93e0e91 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -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); } |