Merge with http://members.cox.net/junkio/git-jc.git
authorPetr Baudis <pasky@ucw.cz>
Wed, 11 May 2005 00:00:49 +0000 (02:00 +0200)
committerPetr Baudis <xpasky@machine.sinus.cz>
Wed, 11 May 2005 00:00:49 +0000 (02:00 +0200)
cache.h
merge-cache.c
object.h
sha1_file.c
tar-tree.c
write-tree.c

diff --git a/cache.h b/cache.h
index 0901fae..ff229ee 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -103,8 +103,8 @@ static inline unsigned int create_ce_mode(unsigned int mode)
 
 #define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
 
-struct cache_entry **active_cache;
-unsigned int active_nr, active_alloc, active_cache_changed;
+extern struct cache_entry **active_cache;
+extern unsigned int active_nr, active_alloc, active_cache_changed;
 
 #define GIT_DIR_ENVIRONMENT "GIT_DIR"
 #define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
index 11079b1..b2977cf 100644 (file)
@@ -5,6 +5,7 @@
 
 static const char *pgm = NULL;
 static const char *arguments[8];
+static int err;
 
 static void run_program(void)
 {
@@ -25,7 +26,7 @@ static void run_program(void)
                die("unable to execute '%s'", pgm);
        }
        if (waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) || WEXITSTATUS(status))
-               die("merge program failed");
+               err++;
 }
 
 static int merge_entry(int pos, const char *path)
@@ -111,5 +112,7 @@ int main(int argc, char **argv)
                }
                merge_file(arg);
        }
+       if (err)
+               die("merge program failed");
        return 0;
 }
index d53a35a..09700d3 100644 (file)
--- a/object.h
+++ b/object.h
@@ -15,8 +15,8 @@ struct object {
        struct object_list *refs;
 };
 
-int nr_objs;
-struct object **objs;
+extern int nr_objs;
+extern struct object **objs;
 
 struct object *lookup_object(unsigned char *sha1);
 
index 7ca0a38..942b673 100644 (file)
@@ -465,7 +465,7 @@ int write_sha1_file(char *buf, unsigned long len, const char *type, unsigned cha
        stream.next_in = hdr;
        stream.avail_in = hdrlen;
        while (deflate(&stream, 0) == Z_OK)
-               /* nothing */
+               /* nothing */;
 
        /* Then the data itself.. */
        stream.next_in = buf;
index 8b0d75b..d313c80 100644 (file)
@@ -1,3 +1,6 @@
+/*
+ * Copyright (c) 2005 Rene Scharfe
+ */
 #include <time.h>
 #include "cache.h"
 
index 19b6ee5..e3c0a02 100644 (file)
@@ -30,7 +30,7 @@ static int write_tree(struct cache_entry **cachep, int maxentries, const char *b
        offset = 0;
 
        nr = 0;
-       do {
+       while (nr < maxentries) {
                struct cache_entry *ce = cachep[nr];
                const char *pathname = ce->name, *filename, *dirname;
                int pathlen = ce_namelen(ce), entrylen;
@@ -75,7 +75,7 @@ static int write_tree(struct cache_entry **cachep, int maxentries, const char *b
                memcpy(buffer + offset, sha1, 20);
                offset += 20;
                nr++;
-       } while (nr < maxentries);
+       }
 
        write_sha1_file(buffer, offset, "tree", returnsha1);
        free(buffer);
@@ -88,8 +88,8 @@ int main(int argc, char **argv)
        int entries = read_cache();
        unsigned char sha1[20];
 
-       if (entries <= 0)
-               die("write-tree: no cache contents to write");
+       if (entries < 0)
+               die("write-tree: error reading cache");
 
        /* Verify that the tree is merged */
        funny = 0;