Re: [PATCH] upload-pack: Initialize the exec-path.

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Johannes Sixt <j.sixt@...>
Cc: Jakub Narebski <jnareb@...>, Elijah Newren <newren@...>, <git@...>
Date: Tuesday, February 12, 2008 - 8:45 am

Hi,

On Tue, 12 Feb 2008, Johannes Schindelin wrote:


But I also made this:

-- snipsnap --
[PATCH] Make upload-pack a builtin

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 Makefile                               |    2 +-
 upload-pack.c => builtin-upload-pack.c |    8 +++++---
 builtin.h                              |    1 +
 git.c                                  |    1 +
 4 files changed, 8 insertions(+), 4 deletions(-)
 rename upload-pack.c => builtin-upload-pack.c (98%)

diff --git a/Makefile b/Makefile
index 83c359a..1792039 100644
--- a/Makefile
+++ b/Makefile
@@ -259,7 +259,6 @@ PROGRAMS = \
 	git-show-index$X \
 	git-unpack-file$X \
 	git-update-server-info$X \
-	git-upload-pack$X \
 	git-pack-redundant$X git-var$X \
 	git-merge-tree$X git-imap-send$X \
 	git-merge-recursive$X \
@@ -392,6 +391,7 @@ BUILTIN_OBJS = \
 	builtin-update-index.o \
 	builtin-update-ref.o \
 	builtin-upload-archive.o \
+	builtin-upload-pack.o \
 	builtin-verify-pack.o \
 	builtin-verify-tag.o \
 	builtin-write-tree.o \
diff --git a/upload-pack.c b/builtin-upload-pack.c
similarity index 98%
rename from upload-pack.c
rename to builtin-upload-pack.c
index 7e04311..207754c 100644
--- a/upload-pack.c
+++ b/builtin-upload-pack.c
@@ -10,6 +10,7 @@
 #include "revision.h"
 #include "list-objects.h"
 #include "run-command.h"
+#include "builtin.h"
 
 static const char upload_pack_usage[] = "git-upload-pack [--strict] [--timeout=nn] <dir>";
 
@@ -593,14 +594,14 @@ static void upload_pack(void)
 	}
 }
 
-int main(int argc, char **argv)
+int cmd_upload_pack(int argc, const char **argv, const char *prefix)
 {
 	char *dir;
 	int i;
 	int strict = 0;
 
 	for (i = 1; i < argc; i++) {
-		char *arg = argv[i];
+		const char *arg = argv[i];
 
 		if (arg[0] != '-')
 			break;
@@ -620,12 +621,13 @@ int main(int argc, char **argv)
 
 	if (i != argc-1)
 		usage(upload_pack_usage);
-	dir = argv[i];
+	dir = xstrdup(argv[i]);
 
 	if (!enter_repo(dir, strict))
 		die("'%s': unable to chdir or not a git archive", dir);
 	if (is_repository_shallow())
 		die("attempt to fetch/clone from a shallow repository");
 	upload_pack();
+	free(dir);
 	return 0;
 }
diff --git a/builtin.h b/builtin.h
index 3d1628c..5e7d661 100644
--- a/builtin.h
+++ b/builtin.h
@@ -85,6 +85,7 @@ extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
 extern int cmd_update_index(int argc, const char **argv, const char *prefix);
 extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
 extern int cmd_upload_archive(int argc, const char **argv, const char *prefix);
+extern int cmd_upload_pack(int argc, const char **argv, const char *prefix);
 extern int cmd_upload_tar(int argc, const char **argv, const char *prefix);
 extern int cmd_verify_tag(int argc, const char **argv, const char *prefix);
 extern int cmd_version(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index 0cb8688..f0d831c 100644
--- a/git.c
+++ b/git.c
@@ -362,6 +362,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "update-index", cmd_update_index, RUN_SETUP },
 		{ "update-ref", cmd_update_ref, RUN_SETUP },
 		{ "upload-archive", cmd_upload_archive },
+		{ "upload-pack", cmd_upload_pack },
 		{ "verify-tag", cmd_verify_tag, RUN_SETUP },
 		{ "version", cmd_version },
 		{ "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER },
-- 
1.5.4.1.1276.g92036

-
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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Unable to clone an ssh repository (with ugly installatio..., Johannes Schindelin, (Tue Feb 12, 6:30 am)
Re: Unable to clone an ssh repository (with ugly installatio..., Stephen Sinclair, (Wed Feb 13, 10:17 am)
[PATCH] upload-pack: Initialize the exec-path., Johannes Sixt, (Tue Feb 12, 7:28 am)
Re: [PATCH] upload-pack: Initialize the exec-path., Johannes Schindelin, (Tue Feb 12, 7:49 am)
Re: [PATCH] upload-pack: Initialize the exec-path., Johannes Schindelin, (Tue Feb 12, 8:45 am)
Re: [PATCH] upload-pack: Initialize the exec-path., Elijah Newren, (Wed Feb 13, 9:00 am)