{"thread":{"id":"4197","subject":"Make \"git rev-list\" be a builtin","startedAt":"2006-05-18T21:19:20Z","lastAt":"2006-05-18T22:00:16Z","messageCount":3,"participants":["Linus Torvalds","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"20244","messageId":"Pine.LNX.4.64.0605181415090.10823@g5.osdl.org","threadId":"4197","inReplyTo":null,"subject":"Make \"git rev-list\" be a builtin","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-05-18T21:19:20Z","receivedAt":"2006-05-18T21:19:20Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nThis was surprisingly easy. The diff is truly minimal: rename \"main()\" to \n\"cmd_rev_list()\" in rev-list.c, and rename the whole file to reflect its \nnew built-in status.\n\nWe should have done this long ago.\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\n\n[ NOTE! The diff is a git-only \"git diff -M\" with rename information, \n  because quite frankly, it's just a hell of a lot more readable that way. \n  But I thought I'd mention it explicitly, since it won't apply for \n  anybody who tries to apply it as a regular unified diff with \"patch\" ]\n\n Makefile                         |    6 +++---\n rev-list.c => builtin-rev-list.c |    3 ++-\n builtin.h                        |    1 +\n git.c                            |    1 +\n 4 files changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 3a28580..281fa69 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -158,7 +158,7 @@ PROGRAMS = \\\n \tgit-ls-files$X git-ls-tree$X git-mailinfo$X git-merge-base$X \\\n \tgit-merge-index$X git-mktag$X git-mktree$X git-pack-objects$X git-patch-id$X \\\n \tgit-peek-remote$X git-prune-packed$X git-read-tree$X \\\n-\tgit-receive-pack$X git-rev-list$X git-rev-parse$X \\\n+\tgit-receive-pack$X git-rev-parse$X \\\n \tgit-send-pack$X git-show-branch$X git-shell$X \\\n \tgit-show-index$X git-ssh-fetch$X \\\n \tgit-ssh-upload$X git-tar-tree$X git-unpack-file$X \\\n@@ -170,7 +170,7 @@ PROGRAMS = \\\n \n BUILT_INS = git-log$X git-whatchanged$X git-show$X \\\n \tgit-count-objects$X git-diff$X git-push$X \\\n-\tgit-grep$X git-add$X\n+\tgit-grep$X git-add$X git-rev-list$X\n \n # what 'all' will build and 'install' will install, in gitexecdir\n ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)\n@@ -218,7 +218,7 @@ LIB_OBJS = \\\n \n BUILTIN_OBJS = \\\n \tbuiltin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \\\n-\tbuiltin-grep.o builtin-add.o\n+\tbuiltin-grep.o builtin-add.o builtin-rev-list.o\n \n GITLIBS = $(LIB_FILE) $(XDIFF_LIB)\n LIBS = $(GITLIBS) -lz\ndiff --git a/rev-list.c b/builtin-rev-list.c\nsimilarity index 99%\nrename from rev-list.c\nrename to builtin-rev-list.c\nindex 235ae4c..171f9d5 100644\n--- a/rev-list.c\n+++ b/builtin-rev-list.c\n@@ -7,6 +7,7 @@ #include \"blob.h\"\n #include \"tree-walk.h\"\n #include \"diff.h\"\n #include \"revision.h\"\n+#include \"builtin.h\"\n \n /* bits #0-15 in revision.h */\n \n@@ -291,7 +292,7 @@ static void mark_edges_uninteresting(str\n \t}\n }\n \n-int main(int argc, const char **argv)\n+int cmd_rev_list(int argc, const char **argv, char **envp)\n {\n \tstruct commit_list *list;\n \tint i;\ndiff --git a/builtin.h b/builtin.h\nindex ccd0e31..a94d728 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -26,5 +26,6 @@ extern int cmd_count_objects(int argc, c\n extern int cmd_push(int argc, const char **argv, char **envp);\n extern int cmd_grep(int argc, const char **argv, char **envp);\n extern int cmd_add(int argc, const char **argv, char **envp);\n+extern int cmd_rev_list(int argc, const char **argv, char **envp);\n \n #endif\ndiff --git a/git.c b/git.c\nindex 6a470cf..e2bba53 100644\n--- a/git.c\n+++ b/git.c\n@@ -52,6 +52,7 @@ static void handle_internal_command(int \n \t\t{ \"diff\", cmd_diff },\n \t\t{ \"grep\", cmd_grep },\n \t\t{ \"add\", cmd_add },\n+\t\t{ \"rev-list\", cmd_rev_list },\n \t};\n \tint i;\n \n rename rev-list.c => builtin-rev-list.c (99%)\n"},{"id":"20248","messageId":"7vejyrngto.fsf@assigned-by-dhcp.cox.net","threadId":"4197","inReplyTo":"Pine.LNX.4.64.0605181415090.10823@g5.osdl.org","subject":"Re: Make \"git rev-list\" be a builtin","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-05-18T21:50:11Z","receivedAt":"2006-05-18T21:50:11Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> This was surprisingly easy. The diff is truly minimal: rename \"main()\" to \n> \"cmd_rev_list()\" in rev-list.c, and rename the whole file to reflect its \n> new built-in status.\n>\n> We should have done this long ago.\n\nShould we have?\n\nCertainly it is almost trivial, and it means we need to worry\nabout one less file, but is that the point?\n"},{"id":"20250","messageId":"Pine.LNX.4.64.0605181454540.10823@g5.osdl.org","threadId":"4197","inReplyTo":"7vejyrngto.fsf@assigned-by-dhcp.cox.net","subject":"Re: Make \"git rev-list\" be a builtin","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-05-18T22:00:16Z","receivedAt":"2006-05-18T22:00:16Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 18 May 2006, Junio C Hamano wrote:\n> Linus Torvalds <torvalds@osdl.org> writes:\n> >\n> > We should have done this long ago.\n> \n> Should we have?\n> \n> Certainly it is almost trivial, and it means we need to worry\n> about one less file, but is that the point?\n\nTake a look at the size of the binaries before and after.\n\nThis is the _stripped_ binaries (on ppc) before:\n\n  -rwxr-xr-x 9 torvalds torvalds 213392 May 18 14:56 git\n  -rwxr-xr-x 1 torvalds torvalds 167540 May 18 14:56 git-rev-list\n\nand after:\n\n  -rwxr-xr-x 10 torvalds torvalds 216740 May 18 14:56 git\n  -rwxr-xr-x 10 torvalds torvalds 216740 May 18 14:56 git-rev-list\n\nie the \"git\" binary grew by about 3kB, and the \"git-rev-list\" binary \nshrank by about 164kB (because it now takes zero disk-space: it's the same \nas the git binary).\n\nSo on ppc, you win about 160kB of disk space from this (and much more if \nyou don't strip the binaries - \"git-rev-list\" is over half a megabyte \nwith the debugging info for me).\n\nNow, x86 probably has less of that, because it's a denser instruction set, \nbut I'd expect that to be in the 100kB range too.\n\n\t\t\tLinus\n"}]}