mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
Merge branch 'jc/builtin-n-tar-tree' into next
* jc/builtin-n-tar-tree: Builtin git-diff-files, git-diff-index, git-diff-stages, and git-diff-tree. Builtin git-show-branch. Builtin git-apply. Builtin git-commit-tree. Builtin git-read-tree. Builtin git-tar-tree. Builtin git-ls-tree. Builtin git-ls-files.
This commit is contained in:
commit
e96b6c4bf6
27
Makefile
27
Makefile
|
@ -149,17 +149,15 @@ SIMPLE_PROGRAMS = \
|
|||
|
||||
# ... and all the rest that could be moved out of bindir to gitexecdir
|
||||
PROGRAMS = \
|
||||
git-apply$X git-cat-file$X \
|
||||
git-checkout-index$X git-clone-pack$X git-commit-tree$X \
|
||||
git-convert-objects$X git-diff-files$X \
|
||||
git-diff-index$X git-diff-stages$X \
|
||||
git-diff-tree$X git-fetch-pack$X git-fsck-objects$X \
|
||||
git-cat-file$X \
|
||||
git-checkout-index$X git-clone-pack$X \
|
||||
git-convert-objects$X git-fetch-pack$X git-fsck-objects$X \
|
||||
git-hash-object$X git-index-pack$X git-local-fetch$X \
|
||||
git-ls-files$X git-ls-tree$X git-mailinfo$X git-merge-base$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-peek-remote$X git-prune-packed$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-ssh-upload$X git-unpack-file$X \
|
||||
git-unpack-objects$X git-update-index$X git-update-server-info$X \
|
||||
|
@ -172,7 +170,11 @@ 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-rm$X git-rev-list$X \
|
||||
git-check-ref-format$X \
|
||||
git-init-db$X git-tar-tree$X git-upload-tar$X git-format-patch$X
|
||||
git-init-db$X git-tar-tree$X git-upload-tar$X git-format-patch$X \
|
||||
git-ls-files$X git-ls-tree$X \
|
||||
git-read-tree$X git-commit-tree$X \
|
||||
git-apply$X git-show-branch$X git-diff-files$X \
|
||||
git-diff-index$X git-diff-stages$X git-diff-tree$X
|
||||
|
||||
# what 'all' will build and 'install' will install, in gitexecdir
|
||||
ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS)
|
||||
|
@ -221,7 +223,12 @@ 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-rev-list.o builtin-check-ref-format.o \
|
||||
builtin-rm.o builtin-init-db.o builtin-tar-tree.o builtin-upload-tar.o
|
||||
builtin-rm.o builtin-init-db.o \
|
||||
builtin-tar-tree.o builtin-upload-tar.o \
|
||||
builtin-ls-files.o builtin-ls-tree.o \
|
||||
builtin-read-tree.o builtin-commit-tree.o \
|
||||
builtin-apply.o builtin-show-branch.o builtin-diff-files.o \
|
||||
builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o
|
||||
|
||||
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
|
||||
LIBS = $(GITLIBS) -lz
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "quote.h"
|
||||
#include "blob.h"
|
||||
#include "delta.h"
|
||||
#include "builtin.h"
|
||||
|
||||
// --check turns on checking that the working tree matches the
|
||||
// files that are being modified, but doesn't apply the patch
|
||||
|
@ -2154,7 +2155,7 @@ static int git_apply_config(const char *var, const char *value)
|
|||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int cmd_apply(int argc, const char **argv, char **envp)
|
||||
{
|
||||
int i;
|
||||
int read_stdin = 1;
|
|
@ -6,6 +6,7 @@
|
|||
#include "cache.h"
|
||||
#include "commit.h"
|
||||
#include "tree.h"
|
||||
#include "builtin.h"
|
||||
|
||||
#define BLOCKING (1ul << 14)
|
||||
|
||||
|
@ -76,7 +77,7 @@ static int new_parent(int idx)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int cmd_commit_tree(int argc, const char **argv, char **envp)
|
||||
{
|
||||
int i;
|
||||
int parents = 0;
|
||||
|
@ -98,7 +99,7 @@ int main(int argc, char **argv)
|
|||
|
||||
check_valid(tree_sha1, tree_type);
|
||||
for (i = 2; i < argc; i += 2) {
|
||||
char *a, *b;
|
||||
const char *a, *b;
|
||||
a = argv[i]; b = argv[i+1];
|
||||
if (!b || strcmp(a, "-p"))
|
||||
usage(commit_tree_usage);
|
|
@ -7,12 +7,13 @@
|
|||
#include "diff.h"
|
||||
#include "commit.h"
|
||||
#include "revision.h"
|
||||
#include "builtin.h"
|
||||
|
||||
static const char diff_files_usage[] =
|
||||
"git-diff-files [-q] [-0/-1/2/3 |-c|--cc] [<common diff options>] [<path>...]"
|
||||
COMMON_DIFF_OPTIONS_HELP;
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int cmd_diff_files(int argc, const char **argv, char **envp)
|
||||
{
|
||||
struct rev_info rev;
|
||||
int silent = 0;
|
|
@ -2,13 +2,14 @@
|
|||
#include "diff.h"
|
||||
#include "commit.h"
|
||||
#include "revision.h"
|
||||
#include "builtin.h"
|
||||
|
||||
static const char diff_cache_usage[] =
|
||||
"git-diff-index [-m] [--cached] "
|
||||
"[<common diff options>] <tree-ish> [<path>...]"
|
||||
COMMON_DIFF_OPTIONS_HELP;
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int cmd_diff_index(int argc, const char **argv, char **envp)
|
||||
{
|
||||
struct rev_info rev;
|
||||
int cached = 0;
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "cache.h"
|
||||
#include "diff.h"
|
||||
#include "builtin.h"
|
||||
|
||||
static struct diff_options diff_options;
|
||||
|
||||
|
@ -54,7 +55,7 @@ static void diff_stages(int stage1, int stage2, const char **pathspec)
|
|||
}
|
||||
}
|
||||
|
||||
int main(int ac, const char **av)
|
||||
int cmd_diff_stages(int ac, const char **av, char **envp)
|
||||
{
|
||||
int stage1, stage2;
|
||||
const char *prefix = setup_git_directory();
|
|
@ -2,6 +2,7 @@
|
|||
#include "diff.h"
|
||||
#include "commit.h"
|
||||
#include "log-tree.h"
|
||||
#include "builtin.h"
|
||||
|
||||
static struct rev_info log_tree_opt;
|
||||
|
||||
|
@ -58,7 +59,7 @@ static const char diff_tree_usage[] =
|
|||
" --root include the initial commit as diff against /dev/null\n"
|
||||
COMMON_DIFF_OPTIONS_HELP;
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int cmd_diff_tree(int argc, const char **argv, char **envp)
|
||||
{
|
||||
int nr_sha1;
|
||||
char line[1000];
|
|
@ -10,6 +10,7 @@
|
|||
#include "cache.h"
|
||||
#include "quote.h"
|
||||
#include "dir.h"
|
||||
#include "builtin.h"
|
||||
|
||||
static int abbrev = 0;
|
||||
static int show_deleted = 0;
|
||||
|
@ -321,7 +322,7 @@ static const char ls_files_usage[] =
|
|||
"[ --exclude-per-directory=<filename> ] [--full-name] [--abbrev] "
|
||||
"[--] [<file>]*";
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int cmd_ls_files(int argc, const char **argv, char** envp)
|
||||
{
|
||||
int i;
|
||||
int exc_given = 0;
|
|
@ -7,6 +7,7 @@
|
|||
#include "blob.h"
|
||||
#include "tree.h"
|
||||
#include "quote.h"
|
||||
#include "builtin.h"
|
||||
|
||||
static int line_termination = '\n';
|
||||
#define LS_RECURSIVE 1
|
||||
|
@ -15,7 +16,7 @@ static int line_termination = '\n';
|
|||
#define LS_NAME_ONLY 8
|
||||
static int abbrev = 0;
|
||||
static int ls_options = 0;
|
||||
const char **pathspec;
|
||||
static const char **pathspec;
|
||||
static int chomp_prefix = 0;
|
||||
static const char *prefix;
|
||||
|
||||
|
@ -84,7 +85,7 @@ static int show_tree(unsigned char *sha1, const char *base, int baselen,
|
|||
return retval;
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
int cmd_ls_tree(int argc, const char **argv, char **envp)
|
||||
{
|
||||
unsigned char sha1[20];
|
||||
struct tree *tree;
|
|
@ -12,6 +12,7 @@
|
|||
#include "cache-tree.h"
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
#include "builtin.h"
|
||||
|
||||
static int reset = 0;
|
||||
static int merge = 0;
|
||||
|
@ -834,7 +835,7 @@ static const char read_tree_usage[] = "git-read-tree (<sha> | [[-m [--aggressive
|
|||
|
||||
static struct cache_file cache_file;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int cmd_read_tree(int argc, const char **argv, char **envp)
|
||||
{
|
||||
int i, newfd, stage = 0;
|
||||
unsigned char sha1[20];
|
|
@ -3,13 +3,14 @@
|
|||
#include "cache.h"
|
||||
#include "commit.h"
|
||||
#include "refs.h"
|
||||
#include "builtin.h"
|
||||
|
||||
static const char show_branch_usage[] =
|
||||
"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_alloc = 0;
|
||||
static char **default_arg = NULL;
|
||||
static const char **default_arg = NULL;
|
||||
|
||||
#define UNINTERESTING 01
|
||||
|
||||
|
@ -548,7 +549,7 @@ static int omit_in_dense(struct commit *commit, struct commit **rev, int n)
|
|||
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_list *list = NULL, *seen = NULL;
|
||||
|
@ -581,7 +582,7 @@ int main(int ac, char **av)
|
|||
}
|
||||
|
||||
while (1 < ac && av[1][0] == '-') {
|
||||
char *arg = av[1];
|
||||
const char *arg = av[1];
|
||||
if (!strcmp(arg, "--")) {
|
||||
ac--; av++;
|
||||
break;
|
|
@ -304,7 +304,7 @@ static void traverse_tree(struct tree_desc *tree, struct strbuf *path)
|
|||
}
|
||||
}
|
||||
|
||||
int generate_tar(int argc, const char **argv)
|
||||
static int generate_tar(int argc, const char **argv, char** envp)
|
||||
{
|
||||
unsigned char sha1[20], tree_sha1[20];
|
||||
struct commit *commit;
|
||||
|
@ -404,5 +404,5 @@ int cmd_tar_tree(int argc, const char **argv, char **envp)
|
|||
usage(tar_tree_usage);
|
||||
if (!strncmp("--remote=", argv[1], 9))
|
||||
return remote_tar(argc, argv);
|
||||
return generate_tar(argc, argv);
|
||||
return generate_tar(argc, argv, envp);
|
||||
}
|
||||
|
|
10
builtin.h
10
builtin.h
|
@ -32,5 +32,15 @@ extern int cmd_check_ref_format(int argc, const char **argv, char **envp);
|
|||
extern int cmd_init_db(int argc, const char **argv, char **envp);
|
||||
extern int cmd_tar_tree(int argc, const char **argv, char **envp);
|
||||
extern int cmd_upload_tar(int argc, const char **argv, char **envp);
|
||||
extern int cmd_ls_files(int argc, const char **argv, char **envp);
|
||||
extern int cmd_ls_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_apply(int argc, const char **argv, char **envp);
|
||||
extern int cmd_show_branch(int argc, const char **argv, char **envp);
|
||||
extern int cmd_diff_files(int argc, const char **argv, char **envp);
|
||||
extern int cmd_diff_index(int argc, const char **argv, char **envp);
|
||||
extern int cmd_diff_stages(int argc, const char **argv, char **envp);
|
||||
extern int cmd_diff_tree(int argc, const char **argv, char **envp);
|
||||
|
||||
#endif
|
||||
|
|
13
git.c
13
git.c
|
@ -57,7 +57,18 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
|
|||
{ "init-db", cmd_init_db },
|
||||
{ "tar-tree", cmd_tar_tree },
|
||||
{ "upload-tar", cmd_upload_tar },
|
||||
{ "check-ref-format", cmd_check_ref_format }
|
||||
{ "check-ref-format", cmd_check_ref_format },
|
||||
{ "ls-files", cmd_ls_files },
|
||||
{ "ls-tree", cmd_ls_tree },
|
||||
{ "tar-tree", cmd_tar_tree },
|
||||
{ "read-tree", cmd_read_tree },
|
||||
{ "commit-tree", cmd_commit_tree },
|
||||
{ "apply", cmd_apply },
|
||||
{ "show-branch", cmd_show_branch },
|
||||
{ "diff-files", cmd_diff_files },
|
||||
{ "diff-index", cmd_diff_index },
|
||||
{ "diff-stages", cmd_diff_stages },
|
||||
{ "diff-tree", cmd_diff_tree }
|
||||
};
|
||||
int i;
|
||||
|
||||
|
|
Loading…
Reference in a new issue