[PATCH] diff-tree usage
[git.git] / update-cache.c
index d08e895..6d37c55 100644 (file)
@@ -69,9 +69,13 @@ static int index_fd(const char *path, int namelen, struct cache_entry *ce, int f
 static void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)
 {
        ce->ctime.sec = st->st_ctime;
+#ifdef NSEC
        ce->ctime.nsec = st->st_ctim.tv_nsec;
+#endif
        ce->mtime.sec = st->st_mtime;
+#ifdef NSEC
        ce->mtime.nsec = st->st_mtim.tv_nsec;
+#endif
        ce->st_dev = st->st_dev;
        ce->st_ino = st->st_ino;
        ce->st_uid = st->st_uid;
@@ -213,7 +217,7 @@ static void refresh_cache(void)
  * are hidden, for chist sake.
  *
  * Also, we don't want double slashes or slashes at the
- * end that can make pathnames ambiguous. 
+ * end that can make pathnames ambiguous.
  */
 static int verify_path(char *path)
 {
@@ -249,14 +253,14 @@ int main(int argc, char **argv)
 
        newfd = open(".git/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);
        if (newfd < 0)
-               usage("unable to create new cachefile");
+               die("unable to create new cachefile");
 
        atexit(remove_lock_file);
        remove_lock = 1;
 
        entries = read_cache();
        if (entries < 0)
-               usage("cache corrupted");
+               die("cache corrupted");
 
        for (i = 1 ; i < argc; i++) {
                char *path = argv[i];
@@ -278,18 +282,18 @@ int main(int argc, char **argv)
                                refresh_cache();
                                continue;
                        }
-                       usage("unknown option %s", path);
+                       die("unknown option %s", path);
                }
                if (!verify_path(path)) {
                        fprintf(stderr, "Ignoring path %s\n", argv[i]);
                        continue;
                }
                if (add_file_to_cache(path))
-                       usage("Unable to add %s to database", path);
+                       die("Unable to add %s to database", path);
        }
        if (write_cache(newfd, active_cache, active_nr) ||
            rename(".git/index.lock", ".git/index"))
-               usage("Unable to write new cachefile");
+               die("Unable to write new cachefile");
 
        remove_lock = 0;
        return 0;