* Make "git rev-list" be a builtin
@ 2006-05-18 21:19 Linus Torvalds
2006-05-18 21:50 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Linus Torvalds @ 2006-05-18 21:19 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
This was surprisingly easy. The diff is truly minimal: rename "main()" to
"cmd_rev_list()" in rev-list.c, and rename the whole file to reflect its
new built-in status.
We should have done this long ago.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
[ NOTE! The diff is a git-only "git diff -M" with rename information,
because quite frankly, it's just a hell of a lot more readable that way.
But I thought I'd mention it explicitly, since it won't apply for
anybody who tries to apply it as a regular unified diff with "patch" ]
Makefile | 6 +++---
rev-list.c => builtin-rev-list.c | 3 ++-
builtin.h | 1 +
git.c | 1 +
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 3a28580..281fa69 100644
--- a/Makefile
+++ b/Makefile
@@ -158,7 +158,7 @@ PROGRAMS = \
git-ls-files$X git-ls-tree$X git-mailinfo$X git-merge-base$X \
git-merge-index$X git-mktag$X git-mktree$X git-pack-objects$X git-patch-id$X \
git-peek-remote$X git-prune-packed$X git-read-tree$X \
- git-receive-pack$X git-rev-list$X git-rev-parse$X \
+ git-receive-pack$X git-rev-parse$X \
git-send-pack$X git-show-branch$X git-shell$X \
git-show-index$X git-ssh-fetch$X \
git-ssh-upload$X git-tar-tree$X git-unpack-file$X \
@@ -170,7 +170,7 @@ PROGRAMS = \
BUILT_INS = git-log$X git-whatchanged$X git-show$X \
git-count-objects$X git-diff$X git-push$X \
- git-grep$X git-add$X
+ git-grep$X git-add$X git-rev-list$X
# what 'all' will build and 'install' will install, in gitexecdir
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -218,7 +218,7 @@ LIB_OBJS = \
BUILTIN_OBJS = \
builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \
- builtin-grep.o builtin-add.o
+ builtin-grep.o builtin-add.o builtin-rev-list.o
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
LIBS = $(GITLIBS) -lz
diff --git a/rev-list.c b/builtin-rev-list.c
similarity index 99%
rename from rev-list.c
rename to builtin-rev-list.c
index 235ae4c..171f9d5 100644
--- a/rev-list.c
+++ b/builtin-rev-list.c
@@ -7,6 +7,7 @@ #include "blob.h"
#include "tree-walk.h"
#include "diff.h"
#include "revision.h"
+#include "builtin.h"
/* bits #0-15 in revision.h */
@@ -291,7 +292,7 @@ static void mark_edges_uninteresting(str
}
}
-int main(int argc, const char **argv)
+int cmd_rev_list(int argc, const char **argv, char **envp)
{
struct commit_list *list;
int i;
diff --git a/builtin.h b/builtin.h
index ccd0e31..a94d728 100644
--- a/builtin.h
+++ b/builtin.h
@@ -26,5 +26,6 @@ extern int cmd_count_objects(int argc, c
extern int cmd_push(int argc, const char **argv, char **envp);
extern int cmd_grep(int argc, const char **argv, char **envp);
extern int cmd_add(int argc, const char **argv, char **envp);
+extern int cmd_rev_list(int argc, const char **argv, char **envp);
#endif
diff --git a/git.c b/git.c
index 6a470cf..e2bba53 100644
--- a/git.c
+++ b/git.c
@@ -52,6 +52,7 @@ static void handle_internal_command(int
{ "diff", cmd_diff },
{ "grep", cmd_grep },
{ "add", cmd_add },
+ { "rev-list", cmd_rev_list },
};
int i;
rename rev-list.c => builtin-rev-list.c (99%)
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: Make "git rev-list" be a builtin
2006-05-18 21:19 Make "git rev-list" be a builtin Linus Torvalds
@ 2006-05-18 21:50 ` Junio C Hamano
2006-05-18 22:00 ` Linus Torvalds
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2006-05-18 21:50 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
Linus Torvalds <torvalds@osdl.org> writes:
> This was surprisingly easy. The diff is truly minimal: rename "main()" to
> "cmd_rev_list()" in rev-list.c, and rename the whole file to reflect its
> new built-in status.
>
> We should have done this long ago.
Should we have?
Certainly it is almost trivial, and it means we need to worry
about one less file, but is that the point?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Make "git rev-list" be a builtin
2006-05-18 21:50 ` Junio C Hamano
@ 2006-05-18 22:00 ` Linus Torvalds
0 siblings, 0 replies; 3+ messages in thread
From: Linus Torvalds @ 2006-05-18 22:00 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Thu, 18 May 2006, Junio C Hamano wrote:
> Linus Torvalds <torvalds@osdl.org> writes:
> >
> > We should have done this long ago.
>
> Should we have?
>
> Certainly it is almost trivial, and it means we need to worry
> about one less file, but is that the point?
Take a look at the size of the binaries before and after.
This is the _stripped_ binaries (on ppc) before:
-rwxr-xr-x 9 torvalds torvalds 213392 May 18 14:56 git
-rwxr-xr-x 1 torvalds torvalds 167540 May 18 14:56 git-rev-list
and after:
-rwxr-xr-x 10 torvalds torvalds 216740 May 18 14:56 git
-rwxr-xr-x 10 torvalds torvalds 216740 May 18 14:56 git-rev-list
ie the "git" binary grew by about 3kB, and the "git-rev-list" binary
shrank by about 164kB (because it now takes zero disk-space: it's the same
as the git binary).
So on ppc, you win about 160kB of disk space from this (and much more if
you don't strip the binaries - "git-rev-list" is over half a megabyte
with the debugging info for me).
Now, x86 probably has less of that, because it's a denser instruction set,
but I'd expect that to be in the 100kB range too.
Linus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-05-18 22:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-18 21:19 Make "git rev-list" be a builtin Linus Torvalds
2006-05-18 21:50 ` Junio C Hamano
2006-05-18 22:00 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox