From d402811bd2db21c7868411a279fd2d220f54c294 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sun, 18 May 2008 23:16:50 +0200 Subject: [PATCH 01/16] cache.c: make all io-related functions return errno on error We'll need proper return-values from these functions to make the cache behave correctly (which includes giving proper error messages). Noticed-by: Jim Meyering Signed-off-by: Lars Hjemli --- cache.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/cache.c b/cache.c index add647e..6847202 100644 --- a/cache.c +++ b/cache.c @@ -66,12 +66,16 @@ static int open_slot(struct cache_slot *slot) } /* Close the active cache slot */ -static void close_slot(struct cache_slot *slot) +static int close_slot(struct cache_slot *slot) { + int err = 0; if (slot->cache_fd > 0) { - close(slot->cache_fd); - slot->cache_fd = -1; + if (close(slot->cache_fd)) + err = errno; + else + slot->cache_fd = -1; } + return err; } /* Print the content of the active cache slot (but skip the key). */ @@ -116,12 +120,16 @@ static int is_modified(struct cache_slot *slot) } /* Close an open lockfile */ -static void close_lock(struct cache_slot *slot) +static int close_lock(struct cache_slot *slot) { + int err = 0; if (slot->lock_fd > 0) { - close(slot->lock_fd); - slot->lock_fd = -1; + if (close(slot->lock_fd)) + err = errno; + else + slot->lock_fd = -1; } + return err; } /* Create a lockfile used to store the generated content for a cache @@ -134,7 +142,8 @@ static int lock_slot(struct cache_slot *slot) S_IRUSR|S_IWUSR); if (slot->lock_fd == -1) return errno; - write(slot->lock_fd, slot->key, slot->keylen + 1); + if (write(slot->lock_fd, slot->key, slot->keylen + 1) < 0) + return errno; return 0; } @@ -150,7 +159,11 @@ static int unlock_slot(struct cache_slot *slot, int replace_old_slot) err = rename(slot->lock_name, slot->cache_name); else err = unlink(slot->lock_name); - return err; + + if (err) + return errno; + + return 0; } /* Generate the content for the current cache slot by redirecting @@ -177,7 +190,9 @@ static int fill_slot(struct cache_slot *slot) return errno; /* Close the temporary filedescriptor */ - close(tmp); + if (close(tmp)) + return errno; + return 0; } -- 2.50.1 From cdc6b2f8e7a8d43dcfe0475a9d3498333ea686b8 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sun, 18 May 2008 23:26:05 +0200 Subject: [PATCH 02/16] cache.c: use xread()/xwrite() from libgit These functions handles EINTR/EAGAIN errors during read/write operations, which is something cache.c didn't. While at it, fix a bug in print_slot() where errors during reading from the cache slot might go by unnoticed. Noticed-by: Jim Meyering Signed-off-by: Lars Hjemli --- cache.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cache.c b/cache.c index 6847202..a996109 100644 --- a/cache.c +++ b/cache.c @@ -51,7 +51,7 @@ static int open_slot(struct cache_slot *slot) if (fstat(slot->cache_fd, &slot->cache_st)) return errno; - slot->bufsize = read(slot->cache_fd, slot->buf, sizeof(slot->buf)); + slot->bufsize = xread(slot->cache_fd, slot->buf, sizeof(slot->buf)); if (slot->bufsize < 0) return errno; @@ -81,16 +81,16 @@ static int close_slot(struct cache_slot *slot) /* Print the content of the active cache slot (but skip the key). */ static int print_slot(struct cache_slot *slot) { - ssize_t i, j = 0; + ssize_t i; i = lseek(slot->cache_fd, slot->keylen + 1, SEEK_SET); if (i != slot->keylen + 1) return errno; - while((i=read(slot->cache_fd, slot->buf, sizeof(slot->buf))) > 0) - j = write(STDOUT_FILENO, slot->buf, i); + while((i = xread(slot->cache_fd, slot->buf, sizeof(slot->buf))) > 0) + i = xwrite(STDOUT_FILENO, slot->buf, i); - if (j < 0) + if (i < 0) return errno; else return 0; @@ -142,7 +142,7 @@ static int lock_slot(struct cache_slot *slot) S_IRUSR|S_IWUSR); if (slot->lock_fd == -1) return errno; - if (write(slot->lock_fd, slot->key, slot->keylen + 1) < 0) + if (xwrite(slot->lock_fd, slot->key, slot->keylen + 1) < 0) return errno; return 0; } -- 2.50.1 From af2e75616d1bfb7dc79d299d10ae0bd39bef47bc Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sun, 18 May 2008 23:59:11 +0200 Subject: [PATCH 03/16] cache.c: do not ignore errors from print_slot() If print_slot() fails, the client will be served an inferior response. This patch makes sure that such an error will be returned to main(), which in turn will try to inform about the error in the response itself. The error is also printed to the cache_log, i.e. stderr, which will make the error message appear in error_log (atleast when httpd==apache). Noticed-by: Jim Meyering Signed-off-by: Lars Hjemli --- cache.c | 16 +++++++++++++--- cgit.c | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cache.c b/cache.c index a996109..aa97ae1 100644 --- a/cache.c +++ b/cache.c @@ -252,9 +252,14 @@ static int process_slot(struct cache_slot *slot) } } } - print_slot(slot); + if ((err = print_slot(slot)) != 0) { + cache_log("[cgit] error printing cache %s: %s (%d)\n", + slot->cache_name, + strerror(err), + err); + } close_slot(slot); - return 0; + return err; } /* If the cache slot does not exist (or its key doesn't match the @@ -289,7 +294,12 @@ static int process_slot(struct cache_slot *slot) // the lock file. slot->cache_fd = slot->lock_fd; unlock_slot(slot, 1); - err = print_slot(slot); + if ((err = print_slot(slot)) != 0) { + cache_log("[cgit] error printing cache %s: %s (%d)\n", + slot->cache_name, + strerror(err), + err); + } close_slot(slot); return err; } diff --git a/cgit.c b/cgit.c index 2036ceb..ac882c3 100644 --- a/cgit.c +++ b/cgit.c @@ -380,7 +380,7 @@ int main(int argc, const char **argv) err = cache_process(ctx.cfg.cache_size, ctx.cfg.cache_root, ctx.qry.raw, ttl, process_request, &ctx); if (err) - cache_log("[cgit] error %d - %s\n", - err, strerror(err)); + cgit_print_error(fmt("Error processing page: %s (%d)", + strerror(err), err)); return err; } -- 2.50.1 From dd7c172542440170b5b1aca8be43d2ad6dae7227 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Tue, 20 May 2008 17:56:47 +0200 Subject: [PATCH 04/16] cache.c: fix error checking in print_slot() The change to print_slot() in cdc6b2f8e7a8d43dcfe0475a9d3498333ea686b8 made the function return correct errno for read errors while ignoring write errors, which is not what was intended. This patch tries to rectify things. Signed-off-by: Lars Hjemli --- cache.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cache.c b/cache.c index aa97ae1..9f02cf5 100644 --- a/cache.c +++ b/cache.c @@ -81,16 +81,19 @@ static int close_slot(struct cache_slot *slot) /* Print the content of the active cache slot (but skip the key). */ static int print_slot(struct cache_slot *slot) { - ssize_t i; + ssize_t i, j; i = lseek(slot->cache_fd, slot->keylen + 1, SEEK_SET); if (i != slot->keylen + 1) return errno; - while((i = xread(slot->cache_fd, slot->buf, sizeof(slot->buf))) > 0) - i = xwrite(STDOUT_FILENO, slot->buf, i); + do { + i = j = xread(slot->cache_fd, slot->buf, sizeof(slot->buf)); + if (i > 0) + j = xwrite(STDOUT_FILENO, slot->buf, i); + } while (i > 0 && j == i); - if (i < 0) + if (i < 0 || j != i) return errno; else return 0; -- 2.50.1 From 08a8757fa54ee70d31882344ca7f19de5cbe4690 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Tue, 20 May 2008 22:32:22 +0200 Subject: [PATCH 05/16] ui-tree.c: avoid peeking at GITLINK objects When an object in the tree has GITLINK mode-bits we don't need to get any more info about that particular object (and trying to get more info about it will usually generate an annoying warning on stderr since the object typically doesn't exist in the repo anyways). Signed-off-by: Lars Hjemli --- ui-tree.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ui-tree.c b/ui-tree.c index 2f052c7..5a2dd3f 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -73,12 +73,14 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen, fullpath = fmt("%s%s%s", ctx.qry.path ? ctx.qry.path : "", ctx.qry.path ? "/" : "", name); - type = sha1_object_info(sha1, &size); - if (type == OBJ_BAD && !S_ISGITLINK(mode)) { - htmlf("Bad object: %s %s", - name, - sha1_to_hex(sha1)); - return 0; + if (!S_ISGITLINK(mode)) { + type = sha1_object_info(sha1, &size); + if (type == OBJ_BAD) { + htmlf("Bad object: %s %s", + name, + sha1_to_hex(sha1)); + return 0; + } } html(""); -- 2.50.1 From e6b635c2b1a0b2c08170c70e8b9e59f4b9789431 Mon Sep 17 00:00:00 2001 From: Harley Laue Date: Tue, 20 May 2008 19:08:21 -0500 Subject: [PATCH 06/16] Added root-desc to default configuration. Signed-off-by: Harley Laue Signed-off-by: Lars Hjemli --- cgitrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cgitrc b/cgitrc index ce0c01b..f1d8997 100644 --- a/cgitrc +++ b/cgitrc @@ -90,6 +90,10 @@ #root-title=Git repository browser +## Set the description printed on the root page +#root-desc=a fast web interface for the git dscm + + ## If specified, the file at this path will be included as HTML in the ## sidebar on the repository index page #index-info= -- 2.50.1 From 01d2dce7e73e3f022d186de27dd5d15574144ca8 Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Tue, 24 Jun 2008 23:33:24 +0200 Subject: [PATCH 07/16] allow blob extract blobs by head/path combination If blob is invoked with no id=, it tries to look up h= and search for path= in there. Once found, proceed as normal, otherwise, fail as normal. Signed-off-by: Michael Krelin --- cmd.c | 2 +- ui-blob.c | 37 +++++++++++++++++++++++++++++++++---- ui-blob.h | 2 +- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/cmd.c b/cmd.c index 4edca6b..fe0ea8f 100644 --- a/cmd.c +++ b/cmd.c @@ -32,7 +32,7 @@ static void about_fn(struct cgit_context *ctx) static void blob_fn(struct cgit_context *ctx) { - cgit_print_blob(ctx->qry.sha1, ctx->qry.path); + cgit_print_blob(ctx->qry.sha1, ctx->qry.path, ctx->qry.head); } static void commit_fn(struct cgit_context *ctx) diff --git a/ui-blob.c b/ui-blob.c index ab44659..dd1bbce 100644 --- a/ui-blob.c +++ b/ui-blob.c @@ -10,20 +10,49 @@ #include "html.h" #include "ui-shared.h" -void cgit_print_blob(const char *hex, char *path) +static char *match_path; +static unsigned char *matched_sha1; + +static int walk_tree(const unsigned char *sha1, const char *base,int baselen, const char *pathname, unsigned mode, int stage) { + if(strncmp(base,match_path,baselen) + || strcmp(match_path+baselen,pathname) ) + return READ_TREE_RECURSIVE; + memmove(matched_sha1,sha1,20); + return 0; +} + +void cgit_print_blob(const char *hex, char *path, const char *head) { unsigned char sha1[20]; enum object_type type; unsigned char *buf; unsigned long size; + struct commit *commit; + const char *paths[] = {path, NULL}; - if (get_sha1_hex(hex, sha1)){ - cgit_print_error(fmt("Bad hex value: %s", hex)); - return; + if (hex) { + if (get_sha1_hex(hex, sha1)){ + cgit_print_error(fmt("Bad hex value: %s", hex)); + return; + } + } else { + if (get_sha1(head,sha1)) { + cgit_print_error(fmt("Bad ref: %s", head)); + return; + } } type = sha1_object_info(sha1, &size); + + if((!hex) && type == OBJ_COMMIT && path) { + commit = lookup_commit_reference(sha1); + match_path = path; + matched_sha1 = sha1; + read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree); + type = sha1_object_info(sha1,&size); + } + if (type == OBJ_BAD) { cgit_print_error(fmt("Bad object name: %s", hex)); return; diff --git a/ui-blob.h b/ui-blob.h index 5a920a8..dad275a 100644 --- a/ui-blob.h +++ b/ui-blob.h @@ -1,6 +1,6 @@ #ifndef UI_BLOB_H #define UI_BLOB_H -extern void cgit_print_blob(const char *hex, char *path); +extern void cgit_print_blob(const char *hex, char *path, const char *head); #endif /* UI_BLOB_H */ -- 2.50.1 From 42effc939090b2fbf1b2b76cd1d9c30fabcd230e Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Tue, 24 Jun 2008 23:42:32 +0200 Subject: [PATCH 08/16] allow specification of directly linked blobs mimetypes Signed-off-by: Michael Krelin --- cgit.c | 2 ++ cgit.h | 1 + ui-blob.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cgit.c b/cgit.c index ac882c3..0deae12 100644 --- a/cgit.c +++ b/cgit.c @@ -144,6 +144,8 @@ static void querystring_cb(const char *name, const char *value) ctx.qry.path = trim_end(value, '/'); } else if (!strcmp(name, "name")) { ctx.qry.name = xstrdup(value); + } else if (!strcmp(name, "mimetype")) { + ctx.qry.mimetype = xstrdup(value); } } diff --git a/cgit.h b/cgit.h index 4fa5cf2..1972d75 100644 --- a/cgit.h +++ b/cgit.h @@ -116,6 +116,7 @@ struct cgit_query { char *sha2; char *path; char *name; + char *mimetype; int ofs; }; diff --git a/ui-blob.c b/ui-blob.c index dd1bbce..73a8c1d 100644 --- a/ui-blob.c +++ b/ui-blob.c @@ -65,7 +65,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head) } buf[size] = '\0'; - ctx.page.mimetype = NULL; + ctx.page.mimetype = ctx.qry.mimetype; ctx.page.filename = path; cgit_print_http_headers(&ctx); write(htmlfd, buf, size); -- 2.50.1 From 833b0d2732f808281496df16eb917d6fdb0a274f Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Wed, 25 Jun 2008 17:39:25 +0200 Subject: [PATCH 09/16] Use GIT-1.5.6 --- Makefile | 2 +- git | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cf32c0a..3719e96 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ CGIT_SCRIPT_PATH = /var/www/htdocs/cgit CGIT_CONFIG = /etc/cgitrc CACHE_ROOT = /var/cache/cgit SHA1_HEADER = -GIT_VER = 1.5.5.1 +GIT_VER = 1.5.6 GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 # diff --git a/git b/git index 66aaa2f..e449f10 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit 66aaa2fc22c8494d9019b241f5d6395a6044a895 +Subproject commit e449f105805ffa49ccf7cf080db897ecf65a1a0f -- 2.50.1 From de5e9281719809c5b07051faa88e95bd16e8d485 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Thu, 26 Jun 2008 13:53:30 +0200 Subject: [PATCH 10/16] Add support for including a footer on all pages The new cgitrc option `footer` can be used to include a html-file which replaces the standard 'generated by cgit' message at the bottom of each page. Suggested-by: Peter Danenberg Signed-off-by: Lars Hjemli --- cgit.c | 2 ++ cgit.h | 1 + ui-shared.c | 14 ++++++++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cgit.c b/cgit.c index 0deae12..8f154c9 100644 --- a/cgit.c +++ b/cgit.c @@ -25,6 +25,8 @@ void config_cb(const char *name, const char *value) ctx.cfg.root_readme = xstrdup(value); else if (!strcmp(name, "css")) ctx.cfg.css = xstrdup(value); + else if (!strcmp(name, "footer")) + ctx.cfg.footer = xstrdup(value); else if (!strcmp(name, "logo")) ctx.cfg.logo = xstrdup(value); else if (!strcmp(name, "index-header")) diff --git a/cgit.h b/cgit.h index 1972d75..d18d9ca 100644 --- a/cgit.h +++ b/cgit.h @@ -125,6 +125,7 @@ struct cgit_config { char *cache_root; char *clone_prefix; char *css; + char *footer; char *index_header; char *index_info; char *logo; diff --git a/ui-shared.c b/ui-shared.c index cd98387..8a00099 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -443,10 +443,16 @@ void cgit_print_docstart(struct cgit_context *ctx) void cgit_print_docend() { - html("\n\n\n"); + html(""); + if (ctx.cfg.footer) + html_include(ctx.cfg.footer); + else { + html("\n"); + } + html("\n\n"); } int print_branch_option(const char *refname, const unsigned char *sha1, -- 2.50.1 From 502865a5ec40fed5f1f865cb34002aecaab8405e Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 19 Jul 2008 20:40:30 +0200 Subject: [PATCH 11/16] Add a favicon option to cgitrc This option is used to specify a shortcut icon on all cgit pages. Signed-off-by: Lars Hjemli --- cgit.c | 2 ++ cgit.h | 1 + cgitrc | 2 ++ ui-shared.c | 5 +++++ 4 files changed, 10 insertions(+) diff --git a/cgit.c b/cgit.c index 8f154c9..8795085 100644 --- a/cgit.c +++ b/cgit.c @@ -25,6 +25,8 @@ void config_cb(const char *name, const char *value) ctx.cfg.root_readme = xstrdup(value); else if (!strcmp(name, "css")) ctx.cfg.css = xstrdup(value); + else if (!strcmp(name, "favicon")) + ctx.cfg.favicon = xstrdup(value); else if (!strcmp(name, "footer")) ctx.cfg.footer = xstrdup(value); else if (!strcmp(name, "logo")) diff --git a/cgit.h b/cgit.h index d18d9ca..7881aca 100644 --- a/cgit.h +++ b/cgit.h @@ -125,6 +125,7 @@ struct cgit_config { char *cache_root; char *clone_prefix; char *css; + char *favicon; char *footer; char *index_header; char *index_info; diff --git a/cgitrc b/cgitrc index f1d8997..9e8a0f2 100644 --- a/cgitrc +++ b/cgitrc @@ -107,6 +107,8 @@ ## Link to css file #css=/cgit/cgit.css +## Link to favicon +#favicon=/favicon.ico ## Link to logo file #logo=/cgit/git-logo.png diff --git a/ui-shared.c b/ui-shared.c index 8a00099..6f83d2a 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -437,6 +437,11 @@ void cgit_print_docstart(struct cgit_context *ctx) html("\n"); + if (ctx->cfg.favicon) { + html("\n"); + } html("\n"); html("\n"); } -- 2.50.1 From d2eb4fddb0fb7cd1751debcff6fe1219b9c619c8 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 21 Jul 2008 09:57:25 +0200 Subject: [PATCH 12/16] Use GIT-1.6.0-rc0 --- git | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git b/git index e449f10..93310a4 160000 --- a/git +++ b/git @@ -1 +1 @@ -Subproject commit e449f105805ffa49ccf7cf080db897ecf65a1a0f +Subproject commit 93310a40eb022a0e36e7c618921931d8ffc31fd1 -- 2.50.1 From 566f92b27618f67f59cc3642e17d9cb9c12634fa Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 21 Jul 2008 10:10:48 +0200 Subject: [PATCH 13/16] Adjust to new calling convention for read_tree_recursive() In GIT-1.6.0, read_tree_recursive takes an extra void pointer for callback data. We might want to use this to avoid some global variables, but for now lets just make sure that we can still compile. Signed-off-by: Lars Hjemli --- ui-blob.c | 5 +++-- ui-tree.c | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ui-blob.c b/ui-blob.c index 73a8c1d..3cda03d 100644 --- a/ui-blob.c +++ b/ui-blob.c @@ -13,7 +13,8 @@ static char *match_path; static unsigned char *matched_sha1; -static int walk_tree(const unsigned char *sha1, const char *base,int baselen, const char *pathname, unsigned mode, int stage) { +static int walk_tree(const unsigned char *sha1, const char *base,int baselen, + const char *pathname, unsigned mode, int stage, void *cbdata) { if(strncmp(base,match_path,baselen) || strcmp(match_path+baselen,pathname) ) return READ_TREE_RECURSIVE; @@ -49,7 +50,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head) commit = lookup_commit_reference(sha1); match_path = path; matched_sha1 = sha1; - read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree); + read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree, NULL); type = sha1_object_info(sha1,&size); } diff --git a/ui-tree.c b/ui-tree.c index 5a2dd3f..9a837e2 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -62,7 +62,8 @@ static void print_object(const unsigned char *sha1, char *path) static int ls_item(const unsigned char *sha1, const char *base, int baselen, - const char *pathname, unsigned int mode, int stage) + const char *pathname, unsigned int mode, int stage, + void *cbdata) { char *name; char *fullpath; @@ -143,13 +144,14 @@ static void ls_tree(const unsigned char *sha1, char *path) } ls_head(); - read_tree_recursive(tree, "", 0, 1, NULL, ls_item); + read_tree_recursive(tree, "", 0, 1, NULL, ls_item, NULL); ls_tail(); } static int walk_tree(const unsigned char *sha1, const char *base, int baselen, - const char *pathname, unsigned mode, int stage) + const char *pathname, unsigned mode, int stage, + void *cbdata) { static int state; static char buffer[PATH_MAX]; @@ -176,7 +178,7 @@ static int walk_tree(const unsigned char *sha1, const char *base, int baselen, return 0; } } - ls_item(sha1, base, baselen, pathname, mode, stage); + ls_item(sha1, base, baselen, pathname, mode, stage, NULL); return 0; } @@ -216,6 +218,6 @@ void cgit_print_tree(const char *rev, char *path) } match_path = path; - read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree); + read_tree_recursive(commit->tree, NULL, 0, 0, paths, walk_tree, NULL); ls_tail(); } -- 2.50.1 From f49ea2c9968a8b30c0c268ca52aa066960fd98f7 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Tue, 22 Jul 2008 19:01:31 +0200 Subject: [PATCH 14/16] tests/Makefile: not everyone has `.` in $PATH Signed-off-by: Lars Hjemli --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile b/tests/Makefile index 697e5a1..8c6c236 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -5,7 +5,7 @@ T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh) all: $(T) $(T): - @$@ + @./$@ clean: $(RM) -rf trash -- 2.50.1 From bb7485e8d7932ba04a94714bfe6a86a1e323435c Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Tue, 22 Jul 2008 19:30:06 +0200 Subject: [PATCH 15/16] Makefile: fix git dependency rules The objectfiles depends unconditionally on some specific git binaries while those git binaries depends on the phony `git` target and this patch seems to get these dependencies spelled out correctly. Signed-off-by: Lars Hjemli --- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3719e96..e807d1e 100644 --- a/Makefile +++ b/Makefile @@ -75,7 +75,7 @@ endif .PHONY: all git test install clean distclean emptycache force-version get-git -all: cgit git +all: cgit VERSION: force-version @./gen-version.sh "$(CGIT_VERSION)" @@ -93,15 +93,13 @@ CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' cgit: $(OBJECTS) $(QUIET_CC)$(CC) $(CFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) -$(OBJECTS): git/xdiff/lib.a git/libgit.a +$(OBJECTS): | git/xdiff/lib.a git/libgit.a cgit.o: VERSION -include $(OBJECTS:.o=.d) -git/xdiff/lib.a: | git - -git/libgit.a: | git +git/xdiff/lib.a, git/libgit.a: git git: $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) xdiff/lib.a -- 2.50.1 From a75968df103a938656599e0d2d9fd1ab4de5ea8a Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Tue, 22 Jul 2008 19:58:37 +0200 Subject: [PATCH 16/16] Makefile: do not touch the git objects with `make clean` I've been avoiding `make clean` for a long time due to its eagerness to kill all the git objectfiles. Signed-off-by: Lars Hjemli --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index e807d1e..a1f961b 100644 --- a/Makefile +++ b/Makefile @@ -121,7 +121,6 @@ uninstall: clean: rm -f cgit VERSION *.o *.d - cd git && $(MAKE) clean distclean: clean git clean -d -x -- 2.50.1