diff options
-rw-r--r-- | cache.h | 4 | ||||
-rw-r--r-- | merge-cache.c | 5 | ||||
-rw-r--r-- | object.h | 4 | ||||
-rw-r--r-- | sha1_file.c | 2 | ||||
-rw-r--r-- | tar-tree.c | 3 | ||||
-rw-r--r-- | write-tree.c | 8 |
6 files changed, 16 insertions, 10 deletions
@@ -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" diff --git a/merge-cache.c b/merge-cache.c index 11079b1..b2977cf 100644 --- a/merge-cache.c +++ b/merge-cache.c @@ -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; } @@ -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); diff --git a/sha1_file.c b/sha1_file.c index 7ca0a38..942b673 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -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; @@ -1,3 +1,6 @@ +/* + * Copyright (c) 2005 Rene Scharfe + */ #include <time.h> #include "cache.h" diff --git a/write-tree.c b/write-tree.c index 19b6ee5..e3c0a02 100644 --- a/write-tree.c +++ b/write-tree.c @@ -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; |