diff options
author | Junio C Hamano <junkio@cox.net> | 2007-01-11 16:50:36 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-01-11 16:50:36 -0800 |
commit | e861ce1692fa9809f3e7b898804f8ddaf7cd8975 (patch) | |
tree | 1d812c3d71bab1fcf45fa09f03da21cd01c985ba /git.c | |
parent | 141d21b8256ef96bbd693fd35e154787365e26dc (diff) | |
parent | 7eff28a9b42cb0d3aad932338b2e645fc6ed8fa9 (diff) | |
download | git-e861ce1692fa9809f3e7b898804f8ddaf7cd8975.tar.gz |
Merge branch 'jc/bare'
* jc/bare:
Disallow working directory commands in a bare repository.
git-fetch: allow updating the current branch in a bare repository.
Introduce is_bare_repository() and core.bare configuration variable
Move initialization of log_all_ref_updates
Diffstat (limited to 'git.c')
-rw-r--r-- | git.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -199,6 +199,11 @@ const char git_version_string[] = GIT_VERSION; #define RUN_SETUP (1<<0) #define USE_PAGER (1<<1) +/* + * require working tree to be present -- anything uses this needs + * RUN_SETUP for reading from the configuration file. + */ +#define NOT_BARE (1<<2) static void handle_internal_command(int argc, const char **argv, char **envp) { @@ -208,7 +213,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp) int (*fn)(int, const char **, const char *); int option; } commands[] = { - { "add", cmd_add, RUN_SETUP }, + { "add", cmd_add, RUN_SETUP | NOT_BARE }, { "annotate", cmd_annotate, }, { "apply", cmd_apply }, { "archive", cmd_archive }, @@ -240,7 +245,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp) { "mailinfo", cmd_mailinfo }, { "mailsplit", cmd_mailsplit }, { "merge-file", cmd_merge_file }, - { "mv", cmd_mv, RUN_SETUP }, + { "mv", cmd_mv, RUN_SETUP | NOT_BARE }, { "name-rev", cmd_name_rev, RUN_SETUP }, { "pack-objects", cmd_pack_objects, RUN_SETUP }, { "pickaxe", cmd_blame, RUN_SETUP | USE_PAGER }, @@ -253,8 +258,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp) { "rerere", cmd_rerere, RUN_SETUP }, { "rev-list", cmd_rev_list, RUN_SETUP }, { "rev-parse", cmd_rev_parse, RUN_SETUP }, - { "rm", cmd_rm, RUN_SETUP }, - { "runstatus", cmd_runstatus, RUN_SETUP }, + { "rm", cmd_rm, RUN_SETUP | NOT_BARE }, + { "runstatus", cmd_runstatus, RUN_SETUP | NOT_BARE }, { "shortlog", cmd_shortlog, RUN_SETUP | USE_PAGER }, { "show-branch", cmd_show_branch, RUN_SETUP }, { "show", cmd_show, RUN_SETUP | USE_PAGER }, @@ -291,6 +296,8 @@ static void handle_internal_command(int argc, const char **argv, char **envp) prefix = setup_git_directory(); if (p->option & USE_PAGER) setup_pager(); + if ((p->option & NOT_BARE) && is_bare_repository()) + die("%s cannot be used in a bare git directory", cmd); trace_argv_printf(argv, argc, "trace: built-in: git"); exit(p->fn(argc, argv, prefix)); |