List for cgit developers and users
 help / color / mirror / Atom feed
From: list at eworm.de (Christian Hesse)
Subject: [PATCH 1/1] ui-blog: fix oid handling
Date: Tue, 11 Oct 2016 08:59:11 +0200	[thread overview]
Message-ID: <20161011065911.18698-1-list@eworm.de> (raw)

From: Christian Hesse <mail at eworm.de>

We have to use a pointer for walk_tree_ctx->matched_oid.

This fixes faulty commit 6e4b7b6776eb994e795fa38b2619db6c55e10ecc
(ui-blob: replace 'unsigned char sha1[20]' with 'struct object_id oid').

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

diff --git a/ui-blob.c b/ui-blob.c
index 2f8bb7a..5f30de7 100644
--- a/ui-blob.c
+++ b/ui-blob.c
@@ -13,7 +13,7 @@
 
 struct walk_tree_context {
 	const char *match_path;
-	struct object_id matched_oid;
+	struct object_id *matched_oid;
 	unsigned int found_path:1;
 	unsigned int file_only:1;
 };
@@ -28,7 +28,7 @@ static int walk_tree(const unsigned char *sha1, struct strbuf *base,
 	if (strncmp(base->buf, walk_tree_ctx->match_path, base->len)
 		|| strcmp(walk_tree_ctx->match_path + base->len, pathname))
 		return READ_TREE_RECURSIVE;
-	hashcpy(walk_tree_ctx->matched_oid.hash, sha1);
+	hashcpy(walk_tree_ctx->matched_oid->hash, sha1);
 	walk_tree_ctx->found_path = 1;
 	return 0;
 }
@@ -47,7 +47,7 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only)
 	};
 	struct walk_tree_context walk_tree_ctx = {
 		.match_path = path,
-		.matched_oid = oid,
+		.matched_oid = &oid,
 		.found_path = 0,
 		.file_only = file_only
 	};
@@ -77,7 +77,7 @@ int cgit_print_file(char *path, const char *head, int file_only)
 	};
 	struct walk_tree_context walk_tree_ctx = {
 		.match_path = path,
-		.matched_oid = oid,
+		.matched_oid = &oid,
 		.found_path = 0,
 		.file_only = file_only
 	};
@@ -120,7 +120,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl
 	};
 	struct walk_tree_context walk_tree_ctx = {
 		.match_path = path,
-		.matched_oid = oid,
+		.matched_oid = &oid,
 		.found_path = 0,
 		.file_only = file_only
 	};
-- 
2.10.0



             reply	other threads:[~2016-10-11  6:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11  6:59 list [this message]
2016-10-16 11:47 ` john

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161011065911.18698-1-list@eworm.de \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).