]> git.armaanb.net Git - stagit.git/blobdiff - stagit.c
simplify, no need for goto
[stagit.git] / stagit.c
index 61804af1623d0a7e8ac6819495bdfdcfbcc3803c..6a79573fe2791ce9cd83916d203f6797381b7cbc 100644 (file)
--- a/stagit.c
+++ b/stagit.c
@@ -125,7 +125,7 @@ commitinfo_getstats(struct commitinfo *ci)
 
                delta = git_patch_get_delta(patch);
 
-               /* check binary data */
+               /* skip stats for binary data */
                if (delta->flags & GIT_DIFF_FLAG_BINARY)
                        continue;
 
@@ -453,7 +453,7 @@ printshowfile(FILE *fp, struct commitinfo *ci)
            ci->ndeltas   > 1000   ||
            ci->addcount  > 100000 ||
            ci->delcount  > 100000) {
-               fprintf(fp, "(diff is too large, output suppressed)");
+               fputs("Diff is too large, output suppressed.\n", fp);
                return;
        }
 
@@ -504,7 +504,7 @@ printshowfile(FILE *fp, struct commitinfo *ci)
 
                /* check binary data */
                if (delta->flags & GIT_DIFF_FLAG_BINARY) {
-                       fputs("Binary files differ\n", fp);
+                       fputs("Binary files differ.\n", fp);
                        continue;
                }
 
@@ -733,7 +733,7 @@ writeblob(git_object *obj, const char *fpath, const char *filename, git_off_t fi
        fputs("</p><hr/>", fp);
 
        if (git_blob_is_binary((git_blob *)obj)) {
-               fputs("<p>Binary file</p>\n", fp);
+               fputs("<p>Binary file.</p>\n", fp);
        } else {
                lc = writeblobhtml(fp, (git_blob *)obj);
                if (ferror(fp))
@@ -866,12 +866,10 @@ writefiles(FILE *fp, const git_oid *id, const char *branch)
              "<td>Mode</td><td>Name</td><td class=\"num\">Size</td>"
              "</tr>\n</thead><tbody>\n", fp);
 
-       if (git_commit_lookup(&commit, repo, id) ||
-           git_commit_tree(&tree, commit))
-               goto err;
-       ret = writefilestree(fp, tree, branch, "");
+       if (!git_commit_lookup(&commit, repo, id) &&
+           !git_commit_tree(&tree, commit))
+               ret = writefilestree(fp, tree, branch, "");
 
-err:
        fputs("</tbody></table>", fp);
 
        git_commit_free(commit);