make file in diff a link, make hunk and link anchor - stagit-gopher - A git gop… | |
git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2h… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
LICENSE | |
--- | |
commit 53d6b47cc28903f9344245a36d33be6d0a6eee45 | |
parent ded9719afd1c9108dc6bbebb8205086a740add3b | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Mon, 7 Dec 2015 19:00:16 +0100 | |
make file in diff a link, make hunk and link anchor | |
Diffstat: | |
M urmoms.c | 10 +++++++--- | |
1 file changed, 7 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/urmoms.c b/urmoms.c | |
@@ -259,7 +259,7 @@ printshowfile(git_commit *commit) | |
} | |
delta = git_patch_get_delta(patch); | |
- fprintf(fp, "diff --git a/<a href=\"%s%s\">%s</a> b/<a href=\"… | |
+ fprintf(fp, "diff --git a/<a href=\"%sfile/%s\">%s</a> b/<a hr… | |
relpath, delta->old_file.path, delta->old_file.path, | |
relpath, delta->new_file.path, delta->new_file.path); | |
@@ -285,12 +285,16 @@ printshowfile(git_commit *commit) | |
if (git_patch_get_line_in_hunk(&line, patch, j… | |
break; | |
if (line->old_lineno == -1) | |
- fputc('+', fp); | |
+ fprintf(fp, "<span class=\"i\"><a href… | |
+ j, k, j, k); | |
else if (line->new_lineno == -1) | |
- fputc('-', fp); | |
+ fprintf(fp, "<span class=\"d\"><a href… | |
+ j, k, j, k); | |
else | |
fputc(' ', fp); | |
xmlencode(fp, line->content, line->content_len… | |
+ if (line->old_lineno == -1 || line->new_lineno… | |
+ fputs("</a></span>", fp); | |
} | |
} | |
git_patch_free(patch); |