git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Remove diff machinery dependency from read-cache

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jan 22, 2010, 02:20 UTC
Message-ID
<alpine.LFD.2.00.1001211811140.13231@localhost.localdomain>
In-Reply-To
<7v636vj7c2.fsf@alter.siamese.dyndns.org>
On Thu, 21 Jan 2010, Junio C Hamano wrote:
Show 7 quoted lines
> 
> We tend to not remove things unless we are absolutely certain nobody uses
> it, so probably making it built-in would be preferrable.  I don't think
> show-index is used very often if ever, but scripts that use hash-object
> would use it really often and would do so via its --stdin interface if it
> knows that it is creating more than a dozen objects, so start-up time
> required to map the whole git is probably not an issue.

git-show-index should certainly be easy to turn into a built-in too. Patch appended.

> By the way, do you think anybody still uses "git merge-trees"?

I dunno. I think it has some conceptual advantages, but realistically, I doubt anybody is willing to go through the pain to make it grow up enough to become a viable alternative to our current situation.

		Linus
---
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Thu Jan 21 18:16:49 2010 -0800
Subject: Turn 'show-index' into a builtin

.. rather than being a huge executable just because it sucks in all the git library code and then does something really trivial.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 Makefile                             |    2 +-
 show-index.c => builtin-show-index.c |    2 +-
 builtin.h                            |    1 +
 git.c                                |    3 ++-
 4 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index ad890ec..3439d2c 100644
--- a/Makefile
+++ b/Makefile
@@ -396,7 +396,6 @@ PROGRAMS += git-mktag$X
 PROGRAMS += git-pack-redundant$X
 PROGRAMS += git-patch-id$X
 PROGRAMS += git-shell$X
-PROGRAMS += git-show-index$X
 PROGRAMS += git-unpack-file$X
 PROGRAMS += git-upload-pack$X
 PROGRAMS += git-var$X
@@ -693,6 +692,7 @@ BUILTIN_OBJS += builtin-rm.o
 BUILTIN_OBJS += builtin-send-pack.o
 BUILTIN_OBJS += builtin-shortlog.o
 BUILTIN_OBJS += builtin-show-branch.o
+BUILTIN_OBJS += builtin-show-index.o
 BUILTIN_OBJS += builtin-show-ref.o
 BUILTIN_OBJS += builtin-stripspace.o
 BUILTIN_OBJS += builtin-symbolic-ref.o
diff --git a/show-index.c b/builtin-show-index.c
similarity index 96%
rename from show-index.c
rename to builtin-show-index.c
index 63f9da5..92202b8 100644
--- a/show-index.c
+++ b/builtin-show-index.c
@@ -4,7 +4,7 @@
 static const char show_index_usage[] =
 "git show-index < <packed archive index>";
 
-int main(int argc, char **argv)
+int cmd_show_index(int argc, const char **argv, const  char *prefix)
 {
 	int i;
 	unsigned nr;
diff --git a/builtin.h b/builtin.h
index c3f83c0..4d73d7c 100644
--- a/builtin.h
+++ b/builtin.h
@@ -93,6 +93,7 @@ extern int cmd_send_pack(int argc, const char **argv, const char *prefix);
 extern int cmd_shortlog(int argc, const char **argv, const char *prefix);
 extern int cmd_show(int argc, const char **argv, const char *prefix);
 extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
+extern int cmd_show_index(int argc, const char **argv, const char *prefix);
 extern int cmd_status(int argc, const char **argv, const char *prefix);
 extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
 extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index 194471f..5fabf18 100644
--- a/git.c
+++ b/git.c
@@ -358,8 +358,9 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "rm", cmd_rm, RUN_SETUP },
 		{ "send-pack", cmd_send_pack, RUN_SETUP },
 		{ "shortlog", cmd_shortlog, USE_PAGER },
-		{ "show-branch", cmd_show_branch, RUN_SETUP },
 		{ "show", cmd_show, RUN_SETUP | USE_PAGER },
+		{ "show-branch", cmd_show_branch, RUN_SETUP },
+		{ "show-index", cmd_show_index },
 		{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
 		{ "stripspace", cmd_stripspace },
 		{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
Previous: Junio C HamanoNext: Linus Torvalds
Message 11 of 23 in “Remove diff machinery dependency from read-cache”
  1. Linus TorvaldsJan 21, 2010
  2. Junio C HamanoJan 21, 2010
  3. Linus TorvaldsJan 21, 2010
  4. Linus TorvaldsJan 21, 2010
  5. Linus TorvaldsJan 21, 2010
  6. Junio C HamanoJan 22, 2010
  7. Johannes SchindelinJan 22, 2010
  8. Junio C HamanoJan 22, 2010
  9. Johannes SchindelinJan 22, 2010
  10. Junio C HamanoJan 22, 2010
  11. Linus TorvaldsJan 22, 2010
  12. Linus TorvaldsJan 22, 2010
  13. Linus TorvaldsJan 22, 2010
  14. Johannes SixtJan 22, 2010
  15. merge-tree: remove unnecessary call of git_extract_argv0_pathJohannes Sixt, Jan 22, 2010
  16. Linus TorvaldsJan 22, 2010
  17. Nicolas PitreJan 22, 2010
  18. Linus TorvaldsJan 22, 2010
  19. Junio C HamanoJan 22, 2010
  20. Linus TorvaldsJan 22, 2010
  21. Linus TorvaldsJan 22, 2010
  22. Linus TorvaldsJan 22, 2010
  23. Brian CampbellJan 23, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.