]> git.armaanb.net Git - stagit.git/blobdiff - stagit-index.c
some README tweaks and rewording, reordering
[stagit.git] / stagit-index.c
index 6b7c699ba7dc82c1c7ca73eddc98fb1153989727..cc70e4de0adf31bc4705fa58204cbafbb14d8b5f 100644 (file)
@@ -21,10 +21,6 @@ static char description[255] = "Repositories";
 static char *name = "";
 static char owner[255];
 
-#ifndef USE_PLEDGE
-#define pledge(p1,p2) 0
-#endif
-
 void
 joinpath(char *buf, size_t bufsiz, const char *path, const char *path2)
 {
@@ -32,7 +28,7 @@ joinpath(char *buf, size_t bufsiz, const char *path, const char *path2)
 
        r = snprintf(buf, bufsiz, "%s%s%s",
                path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2);
-       if (r == -1 || (size_t)r >= bufsiz)
+       if (r < 0 || (size_t)r >= bufsiz)
                errx(1, "path truncated: '%s%s%s'",
                        path, path[0] && path[strlen(path) - 1] != '/' ? "/" : "", path2);
 }
@@ -109,7 +105,6 @@ writelog(FILE *fp)
 
        git_revwalk_new(&w, repo);
        git_revwalk_push_head(w);
-       git_revwalk_sorting(w, GIT_SORT_TIME);
        git_revwalk_simplify_first_parent(w);
 
        if (git_revwalk_next(&id, w) ||
@@ -151,7 +146,6 @@ err:
 int
 main(int argc, char *argv[])
 {
-       const git_error *e = NULL;
        FILE *fp;
        char path[PATH_MAX], repodirabs[PATH_MAX + 1];
        const char *repodir;
@@ -164,8 +158,10 @@ main(int argc, char *argv[])
 
        git_libgit2_init();
 
+#ifdef __OpenBSD__
        if (pledge("stdio rpath", NULL) == -1)
                err(1, "pledge");
+#endif
 
        writeheader(stdout);
 
@@ -176,8 +172,7 @@ main(int argc, char *argv[])
 
                if (git_repository_open_ext(&repo, repodir,
                    GIT_REPOSITORY_OPEN_NO_SEARCH, NULL)) {
-                       e = giterr_last();
-                       fprintf(stderr, "%s: %s\n", argv[0], e->message);
+                       fprintf(stderr, "%s: cannot open repository\n", argv[0]);
                        ret = 1;
                        continue;
                }