зеркало из https://github.com/microsoft/git.git
Make git-name-rev a builtin
Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Родитель
cba05fa840
Коммит
d6b64ed0f3
7
Makefile
7
Makefile
|
@ -185,7 +185,7 @@ PROGRAMS = \
|
||||||
git-unpack-objects$X git-update-server-info$X \
|
git-unpack-objects$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-symbolic-ref$X \
|
||||||
git-name-rev$X git-pack-redundant$X git-var$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-log$X git-whatchanged$X git-show$X git-update-ref$X \
|
||||||
|
@ -198,7 +198,7 @@ BUILT_INS = git-log$X git-whatchanged$X git-show$X git-update-ref$X \
|
||||||
git-apply$X git-show-branch$X git-diff-files$X git-update-index$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-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-fmt-merge-msg$X git-prune$X git-mv$X git-prune-packed$X \
|
||||||
git-repo-config$X
|
git-repo-config$X git-name-rev$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)
|
||||||
|
@ -255,7 +255,8 @@ BUILTIN_OBJS = \
|
||||||
builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o \
|
builtin-diff-index.o builtin-diff-stages.o builtin-diff-tree.o \
|
||||||
builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
|
builtin-cat-file.o builtin-mailsplit.o builtin-stripspace.o \
|
||||||
builtin-update-ref.o builtin-fmt-merge-msg.o builtin-prune.o \
|
builtin-update-ref.o builtin-fmt-merge-msg.o builtin-prune.o \
|
||||||
builtin-mv.o builtin-prune-packed.o builtin-repo-config.o
|
builtin-mv.o builtin-prune-packed.o builtin-repo-config.o \
|
||||||
|
builtin-name-rev.o
|
||||||
|
|
||||||
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
|
GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
|
||||||
LIBS = $(GITLIBS) -lz
|
LIBS = $(GITLIBS) -lz
|
||||||
|
|
|
@ -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)
|
|
@ -49,6 +49,7 @@ 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_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_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_repo_config(int argc, const char **argv, const char *prefix);
|
||||||
|
extern int cmd_name_rev(int argc, const char **argv, const char *prefix);
|
||||||
|
|
||||||
extern int cmd_write_tree(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);
|
||||||
|
|
1
git.c
1
git.c
|
@ -265,6 +265,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
|
||||||
{ "mv", cmd_mv, NEEDS_PREFIX },
|
{ "mv", cmd_mv, NEEDS_PREFIX },
|
||||||
{ "prune-packed", cmd_prune_packed, NEEDS_PREFIX },
|
{ "prune-packed", cmd_prune_packed, NEEDS_PREFIX },
|
||||||
{ "repo-config", cmd_repo_config },
|
{ "repo-config", cmd_repo_config },
|
||||||
|
{ "name-rev", cmd_name_rev, NEEDS_PREFIX },
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче