diff --git a/stagit.c b/stagit.c index 73eb723..c35a55b 100644 --- a/stagit.c +++ b/stagit.c @@ -775,199 +775,140 @@ err: } int -writebranches(FILE *fp) +refs_cmp(const void *v1, const void *v2) { - struct commitinfo *ci; - git_branch_iterator *it = NULL; - git_branch_t branch; - git_reference *ref = NULL, *dref = NULL; - const git_oid *id = NULL; - const char *branchname = NULL; - size_t len; - int ret = -1; + git_reference *r1 = (*(git_reference **)v1); + git_reference *r2 = (*(git_reference **)v2); + int t1, t2; - /* log for local branches */ - if (git_branch_iterator_new(&it, repo, GIT_BRANCH_LOCAL)) - return -1; + t1 = git_reference_is_branch(r1); + t2 = git_reference_is_branch(r2); - fputs("
Branch | Age | " - "Commit message | " - "Author | Files | + | " - "- |
", fp); - xmlencode(fp, branchname, strlen(branchname)); - fputs(" | ", fp); - if (ci->author) - printtimeshort(fp, &(ci->author->when)); - fputs(" | ", fp); - if (ci->summary) { - if ((len = strlen(ci->summary)) > summarylen) { - xmlencode(fp, ci->summary, summarylen - 1); - fputs("…", fp); - } else { - xmlencode(fp, ci->summary, len); - } - } - fputs(" | ", fp); - if (ci->author) - xmlencode(fp, ci->author->name, strlen(ci->author->name)); - fputs(" | ", fp); - fprintf(fp, "%zu", ci->filecount); - fputs(" | ", fp); - fprintf(fp, "+%zu", ci->addcount); - fputs(" | ", fp); - fprintf(fp, "-%zu", ci->delcount); - fputs(" |
Tag | " - "Age | Commit message | " - "Author | Files | + | " - "- |
", fp); - xmlencode(fp, tagnames.strings[i], strlen(tagnames.strings[i])); - fputs(" | ", fp); - if (ci->author) - printtimeshort(fp, &(ci->author->when)); - fputs(" | ", fp); - if (ci->summary) { - fprintf(fp, "", relpath, ci->oid); - if ((len = strlen(ci->summary)) > summarylen) { - xmlencode(fp, ci->summary, summarylen - 1); - fputs("…", fp); - } else { - xmlencode(fp, ci->summary, len); - } - fputs("", fp); - } - fputs(" | ", fp); - if (ci->author) - xmlencode(fp, ci->author->name, strlen(ci->author->name)); - fputs(" | ", fp); - fprintf(fp, "%zu", ci->filecount); - fputs(" | ", fp); - fprintf(fp, "+%zu", ci->addcount); - fputs(" | ", fp); - fprintf(fp, "-%zu", ci->delcount); - fputs(" |
%s | " + "Age | Commit message | " + "Author | Files | + | " + "- |
", fp); + xmlencode(fp, name, strlen(name)); + fputs(" | ", fp); + if (ci->author) + printtimeshort(fp, &(ci->author->when)); + fputs(" | ", fp); + if (ci->summary) { + fprintf(fp, "", relpath, ci->oid); + if ((len = strlen(ci->summary)) > summarylen) { + xmlencode(fp, ci->summary, summarylen - 1); + fputs("…", fp); + } else { + xmlencode(fp, ci->summary, len); + } + fputs("", fp); + } + fputs(" | ", fp); + if (ci->author) + xmlencode(fp, ci->author->name, strlen(ci->author->name)); + fputs(" | ", fp); + fprintf(fp, "%zu", ci->filecount); + fputs(" | ", fp); + fprintf(fp, "+%zu", ci->addcount); + fputs(" | ", fp); + fprintf(fp, "-%zu", ci->delcount); + fputs(" |