Browse Source

Builtin git-show-branch.

Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
Peter Eriksen 19 years ago committed by Junio C Hamano
parent
commit
51ce34b992
  1. 6
      Makefile
  2. 7
      builtin-show-branch.c
  3. 1
      builtin.h
  4. 3
      git.c

6
Makefile

@ -159,7 +159,7 @@ PROGRAMS = \
git-merge-index$X git-mktag$X git-mktree$X git-pack-objects$X git-patch-id$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-peek-remote$X git-prune-packed$X \
git-receive-pack$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-send-pack$X git-shell$X \
git-show-index$X git-ssh-fetch$X \ git-show-index$X git-ssh-fetch$X \
git-ssh-upload$X git-unpack-file$X \ git-ssh-upload$X git-unpack-file$X \
git-unpack-objects$X git-update-index$X git-update-server-info$X \ 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 \
git-grep$X git-rev-list$X git-check-ref-format$X \ git-grep$X git-rev-list$X git-check-ref-format$X \
git-init-db$X git-ls-files$X git-ls-tree$X \ git-init-db$X git-ls-files$X git-ls-tree$X \
git-tar-tree$X git-read-tree$X git-commit-tree$X \ git-tar-tree$X git-read-tree$X git-commit-tree$X \
git-apply$X git-apply$X git-show-branch$X


# what 'all' will build and 'install' will install, in gitexecdir # what 'all' will build and 'install' will install, in gitexecdir
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS) ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
@ -224,7 +224,7 @@ BUILTIN_OBJS = \
builtin-grep.o builtin-rev-list.o builtin-check-ref-format.o \ builtin-grep.o builtin-rev-list.o builtin-check-ref-format.o \
builtin-init-db.o builtin-ls-files.o builtin-ls-tree.o \ builtin-init-db.o builtin-ls-files.o builtin-ls-tree.o \
builtin-tar-tree.o builtin-read-tree.o builtin-commit-tree.o \ builtin-tar-tree.o builtin-read-tree.o builtin-commit-tree.o \
builtin-apply.o builtin-apply.o builtin-show-branch.o


GITLIBS = $(LIB_FILE) $(XDIFF_LIB) GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
LIBS = $(GITLIBS) -lz LIBS = $(GITLIBS) -lz

7
show-branch.c → builtin-show-branch.c

@ -3,13 +3,14 @@
#include "cache.h" #include "cache.h"
#include "commit.h" #include "commit.h"
#include "refs.h" #include "refs.h"
#include "builtin.h"


static const char show_branch_usage[] = static const char show_branch_usage[] =
"git-show-branch [--dense] [--current] [--all] [--heads] [--tags] [--topo-order] [--more=count | --list | --independent | --merge-base ] [--topics] [<refs>...]"; "git-show-branch [--dense] [--current] [--all] [--heads] [--tags] [--topo-order] [--more=count | --list | --independent | --merge-base ] [--topics] [<refs>...]";


static int default_num = 0; static int default_num = 0;
static int default_alloc = 0; static int default_alloc = 0;
static char **default_arg = NULL; static const char **default_arg = NULL;


#define UNINTERESTING 01 #define UNINTERESTING 01


@ -548,7 +549,7 @@ static int omit_in_dense(struct commit *commit, struct commit **rev, int n)
return 0; return 0;
} }


int main(int ac, char **av) int cmd_show_branch(int ac, const char **av, char **envp)
{ {
struct commit *rev[MAX_REVS], *commit; struct commit *rev[MAX_REVS], *commit;
struct commit_list *list = NULL, *seen = NULL; struct commit_list *list = NULL, *seen = NULL;
@ -581,7 +582,7 @@ int main(int ac, char **av)
} }


while (1 < ac && av[1][0] == '-') { while (1 < ac && av[1][0] == '-') {
char *arg = av[1]; const char *arg = av[1];
if (!strcmp(arg, "--")) { if (!strcmp(arg, "--")) {
ac--; av++; ac--; av++;
break; break;

1
builtin.h

@ -33,5 +33,6 @@ extern int cmd_tar_tree(int argc, const char **argv, char **envp);
extern int cmd_read_tree(int argc, const char **argv, char **envp); extern int cmd_read_tree(int argc, const char **argv, char **envp);
extern int cmd_commit_tree(int argc, const char **argv, char **envp); extern int cmd_commit_tree(int argc, const char **argv, char **envp);
extern int cmd_apply(int argc, const char **argv, char **envp); extern int cmd_apply(int argc, const char **argv, char **envp);
extern int cmd_show_branch(int argc, const char **argv, char **envp);


#endif #endif

3
git.c

@ -58,7 +58,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
{ "tar-tree", cmd_tar_tree }, { "tar-tree", cmd_tar_tree },
{ "read-tree", cmd_read_tree }, { "read-tree", cmd_read_tree },
{ "commit-tree", cmd_commit_tree }, { "commit-tree", cmd_commit_tree },
{ "apply", cmd_apply } { "apply", cmd_apply },
{ "show-branch", cmd_show_branch }
}; };
int i; int i;



Loading…
Cancel
Save