For each tag object created, we create a corresponding softref from the tagged object to the tag object itself. This is needed to enable efficient lookup of which tag objects that point to a given commit/object. Signed-off-by: Johan Herland <johan@xxxxxxxxxxx> --- mktag.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/mktag.c b/mktag.c index af0cfa6..db8a6b8 100644 --- a/mktag.c +++ b/mktag.c @@ -1,5 +1,6 @@ #include "cache.h" #include "tag.h" +#include "softrefs.h" /* * Tag object data has the following format: two mandatory lines of @@ -32,6 +33,7 @@ int main(int argc, char **argv) { unsigned long size = 4096; char *buffer = xmalloc(size); + struct tag result_tag; unsigned char result_sha1[20]; if (argc != 1) @@ -46,7 +48,7 @@ int main(int argc, char **argv) buffer[size] = 0; /* Verify tag object data */ - if (parse_and_verify_tag_buffer(0, buffer, size, 1)) { + if (parse_and_verify_tag_buffer(&result_tag, buffer, size, 1)) { free(buffer); die("invalid tag data file"); } @@ -57,6 +59,13 @@ int main(int argc, char **argv) } free(buffer); + + /* Create reverse mapping softref */ + if (add_softref(result_tag.tagged->sha1, result_sha1) < 0) { + die("unable to create softref for resulting tag object %s", + sha1_to_hex(result_sha1)); + } + printf("%s\n", sha1_to_hex(result_sha1)); return 0; } -- 1.5.2.1.144.gabc40 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html