fix: link to line in hunk if a patch has multiple files and hunks
thanks to lostd for reporting it!
This commit is contained in:
parent
09a49b3dce
commit
86bbe82211
1 changed files with 5 additions and 5 deletions
10
stagit.c
10
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);
|
||||
|
|
Loading…
Reference in a new issue