From: Junio C Hamano Date: Sun, 22 Aug 2010 06:28:55 +0000 (-0700) Subject: Merge branch 'gb/split-cmdline-errmsg' X-Git-Tag: v1.7.3-rc0~47 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b95d0a2f8cb2923fed417e649a66c7372b968248?hp=-c Merge branch 'gb/split-cmdline-errmsg' * gb/split-cmdline-errmsg: split_cmdline: Allow caller to access error string --- b95d0a2f8cb2923fed417e649a66c7372b968248 diff --combined builtin/merge.c index 1bcf7fd9d5,b48826372f..47e705ba9b --- a/builtin/merge.c +++ b/builtin/merge.c @@@ -486,7 -486,8 +486,8 @@@ static int git_merge_config(const char buf = xstrdup(v); argc = split_cmdline(buf, &argv); if (argc < 0) - die("Bad branch.%s.mergeoptions string", branch); + die("Bad branch.%s.mergeoptions string: %s", branch, + split_cmdline_strerror(argc)); argv = xrealloc(argv, sizeof(*argv) * (argc + 2)); memmove(argv + 1, argv, sizeof(*argv) * (argc + 1)); argc++; @@@ -704,8 -705,7 +705,8 @@@ int checkout_fast_forward(const unsigne opts.verbose_update = 1; opts.merge = 1; opts.fn = twoway_merge; - opts.msgs = get_porcelain_error_msgs(); + opts.show_all_errors = 1; + set_porcelain_error_msgs(opts.msgs, "merge"); trees[nr_trees] = parse_tree_indirect(head); if (!trees[nr_trees++]) diff --combined cache.h index 61a563150f,7466ad04fa..eb77e1df48 --- a/cache.h +++ b/cache.h @@@ -179,7 -179,8 +179,7 @@@ struct cache_entry #define CE_UNHASHED (0x200000) #define CE_CONFLICTED (0x800000) -/* Only remove in work directory, not index */ -#define CE_WT_REMOVE (0x400000) +#define CE_WT_REMOVE (0x400000) /* remove in work directory */ #define CE_UNPACKED (0x1000000) @@@ -448,7 -449,7 +448,7 @@@ extern int init_db(const char *template alloc = alloc_nr(alloc); \ x = xrealloc((x), alloc * sizeof(*(x))); \ } \ - } while(0) + } while (0) /* Initialize and use the cache information */ extern int read_index(struct index_state *); @@@ -640,9 -641,6 +640,9 @@@ extern char *git_pathdup(const char *fm /* Return a statically allocated filename matching the sha1 signature */ extern char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2))); extern char *git_path(const char *fmt, ...) __attribute__((format (printf, 1, 2))); +extern char *git_path_submodule(const char *path, const char *fmt, ...) + __attribute__((format (printf, 2, 3))); + extern char *sha1_file_name(const unsigned char *sha1); extern char *sha1_pack_name(const unsigned char *sha1); extern char *sha1_pack_index_name(const unsigned char *sha1); @@@ -813,7 -811,6 +813,7 @@@ const char *show_date_relative(unsigne char *timebuf, size_t timebuf_size); int parse_date(const char *date, char *buf, int bufsize); +int parse_date_basic(const char *date, unsigned long *timestamp, int *offset); void datestamp(char *buf, int bufsize); #define approxidate(s) approxidate_careful((s), NULL) unsigned long approxidate_careful(const char *, int *); @@@ -1099,6 -1096,8 +1099,8 @@@ void overlay_tree_on_cache(const char * 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); /* builtin/merge.c */ int checkout_fast_forward(const unsigned char *from, const unsigned char *to); diff --combined git.c index f37028b3b7,da56f31a67..6fc07a568d --- a/git.c +++ b/git.c @@@ -8,8 -8,8 +8,8 @@@ const char git_usage_string[] "git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]\n" " [-p|--paginate|--no-pager] [--no-replace-objects]\n" " [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]\n" - " [-c name=value\n" - " [--help] COMMAND [ARGS]"; + " [-c name=value] [--help]\n" + " COMMAND [ARGS]"; const char git_more_info_string[] = "See 'git help COMMAND' for more information on a specific command."; @@@ -188,7 -188,8 +188,8 @@@ static int handle_alias(int *argcp, con } count = split_cmdline(alias_string, &new_argv); if (count < 0) - die("Bad alias.%s string", alias_command); + die("Bad alias.%s string: %s", alias_command, + split_cmdline_strerror(count)); option_count = handle_options(&new_argv, &count, &envchanged); if (envchanged) die("alias '%s' changes environment variables\n"