Builtin git-show-branch.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
Peter Eriksen committed
May 23, 2006 at 14:15 UTC
51ce34b9923d9b119ac53414584f80e05520abea
4 files changed
+10
-7
Makefile
+3
-3
@@ -159,7 +159,7 @@ PROGRAMS = \
159
git-merge-index$X git-mktag$X git-mktree$X git-pack-objects$X git-patch-id$X \
160
git-peek-remote$X git-prune-packed$X \
161
git-receive-pack$X git-rev-parse$X \
162
- git-send-pack$X git-show-branch$X git-shell$X \
162
+ git-send-pack$X git-shell$X \
163
git-show-index$X git-ssh-fetch$X \
164
git-ssh-upload$X git-unpack-file$X \
165
git-unpack-objects$X git-update-index$X git-update-server-info$X \
@@ -173,7 +173,7 @@ BUILT_INS = git-log$X git-whatchanged$X git-show$X \
173
git-grep$X git-rev-list$X git-check-ref-format$X \
174
git-init-db$X git-ls-files$X git-ls-tree$X \
175
git-tar-tree$X git-read-tree$X git-commit-tree$X \
176
- git-apply$X
176
+ git-apply$X git-show-branch$X
177
178
# what 'all' will build and 'install' will install, in gitexecdir
179
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@@ -224,7 +224,7 @@ BUILTIN_OBJS = \
224
builtin-grep.o builtin-rev-list.o builtin-check-ref-format.o \
225
builtin-init-db.o builtin-ls-files.o builtin-ls-tree.o \
226
builtin-tar-tree.o builtin-read-tree.o builtin-commit-tree.o \
227
- builtin-apply.o
227
+ builtin-apply.o builtin-show-branch.o
228
229
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
230
LIBS = $(GITLIBS) -lz
builtin-show-branch.c
renamed
+4
-3
@@ -3,13 +3,14 @@
3
#include "cache.h"
4
#include "commit.h"
5
#include "refs.h"
6
+#include "builtin.h"
7
8
static const char show_branch_usage[] =
9
"git-show-branch [--dense] [--current] [--all] [--heads] [--tags] [--topo-order] [--more=count | --list | --independent | --merge-base ] [--topics] [<refs>...]";
10
11
static int default_num = 0;
12
static int default_alloc = 0;
12
-static char **default_arg = NULL;
13
+static const char **default_arg = NULL;
14
15
#define UNINTERESTING 01
16
@@ -548,7 +549,7 @@ static int omit_in_dense(struct commit *commit, struct commit **rev, int n)
549
return 0;
550
}
551
551
-int main(int ac, char **av)
552
+int cmd_show_branch(int ac, const char **av, char **envp)
553
{
554
struct commit *rev[MAX_REVS], *commit;
555
struct commit_list *list = NULL, *seen = NULL;
@@ -581,7 +582,7 @@ int main(int ac, char **av)
582
}
583
584
while (1 < ac && av[1][0] == '-') {
584
- char *arg = av[1];
585
+ const char *arg = av[1];
586
if (!strcmp(arg, "--")) {
587
ac--; av++;
588
break;
builtin.h
+1
@@ -33,5 +33,6 @@ extern int cmd_tar_tree(int argc, const char **argv, char **envp);
33
extern int cmd_read_tree(int argc, const char **argv, char **envp);
34
extern int cmd_commit_tree(int argc, const char **argv, char **envp);
35
extern int cmd_apply(int argc, const char **argv, char **envp);
36
+extern int cmd_show_branch(int argc, const char **argv, char **envp);
37
38
#endif
git.c
+2
-1
@@ -58,7 +58,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
58
{ "tar-tree", cmd_tar_tree },
59
{ "read-tree", cmd_read_tree },
60
{ "commit-tree", cmd_commit_tree },
61
- { "apply", cmd_apply }
61
+ { "apply", cmd_apply },
62
+ { "show-branch", cmd_show_branch }
63
};
64
int i;
65