commit - 8ba9a21905d3eb24a672ceb540ce841273b8d1d3
commit + f78b0693d753895550a74d1b49c4c281cb805d39
blob - bdb83fceee0df5c7676df45f010fcf7eb142e276
blob + 0c42f4e29d86ba34acada6a4617c425b87b55331
--- include/got_object.h
+++ include/got_object.h
FILE *f;
struct got_zstream_buf zb;
size_t hdrlen;
+ struct got_object_id id;
};
struct got_tree_entry {
struct got_repository;
-const char * got_object_id_str(struct got_object_id *, char *, size_t);
+char * got_object_id_str(struct got_object_id *, char *, size_t);
const struct got_error *got_object_open(struct got_object **,
struct got_repository *, struct got_object_id *);
void got_object_close(struct got_object *);
blob - 2137919d266108f5a8379e4030cd8e1004fbcd3a
blob + f09406d08a92bc51d90d997a6b5c70e139a877d0
--- lib/diff.c
+++ lib/diff.c
FILE *f1, *f2;
char *n1, *n2;
size_t len, hdrlen;
+ char hex1[SHA1_DIGEST_STRING_LENGTH];
+ char hex2[SHA1_DIGEST_STRING_LENGTH];
int res;
err = open_tempfile(&f1, &n1);
memset(&args, 0, sizeof(args));
args.diff_format = D_UNIFIED;
+ args.label[0] = got_object_id_str(&blob1->id, hex1, sizeof(hex1));
+ args.label[1] = got_object_id_str(&blob2->id, hex2, sizeof(hex2));
err = got_diffreg(&res, n1, n2, 0, &args, &ds);
done:
unlink(n1);
blob - 9f51ba2b9750d803ffa4a14f0064cdd5da775840
blob + a000e961e08ed70c7874b041ba122fbffc528181
--- lib/object.c
+++ lib/object.c
#define GOT_COMMIT_TAG_AUTHOR "author "
#define GOT_COMMIT_TAG_COMMITTER "committer "
-const char *
+char *
got_object_id_str(struct got_object_id *id, char *buf, size_t size)
{
char *p = buf;
}
(*blob)->hdrlen = obj->hdrlen;
+ memcpy(&(*blob)->id.sha1, obj->id.sha1, SHA1_DIGEST_LENGTH);
free(path);
return err;
blob - 926fc74d1f0638380b45f2cbac120b175a884b69
blob + 13ba983f7bbb42075f4dc56c27450e36f0a87a63
--- regress/repository/repository_test.c
+++ regress/repository/repository_test.c
#include "got_refs.h"
#include "got_repository.h"
#include "got_sha1.h"
+#include "got_diff.h"
#define RUN_TEST(expr, name) \
if (!(expr)) { printf("test %s failed", (name)); failure = 1; }
return 0;
putchar('\n');
- got_diff_blob(blob1, blob2, repo);
+ got_diff_blob(blob1, blob2, stdout);
putchar('\n');
got_object_blob_close(blob1);