[PATCH RFC v2 4/4] ref-filter: add deltabase formatting option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add %(deltabase) support. It is still not working for deref:
I am thinking how to support it in a more elegant way.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@xxxxxxxxx>
---
 ref-filter.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/ref-filter.c b/ref-filter.c
index c00de58455301..989ccdb356a32 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -276,6 +276,14 @@ static int objecttype_atom_parser(const struct ref_format *format, struct used_a
 	return 0;
 }
 
+static int deltabase_atom_parser(const struct ref_format *format, struct used_atom *atom,
+				  const char *arg, struct strbuf *unused_err)
+{
+	oi_data.use_data = 1;
+	oi_data.info.delta_base_sha1 = oi_data.delta_base_oid.hash;
+	return 0;
+}
+
 static int objectsize_atom_parser(const struct ref_format *format, struct used_atom *atom,
 				  const char *arg, struct strbuf *err)
 {
@@ -409,6 +417,7 @@ static struct {
 	{ "objecttype", FIELD_STR, objecttype_atom_parser },
 	{ "objectsize", FIELD_ULONG, objectsize_atom_parser },
 	{ "objectname", FIELD_STR, objectname_atom_parser },
+	{ "deltabase", FIELD_STR, deltabase_atom_parser },
 	{ "tree" },
 	{ "parent" },
 	{ "numparent", FIELD_ULONG },
@@ -1572,6 +1581,9 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)
 				v->s = xstrfmt("%lu", oi_data.disk_size);
 			}
 			continue;
+		} else if (!deref && !strcmp(name, "deltabase") && oi_data.use_data) {
+			v->s = xstrdup(oid_to_hex(&oi_data.delta_base_oid));
+			continue;
 		} else if (!strcmp(name, "HEAD")) {
 			if (atom->u.head && !strcmp(ref->refname, atom->u.head))
 				v->s = "*";

--
https://github.com/git/git/pull/493



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux