[PATCH 1/1] RFC: git: update to v2.10.0-rc0 part 2

Christian Hesse list at eworm.de
Mon Aug 15 11:03:24 CEST 2016


From: Christian Hesse <mail at eworm.de>

Just a follow-up to replace more sha1 with oid.

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 ui-diff.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/ui-diff.c b/ui-diff.c
index 0819919..173d351 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -21,8 +21,8 @@ static int lines_added, lines_removed;
 
 static struct fileinfo {
 	char status;
-	unsigned char old_sha1[20];
-	unsigned char new_sha1[20];
+	struct object_id old_oid[1];
+	struct object_id new_oid[1];
 	unsigned short old_mode;
 	unsigned short new_mode;
 	char *old_path;
@@ -83,15 +83,15 @@ static void print_fileinfo(struct fileinfo *info)
 
 	html("<tr>");
 	htmlf("<td class='mode'>");
-	if (is_null_sha1(info->new_sha1)) {
+	if (is_null_oid(info->new_oid)) {
 		cgit_print_filemode(info->old_mode);
 	} else {
 		cgit_print_filemode(info->new_mode);
 	}
 
 	if (info->old_mode != info->new_mode &&
-	    !is_null_sha1(info->old_sha1) &&
-	    !is_null_sha1(info->new_sha1)) {
+	    !is_null_oid(info->old_oid) &&
+	    !is_null_oid(info->new_oid)) {
 		html("<span class='modechange'>[");
 		cgit_print_filemode(info->old_mode);
 		html("]</span>");
@@ -170,8 +170,8 @@ static void inspect_filepair(struct diff_filepair *pair)
 		items = xrealloc(items, slots * sizeof(struct fileinfo));
 	}
 	items[files-1].status = pair->status;
-	hashcpy(items[files-1].old_sha1, pair->one->oid.hash);
-	hashcpy(items[files-1].new_sha1, pair->two->oid.hash);
+	oidcpy(items[files-1].old_oid, &pair->one->oid);
+	oidcpy(items[files-1].new_oid, &pair->two->oid);
 	items[files-1].old_mode = pair->one->mode;
 	items[files-1].new_mode = pair->two->mode;
 	items[files-1].old_path = xstrdup(pair->one->path);
@@ -422,9 +422,9 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
 			return;
 		}
 	} else if (commit->parents && commit->parents->item) {
-		hashcpy(old_rev_oid->hash, commit->parents->item->object.oid.hash);
+		oidcpy(old_rev_oid, &commit->parents->item->object.oid);
 	} else {
-		hashclr(old_rev_oid->hash);
+		oidclr(old_rev_oid);
 	}
 
 	if (!is_null_oid(old_rev_oid)) {
-- 
2.9.3



More information about the CGit mailing list