[PATCH] gitweb: Don’t die_error in git_tag after already printing headers

Subsystems: the rest

STALE3734d

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

[PATCH] gitweb: Don’t die_error in git_tag after already printing headers

From: Anders Kaseorg <hidden>
Date: 2016-06-15 22:49:23

This fixes an XML error when visiting a nonexistent tag
(?p=git.git;a=tag;h=refs/tags/BADNAME).

Signed-off-by: Anders Kaseorg <redacted>
---
 gitweb/gitweb.perl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 84261bb..5dab825 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5192,15 +5192,15 @@ sub git_summary {
 }
 
 sub git_tag {
-	my $head = git_get_head_hash($project);
-	git_header_html();
-	git_print_page_nav('','', $head,undef,$head);
 	my %tag = parse_tag($hash);
 
 	if (! %tag) {
 		die_error(404, "Unknown tag object");
 	}
 
+	my $head = git_get_head_hash($project);
+	git_header_html();
+	git_print_page_nav('','', $head,undef,$head);
 	git_print_header_div('commit', esc_html($tag{'name'}), $hash);
 	print "<div class=\"title_text\">\n" .
 	      "<table class=\"object_header\">\n" .
-- 
1.7.2.2

Re: [PATCH] gitweb: Don’t die_error in git_tag after already printing headers

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:49:25

Anders Kaseorg [off-list ref] writes:
This fixes an XML error when visiting a nonexistent tag
(?p=git.git;a=tag;h=refs/tags/BADNAME).

Signed-off-by: Anders Kaseorg <redacted>
Good catch!

Acked-by: Jakub Narebski <redacted>
quoted hunk
---
 gitweb/gitweb.perl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 84261bb..5dab825 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5192,15 +5192,15 @@ sub git_summary {
 }
 
 sub git_tag {
-	my $head = git_get_head_hash($project);
-	git_header_html();
-	git_print_page_nav('','', $head,undef,$head);
 	my %tag = parse_tag($hash);
 
 	if (! %tag) {
 		die_error(404, "Unknown tag object");
 	}
 
+	my $head = git_get_head_hash($project);
+	git_header_html();
+	git_print_page_nav('','', $head,undef,$head);
 	git_print_header_div('commit', esc_html($tag{'name'}), $hash);
 	print "<div class=\"title_text\">\n" .
 	      "<table class=\"object_header\">\n" .
-- 
1.7.2.2
-- 
Jakub Narebski
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