author | Junio C Hamano <gitster@pobox.com> | |
Tue, 31 Aug 2010 23:23:31 +0000 (16:23 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 31 Aug 2010 23:23:31 +0000 (16:23 -0700) |
* jn/paginate-fix:
t7006 (pager): add missing TTY prerequisites
merge-file: run setup_git_directory_gently() sooner
var: run setup_git_directory_gently() sooner
ls-remote: run setup_git_directory_gently() sooner
index-pack: run setup_git_directory_gently() sooner
config: run setup_git_directory_gently() sooner
bundle: run setup_git_directory_gently() sooner
apply: run setup_git_directory_gently() sooner
grep: run setup_git_directory_gently() sooner
shortlog: run setup_git_directory_gently() sooner
git wrapper: allow setup_git_directory_gently() be called earlier
setup: remember whether repository was found
git wrapper: introduce startup_info struct
Conflicts:
builtin/index-pack.c
t7006 (pager): add missing TTY prerequisites
merge-file: run setup_git_directory_gently() sooner
var: run setup_git_directory_gently() sooner
ls-remote: run setup_git_directory_gently() sooner
index-pack: run setup_git_directory_gently() sooner
config: run setup_git_directory_gently() sooner
bundle: run setup_git_directory_gently() sooner
apply: run setup_git_directory_gently() sooner
grep: run setup_git_directory_gently() sooner
shortlog: run setup_git_directory_gently() sooner
git wrapper: allow setup_git_directory_gently() be called earlier
setup: remember whether repository was found
git wrapper: introduce startup_info struct
Conflicts:
builtin/index-pack.c
1 | 2 | |||
---|---|---|---|---|
builtin/apply.c | patch | | diff1 | | diff2 | | blob | history |
builtin/config.c | patch | | diff1 | | diff2 | | blob | history |
builtin/grep.c | patch | | diff1 | | diff2 | | blob | history |
builtin/index-pack.c | patch | | diff1 | | diff2 | | blob | history |
cache.h | patch | | diff1 | | diff2 | | blob | history |
git.c | patch | | diff1 | | diff2 | | blob | history |
setup.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc builtin/apply.c
Simple merge
diff --cc builtin/config.c
Simple merge
diff --cc builtin/grep.c
index b725ede0f7270637759b9fef52ab5450fc1712e2,ca56c5b0099e19059b51440880d032c5e1d27f5e..da32f3df34da7af3cdcb0a9dd6aa66061bdfe927
--- 1/builtin/grep.c
--- 2/builtin/grep.c
+++ b/builtin/grep.c
int external_grep_allowed__ignored;
const char *show_in_pager = NULL, *default_pager = "dummy";
struct grep_opt opt;
- struct object_array list = { 0, 0, NULL };
+ struct object_array list = OBJECT_ARRAY_INIT;
const char **paths = NULL;
- struct string_list path_list = { NULL, 0, 0, 0 };
+ struct string_list path_list = STRING_LIST_INIT_NODUP;
int i;
int dummy;
- int nongit = 0, use_index = 1;
+ int use_index = 1;
struct option options[] = {
OPT_BOOLEAN(0, "cached", &cached,
"search in index instead of in the work tree"),
diff --cc builtin/index-pack.c
index 96333d48cd49fcfba5707530440f6f6848a2acf5,e852890862e12c9ebeec087e6ada6fde59a75efc..2e680d7a7ac3495c9d6bd10e0fa6a6ae28bb8670
+++ b/builtin/index-pack.c
if (argc == 2 && !strcmp(argv[1], "-h"))
usage(index_pack_usage);
- prefix = setup_git_directory_gently(&nongit);
+ read_replace_refs = 0;
+
git_config(git_index_pack_config, NULL);
if (prefix && chdir(prefix))
die("Cannot come back to cwd");
diff --cc cache.h
index eb77e1df48814b92e76436ca3184319147192f7d,f9e82a8acea5a607e3c65e9d702de9117b42b520..733d4d1c81fe47bb2fa68aa3a76bade464de3051
+++ b/cache.h
char *alias_lookup(const char *alias);
int split_cmdline(char *cmdline, const char ***argv);
+/* Takes a negative value returned by split_cmdline */
+const char *split_cmdline_strerror(int cmdline_errno);
+ /* git.c */
+ struct startup_info {
+ int have_repository;
+ };
+ extern struct startup_info *startup_info;
+
/* builtin/merge.c */
int checkout_fast_forward(const unsigned char *from, const unsigned char *to);
diff --cc git.c
index 12d2952e079103c87b1f176f6928de4f342de9b5,286a3595a82d33b5c3d754cf422015c867617b63..8de48107e0dced316704c1ad78569ccb9eeebb08
+++ b/git.c
{ "fsck-objects", cmd_fsck, RUN_SETUP },
{ "gc", cmd_gc, RUN_SETUP },
{ "get-tar-commit-id", cmd_get_tar_commit_id },
- { "grep", cmd_grep },
+ { "grep", cmd_grep, RUN_SETUP_GENTLY },
{ "hash-object", cmd_hash_object },
{ "help", cmd_help },
- { "index-pack", cmd_index_pack },
+ { "index-pack", cmd_index_pack, RUN_SETUP_GENTLY },
{ "init", cmd_init_db },
{ "init-db", cmd_init_db },
- { "log", cmd_log, RUN_SETUP | USE_PAGER },
+ { "log", cmd_log, RUN_SETUP },
{ "ls-files", cmd_ls_files, RUN_SETUP },
{ "ls-tree", cmd_ls_tree, RUN_SETUP },
- { "ls-remote", cmd_ls_remote },
+ { "ls-remote", cmd_ls_remote, RUN_SETUP_GENTLY },
{ "mailinfo", cmd_mailinfo },
{ "mailsplit", cmd_mailsplit },
{ "merge", cmd_merge, RUN_SETUP | NEED_WORK_TREE },
{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
{ "rm", cmd_rm, RUN_SETUP },
{ "send-pack", cmd_send_pack, RUN_SETUP },
- { "shortlog", cmd_shortlog, USE_PAGER },
+ { "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
{ "show-branch", cmd_show_branch, RUN_SETUP },
- { "show", cmd_show, RUN_SETUP | USE_PAGER },
+ { "show", cmd_show, RUN_SETUP },
{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
{ "stripspace", cmd_stripspace },
{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
{ "update-ref", cmd_update_ref, RUN_SETUP },
{ "update-server-info", cmd_update_server_info, RUN_SETUP },
{ "upload-archive", cmd_upload_archive },
- { "var", cmd_var },
+ { "var", cmd_var, RUN_SETUP_GENTLY },
{ "verify-tag", cmd_verify_tag, RUN_SETUP },
{ "version", cmd_version },
- { "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER },
+ { "whatchanged", cmd_whatchanged, RUN_SETUP },
{ "write-tree", cmd_write_tree, RUN_SETUP },
{ "verify-pack", cmd_verify_pack },
{ "show-ref", cmd_show_ref, RUN_SETUP },
diff --cc setup.c
index d19aa7d7a9633eaf8bb7d65d31bad6b67bf85ead,6ee1e28bd8650332aade03b78a2660abbde5478a..a3b76de2bb1c18e2f3b8cdf5799c3c650b16d027
+++ b/setup.c
die_errno("Cannot change to '%s/..'", cwd);
}
}
-
- inside_git_dir = 0;
- if (!work_tree_env)
- inside_work_tree = 1;
- root_len = offset_1st_component(cwd);
- git_work_tree_cfg = xstrndup(cwd, offset > root_len ? offset : root_len);
- if (check_repository_format_gently(nongit_ok))
- return NULL;
- if (offset == len)
- return NULL;
-
- /* Make "offset" point to past the '/', and add a '/' at the end */
- offset++;
- cwd[len++] = '/';
- cwd[len] = 0;
- return cwd + offset;
}
+ const char *setup_git_directory_gently(int *nongit_ok)
+ {
+ const char *prefix;
+
+ prefix = setup_git_directory_gently_1(nongit_ok);
+ if (startup_info)
+ startup_info->have_repository = !nongit_ok || !*nongit_ok;
+ return prefix;
+ }
+
int git_config_perm(const char *var, const char *value)
{
int i;