From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 2/4] receive-pack: make it a builtin
Date: Tue, 9 Sep 2008 01:27:08 -0700 [thread overview]
Message-ID: <1220948830-3275-3-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1220948830-3275-2-git-send-email-gitster@pobox.com>
It is a good thing to do in general, but more importantly, transport
routines can only be used by built-ins, which is what I'll be adding next.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Makefile | 2 +-
receive-pack.c => builtin-receive-pack.c | 6 +++---
builtin.h | 1 +
git.c | 1 +
4 files changed, 6 insertions(+), 4 deletions(-)
rename receive-pack.c => builtin-receive-pack.c (99%)
diff --git a/Makefile b/Makefile
index f4c31c8..f9c54ff 100644
--- a/Makefile
+++ b/Makefile
@@ -294,7 +294,6 @@ PROGRAMS += git-mktag$X
PROGRAMS += git-mktree$X
PROGRAMS += git-pack-redundant$X
PROGRAMS += git-patch-id$X
-PROGRAMS += git-receive-pack$X
PROGRAMS += git-send-pack$X
PROGRAMS += git-shell$X
PROGRAMS += git-show-index$X
@@ -546,6 +545,7 @@ BUILTIN_OBJS += builtin-prune-packed.o
BUILTIN_OBJS += builtin-prune.o
BUILTIN_OBJS += builtin-push.o
BUILTIN_OBJS += builtin-read-tree.o
+BUILTIN_OBJS += builtin-receive-pack.o
BUILTIN_OBJS += builtin-reflog.o
BUILTIN_OBJS += builtin-remote.o
BUILTIN_OBJS += builtin-rerere.o
diff --git a/receive-pack.c b/builtin-receive-pack.c
similarity index 99%
rename from receive-pack.c
rename to builtin-receive-pack.c
index b81678a..6d6027e 100644
--- a/receive-pack.c
+++ b/builtin-receive-pack.c
@@ -462,14 +462,14 @@ static int delete_only(struct command *cmd)
return 1;
}
-int main(int argc, char **argv)
+int cmd_receive_pack(int argc, const char **argv, const char *prefix)
{
int i;
char *dir = NULL;
argv++;
for (i = 1; i < argc; i++) {
- char *arg = *argv++;
+ const char *arg = *argv++;
if (*arg == '-') {
/* Do flag handling here */
@@ -477,7 +477,7 @@ int main(int argc, char **argv)
}
if (dir)
usage(receive_pack_usage);
- dir = arg;
+ dir = xstrdup(arg);
}
if (!dir)
usage(receive_pack_usage);
diff --git a/builtin.h b/builtin.h
index e67cb20..5d7cdca 100644
--- a/builtin.h
+++ b/builtin.h
@@ -78,6 +78,7 @@ extern int cmd_prune(int argc, const char **argv, const char *prefix);
extern int cmd_prune_packed(int argc, const char **argv, const char *prefix);
extern int cmd_push(int argc, const char **argv, const char *prefix);
extern int cmd_read_tree(int argc, const char **argv, const char *prefix);
+extern int cmd_receive_pack(int argc, const char **argv, const char *prefix);
extern int cmd_reflog(int argc, const char **argv, const char *prefix);
extern int cmd_remote(int argc, const char **argv, const char *prefix);
extern int cmd_config(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index adf7352..2f5b4d7 100644
--- a/git.c
+++ b/git.c
@@ -328,6 +328,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "prune-packed", cmd_prune_packed, RUN_SETUP },
{ "push", cmd_push, RUN_SETUP },
{ "read-tree", cmd_read_tree, RUN_SETUP },
+ { "receive-pack", cmd_receive_pack },
{ "reflog", cmd_reflog, RUN_SETUP },
{ "remote", cmd_remote, RUN_SETUP },
{ "repo-config", cmd_config },
--
1.6.0.1.415.g7bb82
next prev parent reply other threads:[~2008-09-09 8:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-09 8:27 [PATCH 0/4] Pushing into a repository with alternates Junio C Hamano
2008-09-09 8:27 ` [PATCH 1/4] is_directory(): a generic helper function Junio C Hamano
2008-09-09 8:27 ` Junio C Hamano [this message]
2008-09-09 8:27 ` [PATCH 3/4] push: prepare sender to receive extended ref information from the receiver Junio C Hamano
2008-09-09 8:27 ` [PATCH 4/4] push: receiver end advertises refs from alternate repositories Junio C Hamano
2008-09-09 13:03 ` [PATCH 3/4] push: prepare sender to receive extended ref information from the receiver Jeff King
2008-09-09 9:26 ` [PATCH 2/4] receive-pack: make it a builtin Paolo Bonzini
2008-09-09 14:24 ` Junio C Hamano
2008-09-09 14:47 ` Paolo Bonzini
2008-09-09 10:31 ` [PATCH 1/4] is_directory(): a generic helper function Johannes Sixt
2008-09-09 12:32 ` Jeff King
2008-09-09 14:51 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1220948830-3275-3-git-send-email-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).