git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Nicolas Pitre <nico@fluxnic.net>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Remove diff machinery dependency from read-cache
Date: Thu, 21 Jan 2010 20:21:55 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1001212014481.13231@localhost.localdomain> (raw)
In-Reply-To: <7vvdeubxnh.fsf@alter.siamese.dyndns.org>



On Thu, 21 Jan 2010, Junio C Hamano wrote:

> Nicolas Pitre <nico@fluxnic.net> writes:
> 
> > I do use it, but for developing/debugging pack stuff.  I don't suggest
> > removing it, but I don't think making it a built-in has value either.
> 
> I thought people _might_ have used it for satistics purposes, but it
> appears that the command doesn't even give in-pack size of objects nor
> delta chain length, so probably anybody doing pack statistics would be
> using "verify-pack -v" and wouldn't mind if it became test-show-index.
> 
> > So I really think that Linus' patch (which is missing hex.c btw) is a 
> > good thing to do, even if only for the cleanup value.
> >
> > Then, git-show-index could probably become test-show-index and no longer 
> > leave the build directory.
> 
> Yeah, I think that is a sensible long term plan, too.

Note that there are other totally trivial git programs like 'git-var' that 
have exactly the same issue as 'git-show-index'.

Same details: it doesn't really want any diff machinery, doesn't want any 
git object handling, but can't avoid it because it uses xmalloc (through 
environment.c and config.c etc), so a program that _should_ be pretty 
trivially small again ends up being 200+kB in size even without debug 
info (and almost a megabyte with it).

So here's another trivial builtin-ification patch.

		Linus

---
 Makefile               |    2 +-
 var.c => builtin-var.c |    4 +---
 builtin.h              |    1 +
 git.c                  |    1 +
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index f9e4aa3..398b5fb 100644
--- a/Makefile
+++ b/Makefile
@@ -396,7 +396,6 @@ PROGRAMS += git-patch-id$X
 PROGRAMS += git-shell$X
 PROGRAMS += git-unpack-file$X
 PROGRAMS += git-upload-pack$X
-PROGRAMS += git-var$X
 PROGRAMS += git-http-backend$X
 
 # List built-in command $C whose implementation cmd_$C() is not in
@@ -703,6 +702,7 @@ BUILTIN_OBJS += builtin-update-index.o
 BUILTIN_OBJS += builtin-update-ref.o
 BUILTIN_OBJS += builtin-update-server-info.o
 BUILTIN_OBJS += builtin-upload-archive.o
+BUILTIN_OBJS += builtin-var.o
 BUILTIN_OBJS += builtin-verify-pack.o
 BUILTIN_OBJS += builtin-verify-tag.o
 BUILTIN_OBJS += builtin-write-tree.o
diff --git a/var.c b/builtin-var.c
similarity index 96%
rename from var.c
rename to builtin-var.c
index d9892f8..2280518 100644
--- a/var.c
+++ b/builtin-var.c
@@ -72,7 +72,7 @@ static int show_config(const char *var, const char *value, void *cb)
 	return git_default_config(var, value, cb);
 }
 
-int main(int argc, char **argv)
+int cmd_var(int argc, const char **argv, const char *prefix)
 {
 	const char *val;
 	int nongit;
@@ -80,8 +80,6 @@ int main(int argc, char **argv)
 		usage(var_usage);
 	}
 
-	git_extract_argv0_path(argv[0]);
-
 	setup_git_directory_gently(&nongit);
 	val = NULL;
 
diff --git a/builtin.h b/builtin.h
index 3aa6b6c..0c9c396 100644
--- a/builtin.h
+++ b/builtin.h
@@ -107,6 +107,7 @@ extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
 extern int cmd_update_server_info(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_tar(int argc, const char **argv, const char *prefix);
+extern int cmd_var(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);
 extern int cmd_whatchanged(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index a952663..09d3272 100644
--- a/git.c
+++ b/git.c
@@ -373,6 +373,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "update-ref", cmd_update_ref, RUN_SETUP },
 		{ "update-server-info", cmd_update_server_info, RUN_SETUP },
 		{ "upload-archive", cmd_upload_archive },
+		{ "var", cmd_var },
 		{ "verify-tag", cmd_verify_tag, RUN_SETUP },
 		{ "version", cmd_version },
 		{ "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER },

  reply	other threads:[~2010-01-22  4:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 19:37 Remove diff machinery dependency from read-cache Linus Torvalds
2010-01-21 20:07 ` Junio C Hamano
2010-01-21 20:15   ` Linus Torvalds
2010-01-21 22:18     ` Linus Torvalds
2010-01-21 23:25       ` Linus Torvalds
2010-01-22  0:45         ` Junio C Hamano
2010-01-22  0:59           ` Johannes Schindelin
2010-01-22  1:01             ` Junio C Hamano
2010-01-22  1:43               ` Johannes Schindelin
2010-01-22  3:50                 ` Junio C Hamano
2010-01-22  2:20           ` Linus Torvalds
2010-01-22  2:25             ` Linus Torvalds
2010-01-22  3:50               ` Linus Torvalds
2010-01-22  8:43               ` Johannes Sixt
2010-01-22 11:47                 ` [PATCH] merge-tree: remove unnecessary call of git_extract_argv0_path Johannes Sixt
2010-01-22 16:40                   ` Linus Torvalds
2010-01-22  2:35           ` Remove diff machinery dependency from read-cache Nicolas Pitre
2010-01-22  2:44             ` Linus Torvalds
2010-01-22  3:56             ` Junio C Hamano
2010-01-22  4:21               ` Linus Torvalds [this message]
2010-01-22  4:31             ` Linus Torvalds
2010-01-22  3:58 ` Linus Torvalds
2010-01-23  6:31 ` Brian Campbell

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=alpine.LFD.2.00.1001212014481.13231@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=nico@fluxnic.net \
    --cc=spearce@spearce.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).