From: Junio C Hamano Date: Wed, 18 Aug 2010 19:47:04 +0000 (-0700) Subject: Merge branch 'tf/string-list-init' X-Git-Tag: v1.7.3-rc0~63 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6b5005c88b3a0c360249deb8ca8b92201abaa824?ds=inline;hp=-c Merge branch 'tf/string-list-init' * tf/string-list-init: string_list: Add STRING_LIST_INIT macro and make use of it. --- 6b5005c88b3a0c360249deb8ca8b92201abaa824 diff --combined builtin/fetch.c index 680a8a97bd,88ff3575f8..ea14d5dc6b --- a/builtin/fetch.c +++ b/builtin/fetch.c @@@ -548,8 -548,8 +548,8 @@@ static void find_non_local_tags(struct struct ref **head, struct ref ***tail) { - struct string_list existing_refs = { NULL, 0, 0, 0 }; - struct string_list remote_refs = { NULL, 0, 0, 0 }; + struct string_list existing_refs = STRING_LIST_INIT_NODUP; + struct string_list remote_refs = STRING_LIST_INIT_NODUP; const struct ref *ref; struct string_list_item *item = NULL; @@@ -651,7 -651,7 +651,7 @@@ static int truncate_fetch_head(void static int do_fetch(struct transport *transport, struct refspec *refs, int ref_count) { - struct string_list existing_refs = { NULL, 0, 0, 0 }; + struct string_list existing_refs = STRING_LIST_INIT_NODUP; struct string_list_item *peer_item = NULL; struct ref *ref_map; struct ref *rm; @@@ -829,8 -829,7 +829,8 @@@ static int fetch_one(struct remote *rem int exit_code; if (!remote) - die("Where do you want to fetch from today?"); + die("No remote repository specified. Please, specify either a URL or a\n" + "remote name from which new revisions should be fetched."); transport = transport_get(remote, NULL); transport_set_verbosity(transport, verbosity, progress); @@@ -875,7 -874,7 +875,7 @@@ int cmd_fetch(int argc, const char **argv, const char *prefix) { int i; - struct string_list list = { NULL, 0, 0, 0 }; + struct string_list list = STRING_LIST_INIT_NODUP; struct remote *remote; int result = 0; diff --combined builtin/grep.c index 597f76bc42,103f64a210..cf6c29fa42 --- a/builtin/grep.c +++ b/builtin/grep.c @@@ -836,7 -836,7 +836,7 @@@ int cmd_grep(int argc, const char **arg struct grep_opt opt; struct object_array list = { 0, 0, NULL }; 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; @@@ -1001,7 -1001,6 +1001,7 @@@ if (show_in_pager == default_pager) show_in_pager = git_pager(1); if (show_in_pager) { + opt.color = 0; opt.name_only = 1; opt.null_following_name = 1; opt.output_priv = &path_list; diff --combined builtin/rerere.c index 39ad60169d,3c8e45843e..9b1e3a7cf5 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@@ -40,7 -40,7 +40,7 @@@ static int git_rerere_gc_config(const c static void garbage_collect(struct string_list *rr) { - struct string_list to_remove = { NULL, 0, 0, 1 }; + struct string_list to_remove = STRING_LIST_INIT_DUP; DIR *dir; struct dirent *e; int i, cutoff; @@@ -102,7 -102,7 +102,7 @@@ static int diff_two(const char *file1, int cmd_rerere(int argc, const char **argv, const char *prefix) { - struct string_list merge_rr = { NULL, 0, 0, 1 }; + struct string_list merge_rr = STRING_LIST_INIT_DUP; int i, fd, flags = 0; if (2 < argc) { @@@ -135,7 -135,7 +135,7 @@@ if (!has_rerere_resolution(name)) unlink_rr_item(name); } - unlink_or_warn(git_path("rr-cache/MERGE_RR")); + unlink_or_warn(git_path("MERGE_RR")); } else if (!strcmp(argv[1], "gc")) garbage_collect(&merge_rr); else if (!strcmp(argv[1], "status")) diff --combined merge-recursive.c index 7635659969,1c065d306f..6cff9cdc86 --- a/merge-recursive.c +++ b/merge-recursive.c @@@ -136,10 -136,16 +136,10 @@@ static void output_commit_title(struct if (parse_commit(commit) != 0) printf("(bad commit)\n"); else { - const char *s; - int len; - for (s = commit->buffer; *s; s++) - if (*s == '\n' && s[1] == '\n') { - s += 2; - break; - } - for (len = 0; s[len] && '\n' != s[len]; len++) - ; /* do nothing */ - printf("%.*s\n", len, s); + const char *title; + int len = find_commit_subject(commit->buffer, &title); + if (len) + printf("%.*s\n", len, title); } } } @@@ -800,7 -806,8 +800,8 @@@ static int process_renames(struct merge struct string_list *b_renames) { int clean_merge = 1, i, j; - struct string_list a_by_dst = {NULL, 0, 0, 0}, b_by_dst = {NULL, 0, 0, 0}; + struct string_list a_by_dst = STRING_LIST_INIT_NODUP; + struct string_list b_by_dst = STRING_LIST_INIT_NODUP; const struct rename *sre; for (i = 0; i < a_renames->nr; i++) { @@@ -1208,7 -1215,7 +1209,7 @@@ int merge_trees(struct merge_options *o } if (sha_eq(common->object.sha1, merge->object.sha1)) { - output(o, 0, "Already uptodate!"); + output(o, 0, "Already up-to-date!"); *result = head; return 1; }