summaryrefslogtreecommitdiff
path: root/stagit.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2016-04-27 16:39:48 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2016-04-27 16:39:48 +0200
commit86bbe822114c01d9c1bcfe6950463ee1c73e39a5 (patch)
tree603ccf375177a916c85fff0eb186842e4266af8b /stagit.c
parent09a49b3dce9d05d8729fd7bb97efadba69951391 (diff)
fix: link to line in hunk if a patch has multiple files and hunks
thanks to lostd for reporting it!
Diffstat (limited to 'stagit.c')
-rw-r--r--stagit.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/stagit.c b/stagit.c
index 638e58c..e3c921d 100644
--- a/stagit.c
+++ b/stagit.c
@@ -394,7 +394,7 @@ printshowfile(FILE *fp, struct commitinfo *ci)
if (git_patch_get_hunk(&hunk, &nhunklines, patch, j))
break;
- fprintf(fp, "<a href=\"#h%zu\" id=\"h%zu\" class=\"h\">", j, j);
+ fprintf(fp, "<a href=\"#h%zu-%zu\" id=\"h%zu-%zu\" class=\"h\">", i, j, i, j);
xmlencode(fp, hunk->header, hunk->header_len);
fputs("</a>", fp);
@@ -402,11 +402,11 @@ printshowfile(FILE *fp, struct commitinfo *ci)
if (git_patch_get_line_in_hunk(&line, patch, j, k))
break;
if (line->old_lineno == -1)
- fprintf(fp, "<a href=\"#h%zu-%zu\" id=\"h%zu-%zu\" class=\"i\">+",
- j, k, j, k);
+ fprintf(fp, "<a href=\"#h%zu-%zu-%zu\" id=\"h%zu-%zu-%zu\" class=\"i\">+",
+ i, j, k, i, j, k);
else if (line->new_lineno == -1)
- fprintf(fp, "<a href=\"#h%zu-%zu\" id=\"h%zu-%zu\" class=\"d\">-",
- j, k, j, k);
+ fprintf(fp, "<a href=\"#h%zu-%zu-%zu\" id=\"h%zu-%zu-%zu\" class=\"d\">-",
+ i, j, k, i, j, k);
else
fputc(' ', fp);
xmlencode(fp, line->content, line->content_len);