[prev in list] [next in list] [prev in thread] [next in thread]
List: git
Subject: [PATCH] upload-pack: add a trigger for post-upload-pack hook
From: Tom Preston-Werner <tom () mojombo ! com>
Date: 2009-08-18 7:04:53
Message-ID: 1250579093-40706-1-git-send-email-tom () mojombo ! com
[Download RAW message or body]
A post-upload-pack hook is desirable for Git hosts that need to
collect statistics on how many clones and/or fetches are made
on each repository.
The hook is called with either "clone" or "fetch" as the only
argument, depending on whether a full pack file was sent to the
client or not.
Signed-off-by: Tom Preston-Werner <tom@mojombo.com>
---
upload-pack.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/upload-pack.c b/upload-pack.c
index f7d308a..96231dc 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -141,6 +141,13 @@ static int do_rev_list(int fd, void *create_full_pack)
return 0;
}
+static void run_post_upload_pack_hook(int create_full_pack)
+{
+ const char *fetch_type;
+ fetch_type = (create_full_pack) ? "clone" : "fetch";
+ run_hook(get_index_file(), "post-upload-pack", fetch_type);
+}
+
static void create_pack_file(void)
{
struct async rev_list;
@@ -314,6 +321,8 @@ static void create_pack_file(void)
}
if (use_sideband)
packet_flush(1);
+
+ run_post_upload_pack_hook(create_full_pack);
return;
fail:
--
1.6.3.1
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic