Re: [PATCH 2/9] gitweb: Separate ref parsing in git_get_refs_list into parse_ref

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 2/9] gitweb: Separate ref parsing in git_get_refs_list into parse_ref

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:37

Jakub Narebski [off-list ref] writes:
quoted hunk
Note that for each ref there are usually two calls to git subroutines:
first to get the type of ref, second to parse ref if ref is of commit
or tag type.

Signed-off-by: Jakub Narebski <redacted>
---
 gitweb/gitweb.perl |   80 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 45 insertions(+), 35 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 28df59e..0c4ec92 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -690,6 +690,49 @@ sub parse_commit {
 	return %co;
 }
 
+# parse ref from ref_file, given by ref_id, with given type
+sub parse_ref {
+	my $ref_file = shift;
+	my $ref_id = shift;
+	my $type = shift || git_get_type($ref_id);
This git_get_type() is additional from the original.
Future-proofing yourself for other new callers?

Re: [PATCH 2/9] gitweb: Separate ref parsing in git_get_refs_list into parse_ref

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:42:37

Junio C Hamano wrote:
Jakub Narebski [off-list ref] writes:
quoted
Note that for each ref there are usually two calls to git subroutines:
first to get the type of ref, second to parse ref if ref is of commit
or tag type.
[...]  
quoted
+# parse ref from ref_file, given by ref_id, with given type
+sub parse_ref {
+    my $ref_file = shift;
+    my $ref_id = shift;
+    my $type = shift || git_get_type($ref_id);
This git_get_type() is additional from the original.
Future-proofing yourself for other new callers?
Yes, just in case.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help