Merge branch 'mk/rename'
commit
bb266cb118
81
Makefile
81
Makefile
|
@ -173,32 +173,23 @@ SIMPLE_PROGRAMS = \
|
||||||
|
|
||||||
# ... and all the rest that could be moved out of bindir to gitexecdir
|
# ... and all the rest that could be moved out of bindir to gitexecdir
|
||||||
PROGRAMS = \
|
PROGRAMS = \
|
||||||
git-checkout-index$X \
|
|
||||||
git-convert-objects$X git-fetch-pack$X git-fsck-objects$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-hash-object$X git-index-pack$X git-local-fetch$X \
|
||||||
git-merge-base$X \
|
git-merge-base$X \
|
||||||
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-patch-id$X \
|
||||||
git-peek-remote$X git-receive-pack$X \
|
git-peek-remote$X git-receive-pack$X \
|
||||||
git-send-pack$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-server-info$X \
|
git-update-server-info$X \
|
||||||
git-upload-pack$X git-verify-pack$X \
|
git-upload-pack$X git-verify-pack$X \
|
||||||
git-symbolic-ref$X \
|
git-pack-redundant$X git-var$X \
|
||||||
git-name-rev$X git-pack-redundant$X git-var$X \
|
|
||||||
git-describe$X git-merge-tree$X git-blame$X git-imap-send$X
|
git-describe$X git-merge-tree$X git-blame$X git-imap-send$X
|
||||||
|
|
||||||
BUILT_INS = git-log$X git-whatchanged$X git-show$X git-update-ref$X \
|
BUILT_INS = \
|
||||||
git-count-objects$X git-diff$X git-push$X git-mailsplit$X \
|
git-format-patch$X git-show$X git-whatchanged$X \
|
||||||
git-grep$X git-add$X git-rm$X git-rev-list$X git-stripspace$X \
|
git-get-tar-commit-id$X \
|
||||||
git-check-ref-format$X git-rev-parse$X git-mailinfo$X \
|
$(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
|
||||||
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-get-tar-commit-id$X \
|
|
||||||
git-read-tree$X git-commit-tree$X git-write-tree$X \
|
|
||||||
git-apply$X git-show-branch$X git-diff-files$X git-update-index$X \
|
|
||||||
git-diff-index$X git-diff-stages$X git-diff-tree$X git-cat-file$X \
|
|
||||||
git-fmt-merge-msg$X git-prune$X git-mv$X git-prune-packed$X \
|
|
||||||
git-repo-config$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)
|
||||||
|
@ -227,7 +218,7 @@ LIB_H = \
|
||||||
blob.h cache.h commit.h csum-file.h delta.h \
|
blob.h cache.h commit.h csum-file.h delta.h \
|
||||||
diff.h object.h pack.h pkt-line.h quote.h refs.h \
|
diff.h object.h pack.h pkt-line.h quote.h refs.h \
|
||||||
run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
|
run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
|
||||||
tree-walk.h log-tree.h dir.h path-list.h
|
tree-walk.h log-tree.h dir.h path-list.h builtin.h
|
||||||
|
|
||||||
DIFF_OBJS = \
|
DIFF_OBJS = \
|
||||||
diff.o diff-lib.o diffcore-break.o diffcore-order.o \
|
diff.o diff-lib.o diffcore-break.o diffcore-order.o \
|
||||||
|
@ -242,20 +233,50 @@ LIB_OBJS = \
|
||||||
server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
|
server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
|
||||||
tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
|
tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
|
||||||
fetch-clone.o revision.o pager.o tree-walk.o xdiff-interface.o \
|
fetch-clone.o revision.o pager.o tree-walk.o xdiff-interface.o \
|
||||||
alloc.o merge-file.o path-list.o $(DIFF_OBJS)
|
alloc.o merge-file.o path-list.o help.o $(DIFF_OBJS)
|
||||||
|
|
||||||
BUILTIN_OBJS = \
|
BUILTIN_OBJS = \
|
||||||
builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \
|
builtin-add.o \
|
||||||
builtin-grep.o builtin-add.o builtin-rev-list.o builtin-check-ref-format.o \
|
builtin-apply.o \
|
||||||
builtin-rm.o builtin-init-db.o builtin-rev-parse.o \
|
builtin-cat-file.o \
|
||||||
builtin-tar-tree.o builtin-upload-tar.o builtin-update-index.o \
|
builtin-checkout-index.o \
|
||||||
builtin-ls-files.o builtin-ls-tree.o builtin-write-tree.o \
|
builtin-check-ref-format.o \
|
||||||
builtin-read-tree.o builtin-commit-tree.o builtin-mailinfo.o \
|
builtin-commit-tree.o \
|
||||||
builtin-apply.o builtin-show-branch.o builtin-diff-files.o \
|
builtin-count-objects.o \
|
||||||
builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o \
|
builtin-diff.o \
|
||||||
builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
|
builtin-diff-files.o \
|
||||||
builtin-update-ref.o builtin-fmt-merge-msg.o builtin-prune.o \
|
builtin-diff-index.o \
|
||||||
builtin-mv.o builtin-prune-packed.o builtin-repo-config.o
|
builtin-diff-stages.o \
|
||||||
|
builtin-diff-tree.o \
|
||||||
|
builtin-fmt-merge-msg.o \
|
||||||
|
builtin-grep.o \
|
||||||
|
builtin-init-db.o \
|
||||||
|
builtin-log.o \
|
||||||
|
builtin-ls-files.o \
|
||||||
|
builtin-ls-tree.o \
|
||||||
|
builtin-mailinfo.o \
|
||||||
|
builtin-mailsplit.o \
|
||||||
|
builtin-mv.o \
|
||||||
|
builtin-name-rev.o \
|
||||||
|
builtin-pack-objects.o \
|
||||||
|
builtin-prune.o \
|
||||||
|
builtin-prune-packed.o \
|
||||||
|
builtin-push.o \
|
||||||
|
builtin-read-tree.o \
|
||||||
|
builtin-repo-config.o \
|
||||||
|
builtin-rev-list.o \
|
||||||
|
builtin-rev-parse.o \
|
||||||
|
builtin-rm.o \
|
||||||
|
builtin-show-branch.o \
|
||||||
|
builtin-stripspace.o \
|
||||||
|
builtin-symbolic-ref.o \
|
||||||
|
builtin-tar-tree.o \
|
||||||
|
builtin-unpack-objects.o \
|
||||||
|
builtin-update-index.o \
|
||||||
|
builtin-update-ref.o \
|
||||||
|
builtin-upload-tar.o \
|
||||||
|
builtin-verify-pack.o \
|
||||||
|
builtin-write-tree.o
|
||||||
|
|
||||||
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
|
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
|
||||||
LIBS = $(GITLIBS) -lz
|
LIBS = $(GITLIBS) -lz
|
||||||
|
@ -536,7 +557,7 @@ git$X: git.c common-cmds.h $(BUILTIN_OBJS) $(GITLIBS) GIT-CFLAGS
|
||||||
$(ALL_CFLAGS) -o $@ $(filter %.c,$^) \
|
$(ALL_CFLAGS) -o $@ $(filter %.c,$^) \
|
||||||
$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
|
$(BUILTIN_OBJS) $(ALL_LDFLAGS) $(LIBS)
|
||||||
|
|
||||||
builtin-help.o: common-cmds.h
|
help.o: common-cmds.h
|
||||||
|
|
||||||
$(BUILT_INS): git$X
|
$(BUILT_INS): git$X
|
||||||
rm -f $@ && ln git$X $@
|
rm -f $@ && ln git$X $@
|
||||||
|
|
|
@ -42,8 +42,6 @@
|
||||||
#include "cache-tree.h"
|
#include "cache-tree.h"
|
||||||
|
|
||||||
#define CHECKOUT_ALL 4
|
#define CHECKOUT_ALL 4
|
||||||
static const char *prefix;
|
|
||||||
static int prefix_length;
|
|
||||||
static int line_termination = '\n';
|
static int line_termination = '\n';
|
||||||
static int checkout_stage; /* default to checkout stage0 */
|
static int checkout_stage; /* default to checkout stage0 */
|
||||||
static int to_tempfile;
|
static int to_tempfile;
|
||||||
|
@ -51,7 +49,7 @@ static char topath[4][MAXPATHLEN+1];
|
||||||
|
|
||||||
static struct checkout state;
|
static struct checkout state;
|
||||||
|
|
||||||
static void write_tempfile_record (const char *name)
|
static void write_tempfile_record(const char *name, int prefix_length)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -77,7 +75,7 @@ static void write_tempfile_record (const char *name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int checkout_file(const char *name)
|
static int checkout_file(const char *name, int prefix_length)
|
||||||
{
|
{
|
||||||
int namelen = strlen(name);
|
int namelen = strlen(name);
|
||||||
int pos = cache_name_pos(name, namelen);
|
int pos = cache_name_pos(name, namelen);
|
||||||
|
@ -106,7 +104,7 @@ static int checkout_file(const char *name)
|
||||||
|
|
||||||
if (did_checkout) {
|
if (did_checkout) {
|
||||||
if (to_tempfile)
|
if (to_tempfile)
|
||||||
write_tempfile_record(name);
|
write_tempfile_record(name, prefix_length);
|
||||||
return errs > 0 ? -1 : 0;
|
return errs > 0 ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +122,7 @@ static int checkout_file(const char *name)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int checkout_all(void)
|
static int checkout_all(const char *prefix, int prefix_length)
|
||||||
{
|
{
|
||||||
int i, errs = 0;
|
int i, errs = 0;
|
||||||
struct cache_entry* last_ce = NULL;
|
struct cache_entry* last_ce = NULL;
|
||||||
|
@ -141,7 +139,7 @@ static int checkout_all(void)
|
||||||
if (last_ce && to_tempfile) {
|
if (last_ce && to_tempfile) {
|
||||||
if (ce_namelen(last_ce) != ce_namelen(ce)
|
if (ce_namelen(last_ce) != ce_namelen(ce)
|
||||||
|| memcmp(last_ce->name, ce->name, ce_namelen(ce)))
|
|| memcmp(last_ce->name, ce->name, ce_namelen(ce)))
|
||||||
write_tempfile_record(last_ce->name);
|
write_tempfile_record(last_ce->name, prefix_length);
|
||||||
}
|
}
|
||||||
if (checkout_entry(ce, &state,
|
if (checkout_entry(ce, &state,
|
||||||
to_tempfile ? topath[ce_stage(ce)] : NULL) < 0)
|
to_tempfile ? topath[ce_stage(ce)] : NULL) < 0)
|
||||||
|
@ -149,7 +147,7 @@ static int checkout_all(void)
|
||||||
last_ce = ce;
|
last_ce = ce;
|
||||||
}
|
}
|
||||||
if (last_ce && to_tempfile)
|
if (last_ce && to_tempfile)
|
||||||
write_tempfile_record(last_ce->name);
|
write_tempfile_record(last_ce->name, prefix_length);
|
||||||
if (errs)
|
if (errs)
|
||||||
/* we have already done our error reporting.
|
/* we have already done our error reporting.
|
||||||
* exit with the same code as die().
|
* exit with the same code as die().
|
||||||
|
@ -163,16 +161,16 @@ static const char checkout_cache_usage[] =
|
||||||
|
|
||||||
static struct lock_file lock_file;
|
static struct lock_file lock_file;
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int cmd_checkout_index(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int newfd = -1;
|
int newfd = -1;
|
||||||
int all = 0;
|
int all = 0;
|
||||||
int read_from_stdin = 0;
|
int read_from_stdin = 0;
|
||||||
|
int prefix_length;
|
||||||
|
|
||||||
state.base_dir = "";
|
|
||||||
prefix = setup_git_directory();
|
|
||||||
git_config(git_default_config);
|
git_config(git_default_config);
|
||||||
|
state.base_dir = "";
|
||||||
prefix_length = prefix ? strlen(prefix) : 0;
|
prefix_length = prefix ? strlen(prefix) : 0;
|
||||||
|
|
||||||
if (read_cache() < 0) {
|
if (read_cache() < 0) {
|
||||||
|
@ -270,7 +268,7 @@ int main(int argc, char **argv)
|
||||||
if (read_from_stdin)
|
if (read_from_stdin)
|
||||||
die("git-checkout-index: don't mix '--stdin' and explicit filenames");
|
die("git-checkout-index: don't mix '--stdin' and explicit filenames");
|
||||||
p = prefix_path(prefix, prefix_length, arg);
|
p = prefix_path(prefix, prefix_length, arg);
|
||||||
checkout_file(p);
|
checkout_file(p, prefix_length);
|
||||||
if (p < arg || p > arg + strlen(arg))
|
if (p < arg || p > arg + strlen(arg))
|
||||||
free((char*)p);
|
free((char*)p);
|
||||||
}
|
}
|
||||||
|
@ -292,7 +290,7 @@ int main(int argc, char **argv)
|
||||||
else
|
else
|
||||||
path_name = buf.buf;
|
path_name = buf.buf;
|
||||||
p = prefix_path(prefix, prefix_length, path_name);
|
p = prefix_path(prefix, prefix_length, path_name);
|
||||||
checkout_file(p);
|
checkout_file(p, prefix_length);
|
||||||
if (p < path_name || p > path_name + strlen(path_name))
|
if (p < path_name || p > path_name + strlen(path_name))
|
||||||
free((char *)p);
|
free((char *)p);
|
||||||
if (path_name != buf.buf)
|
if (path_name != buf.buf)
|
||||||
|
@ -301,7 +299,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (all)
|
if (all)
|
||||||
checkout_all();
|
checkout_all(prefix, prefix_length);
|
||||||
|
|
||||||
if (0 <= newfd &&
|
if (0 <= newfd &&
|
||||||
(write_cache(newfd, active_cache, active_nr) ||
|
(write_cache(newfd, active_cache, active_nr) ||
|
|
@ -1,4 +1,5 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "builtin.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
|
@ -126,12 +127,11 @@ static const char* get_rev_name(struct object *o)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int cmd_name_rev(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
struct object_array revs = { 0, 0, NULL };
|
struct object_array revs = { 0, 0, NULL };
|
||||||
int as_is = 0, all = 0, transform_stdin = 0;
|
int as_is = 0, all = 0, transform_stdin = 0;
|
||||||
|
|
||||||
setup_git_directory();
|
|
||||||
git_config(git_default_config);
|
git_config(git_default_config);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "builtin.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "blob.h"
|
#include "blob.h"
|
||||||
|
@ -1226,7 +1227,7 @@ static int git_pack_config(const char *k, const char *v)
|
||||||
return git_default_config(k, v);
|
return git_default_config(k, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
SHA_CTX ctx;
|
SHA_CTX ctx;
|
||||||
char line[40 + 1 + PATH_MAX + 2];
|
char line[40 + 1 + PATH_MAX + 2];
|
||||||
|
@ -1235,7 +1236,6 @@ int main(int argc, char **argv)
|
||||||
int num_preferred_base = 0;
|
int num_preferred_base = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
setup_git_directory();
|
|
||||||
git_config(git_pack_config);
|
git_config(git_pack_config);
|
||||||
|
|
||||||
progress = isatty(2);
|
progress = isatty(2);
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "builtin.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
|
|
||||||
static const char git_symbolic_ref_usage[] =
|
static const char git_symbolic_ref_usage[] =
|
||||||
|
@ -17,9 +18,8 @@ static void check_symref(const char *HEAD)
|
||||||
die("No such ref: %s", HEAD);
|
die("No such ref: %s", HEAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char **argv)
|
int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
setup_git_directory();
|
|
||||||
git_config(git_default_config);
|
git_config(git_default_config);
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
case 2:
|
case 2:
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "builtin.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "delta.h"
|
#include "delta.h"
|
||||||
|
@ -112,7 +113,7 @@ static void write_object(void *buf, unsigned long size, const char *type)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int resolve_delta(const char *type,
|
static int resolve_delta(const char *type,
|
||||||
void *base, unsigned long base_size,
|
void *base, unsigned long base_size,
|
||||||
void *delta, unsigned long delta_size)
|
void *delta, unsigned long delta_size)
|
||||||
{
|
{
|
||||||
void *result;
|
void *result;
|
||||||
|
@ -260,13 +261,11 @@ static void unpack_all(void)
|
||||||
die("unresolved deltas left after unpacking");
|
die("unresolved deltas left after unpacking");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int cmd_unpack_objects(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
|
|
||||||
setup_git_directory();
|
|
||||||
|
|
||||||
quiet = !isatty(2);
|
quiet = !isatty(2);
|
||||||
|
|
||||||
for (i = 1 ; i < argc; i++) {
|
for (i = 1 ; i < argc; i++) {
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "builtin.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "pack.h"
|
#include "pack.h"
|
||||||
|
|
||||||
|
@ -47,28 +48,28 @@ static int verify_one_pack(const char *path, int verbose)
|
||||||
|
|
||||||
static const char verify_pack_usage[] = "git-verify-pack [-v] <pack>...";
|
static const char verify_pack_usage[] = "git-verify-pack [-v] <pack>...";
|
||||||
|
|
||||||
int main(int ac, char **av)
|
int cmd_verify_pack(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int no_more_options = 0;
|
int no_more_options = 0;
|
||||||
int nothing_done = 1;
|
int nothing_done = 1;
|
||||||
|
|
||||||
while (1 < ac) {
|
while (1 < argc) {
|
||||||
if (!no_more_options && av[1][0] == '-') {
|
if (!no_more_options && argv[1][0] == '-') {
|
||||||
if (!strcmp("-v", av[1]))
|
if (!strcmp("-v", argv[1]))
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
else if (!strcmp("--", av[1]))
|
else if (!strcmp("--", argv[1]))
|
||||||
no_more_options = 1;
|
no_more_options = 1;
|
||||||
else
|
else
|
||||||
usage(verify_pack_usage);
|
usage(verify_pack_usage);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (verify_one_pack(av[1], verbose))
|
if (verify_one_pack(argv[1], verbose))
|
||||||
err = 1;
|
err = 1;
|
||||||
nothing_done = 0;
|
nothing_done = 0;
|
||||||
}
|
}
|
||||||
ac--; av++;
|
argc--; argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nothing_done)
|
if (nothing_done)
|
98
builtin.h
98
builtin.h
|
@ -8,57 +8,57 @@ extern const char git_version_string[];
|
||||||
extern const char git_usage_string[];
|
extern const char git_usage_string[];
|
||||||
|
|
||||||
extern void help_unknown_cmd(const char *cmd);
|
extern void help_unknown_cmd(const char *cmd);
|
||||||
|
extern int mailinfo(FILE *in, FILE *out, int ks, const char *encoding, const char *msg, const char *patch);
|
||||||
extern int cmd_help(int argc, const char **argv, const char *prefix);
|
extern int split_mbox(const char **mbox, const char *dir, int allow_bare, int nr_prec, int skip);
|
||||||
extern int cmd_version(int argc, const char **argv, const char *prefix);
|
extern void stripspace(FILE *in, FILE *out);
|
||||||
|
|
||||||
extern int cmd_whatchanged(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_show(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_log(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_diff(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_format_patch(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_count_objects(int argc, const char **argv, const char *prefix);
|
|
||||||
|
|
||||||
extern int cmd_prune(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_prune_packed(int argc, const char **argv, const char *prefix);
|
|
||||||
|
|
||||||
extern int cmd_push(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_grep(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_rm(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_add(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_rev_list(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_check_ref_format(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_init_db(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_tar_tree(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_upload_tar(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_ls_files(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_ls_tree(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_read_tree(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_commit_tree(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_apply(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_diff_files(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_diff_index(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_diff_stages(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_diff_tree(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_cat_file(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_rev_parse(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_update_index(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_mv(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int cmd_repo_config(int argc, const char **argv, const char *prefix);
|
|
||||||
|
|
||||||
extern int cmd_write_tree(int argc, const char **argv, const char *prefix);
|
|
||||||
extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
|
extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
|
||||||
|
|
||||||
extern int cmd_mailsplit(int argc, const char **argv, const char *prefix);
|
extern int cmd_add(int argc, const char **argv, const char *prefix);
|
||||||
extern int split_mbox(const char **mbox, const char *dir, int allow_bare, int nr_prec, int skip);
|
extern int cmd_apply(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_cat_file(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_checkout_index(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_check_ref_format(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_commit_tree(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_count_objects(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_diff_files(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_diff_index(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_diff(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_diff_stages(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_diff_tree(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_format_patch(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_grep(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_help(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_init_db(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_log(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_ls_files(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_ls_tree(int argc, const char **argv, const char *prefix);
|
||||||
extern int cmd_mailinfo(int argc, const char **argv, const char *prefix);
|
extern int cmd_mailinfo(int argc, const char **argv, const char *prefix);
|
||||||
extern int mailinfo(FILE *in, FILE *out, int ks, const char *encoding, const char *msg, const char *patch);
|
extern int cmd_mailsplit(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_mv(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_pack_objects(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_prune(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_prune_packed(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_push(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_read_tree(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_repo_config(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_rev_list(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_rev_parse(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_rm(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_show(int argc, const char **argv, const char *prefix);
|
||||||
extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
|
extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
|
||||||
extern void stripspace(FILE *in, FILE *out);
|
extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_tar_tree(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_update_index(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_upload_tar(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_version(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_whatchanged(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_write_tree(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_verify_pack(int argc, const char **argv, const char *prefix);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
88
git.c
88
git.c
|
@ -213,8 +213,8 @@ static int handle_alias(int *argcp, const char ***argv)
|
||||||
|
|
||||||
const char git_version_string[] = GIT_VERSION;
|
const char git_version_string[] = GIT_VERSION;
|
||||||
|
|
||||||
#define NEEDS_PREFIX 1
|
#define RUN_SETUP (1<<0)
|
||||||
#define USE_PAGER 2
|
#define USE_PAGER (1<<1)
|
||||||
|
|
||||||
static void handle_internal_command(int argc, const char **argv, char **envp)
|
static void handle_internal_command(int argc, const char **argv, char **envp)
|
||||||
{
|
{
|
||||||
|
@ -224,47 +224,53 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
|
||||||
int (*fn)(int, const char **, const char *);
|
int (*fn)(int, const char **, const char *);
|
||||||
int option;
|
int option;
|
||||||
} commands[] = {
|
} commands[] = {
|
||||||
{ "version", cmd_version },
|
{ "add", cmd_add, RUN_SETUP },
|
||||||
{ "help", cmd_help },
|
|
||||||
{ "log", cmd_log, NEEDS_PREFIX | USE_PAGER },
|
|
||||||
{ "whatchanged", cmd_whatchanged, NEEDS_PREFIX | USE_PAGER },
|
|
||||||
{ "show", cmd_show, NEEDS_PREFIX | USE_PAGER },
|
|
||||||
{ "push", cmd_push, NEEDS_PREFIX },
|
|
||||||
{ "format-patch", cmd_format_patch, NEEDS_PREFIX },
|
|
||||||
{ "count-objects", cmd_count_objects },
|
|
||||||
{ "diff", cmd_diff, NEEDS_PREFIX },
|
|
||||||
{ "grep", cmd_grep, NEEDS_PREFIX },
|
|
||||||
{ "rm", cmd_rm, NEEDS_PREFIX },
|
|
||||||
{ "add", cmd_add, NEEDS_PREFIX },
|
|
||||||
{ "rev-list", cmd_rev_list, NEEDS_PREFIX },
|
|
||||||
{ "init-db", cmd_init_db },
|
|
||||||
{ "get-tar-commit-id", cmd_get_tar_commit_id },
|
|
||||||
{ "upload-tar", cmd_upload_tar },
|
|
||||||
{ "check-ref-format", cmd_check_ref_format },
|
|
||||||
{ "ls-files", cmd_ls_files, NEEDS_PREFIX },
|
|
||||||
{ "ls-tree", cmd_ls_tree, NEEDS_PREFIX },
|
|
||||||
{ "tar-tree", cmd_tar_tree, NEEDS_PREFIX },
|
|
||||||
{ "read-tree", cmd_read_tree, NEEDS_PREFIX },
|
|
||||||
{ "commit-tree", cmd_commit_tree, NEEDS_PREFIX },
|
|
||||||
{ "apply", cmd_apply },
|
{ "apply", cmd_apply },
|
||||||
{ "show-branch", cmd_show_branch, NEEDS_PREFIX },
|
{ "cat-file", cmd_cat_file, RUN_SETUP },
|
||||||
{ "diff-files", cmd_diff_files, NEEDS_PREFIX },
|
{ "checkout-index", cmd_checkout_index, RUN_SETUP },
|
||||||
{ "diff-index", cmd_diff_index, NEEDS_PREFIX },
|
{ "check-ref-format", cmd_check_ref_format },
|
||||||
{ "diff-stages", cmd_diff_stages, NEEDS_PREFIX },
|
{ "commit-tree", cmd_commit_tree, RUN_SETUP },
|
||||||
{ "diff-tree", cmd_diff_tree, NEEDS_PREFIX },
|
{ "count-objects", cmd_count_objects },
|
||||||
{ "cat-file", cmd_cat_file, NEEDS_PREFIX },
|
{ "diff", cmd_diff, RUN_SETUP },
|
||||||
{ "rev-parse", cmd_rev_parse, NEEDS_PREFIX },
|
{ "diff-files", cmd_diff_files, RUN_SETUP },
|
||||||
{ "write-tree", cmd_write_tree, NEEDS_PREFIX },
|
{ "diff-index", cmd_diff_index, RUN_SETUP },
|
||||||
{ "mailsplit", cmd_mailsplit },
|
{ "diff-stages", cmd_diff_stages, RUN_SETUP },
|
||||||
|
{ "diff-tree", cmd_diff_tree, RUN_SETUP },
|
||||||
|
{ "fmt-merge-msg", cmd_fmt_merge_msg, RUN_SETUP },
|
||||||
|
{ "format-patch", cmd_format_patch, RUN_SETUP },
|
||||||
|
{ "get-tar-commit-id", cmd_get_tar_commit_id },
|
||||||
|
{ "grep", cmd_grep, RUN_SETUP },
|
||||||
|
{ "help", cmd_help },
|
||||||
|
{ "init-db", cmd_init_db },
|
||||||
|
{ "log", cmd_log, RUN_SETUP | USE_PAGER },
|
||||||
|
{ "ls-files", cmd_ls_files, RUN_SETUP },
|
||||||
|
{ "ls-tree", cmd_ls_tree, RUN_SETUP },
|
||||||
{ "mailinfo", cmd_mailinfo },
|
{ "mailinfo", cmd_mailinfo },
|
||||||
{ "stripspace", cmd_stripspace },
|
{ "mailsplit", cmd_mailsplit },
|
||||||
{ "update-index", cmd_update_index, NEEDS_PREFIX },
|
{ "mv", cmd_mv, RUN_SETUP },
|
||||||
{ "update-ref", cmd_update_ref, NEEDS_PREFIX },
|
{ "name-rev", cmd_name_rev, RUN_SETUP },
|
||||||
{ "fmt-merge-msg", cmd_fmt_merge_msg, NEEDS_PREFIX },
|
{ "pack-objects", cmd_pack_objects, RUN_SETUP },
|
||||||
{ "prune", cmd_prune, NEEDS_PREFIX },
|
{ "prune", cmd_prune, RUN_SETUP },
|
||||||
{ "mv", cmd_mv, NEEDS_PREFIX },
|
{ "prune-packed", cmd_prune_packed, RUN_SETUP },
|
||||||
{ "prune-packed", cmd_prune_packed, NEEDS_PREFIX },
|
{ "push", cmd_push, RUN_SETUP },
|
||||||
|
{ "read-tree", cmd_read_tree, RUN_SETUP },
|
||||||
{ "repo-config", cmd_repo_config },
|
{ "repo-config", cmd_repo_config },
|
||||||
|
{ "rev-list", cmd_rev_list, RUN_SETUP },
|
||||||
|
{ "rev-parse", cmd_rev_parse, RUN_SETUP },
|
||||||
|
{ "rm", cmd_rm, RUN_SETUP },
|
||||||
|
{ "show-branch", cmd_show_branch, RUN_SETUP },
|
||||||
|
{ "show", cmd_show, RUN_SETUP | USE_PAGER },
|
||||||
|
{ "stripspace", cmd_stripspace },
|
||||||
|
{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
|
||||||
|
{ "tar-tree", cmd_tar_tree, RUN_SETUP },
|
||||||
|
{ "unpack-objects", cmd_unpack_objects, RUN_SETUP },
|
||||||
|
{ "update-index", cmd_update_index, RUN_SETUP },
|
||||||
|
{ "update-ref", cmd_update_ref, RUN_SETUP },
|
||||||
|
{ "upload-tar", cmd_upload_tar },
|
||||||
|
{ "version", cmd_version },
|
||||||
|
{ "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER },
|
||||||
|
{ "write-tree", cmd_write_tree, RUN_SETUP },
|
||||||
|
{ "verify-pack", cmd_verify_pack },
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -281,7 +287,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
prefix = NULL;
|
prefix = NULL;
|
||||||
if (p->option & NEEDS_PREFIX)
|
if (p->option & RUN_SETUP)
|
||||||
prefix = setup_git_directory();
|
prefix = setup_git_directory();
|
||||||
if (p->option & USE_PAGER)
|
if (p->option & USE_PAGER)
|
||||||
setup_pager();
|
setup_pager();
|
||||||
|
|
Loading…
Reference in New Issue