From: Junio C Hamano Date: Wed, 14 Jan 2009 07:09:09 +0000 (-0800) Subject: Merge branch 'mh/cherry-default' X-Git-Tag: v1.6.2-rc0~169 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7a4566befef02b99aad3038f116b3ac24c4eb464?ds=inline;hp=-c Merge branch 'mh/cherry-default' * mh/cherry-default: Documentation: clarify which parameters are optional to git-cherry git-cherry: make parameter optional --- 7a4566befef02b99aad3038f116b3ac24c4eb464 diff --combined builtin-log.c index 4a02ee987a,7e9616e5e7..c1e2c6a4c5 --- a/builtin-log.c +++ b/builtin-log.c @@@ -16,6 -16,7 +16,7 @@@ #include "patch-ids.h" #include "run-command.h" #include "shortlog.h" + #include "remote.h" /* Set a default date-time format for git log ("log.date" config variable) */ static const char *default_date_mode = NULL; @@@ -249,13 -250,22 +250,13 @@@ int cmd_whatchanged(int argc, const cha static void show_tagger(char *buf, int len, struct rev_info *rev) { - char *email_end, *p; - unsigned long date; - int tz; + struct strbuf out = STRBUF_INIT; - email_end = memchr(buf, '>', len); - if (!email_end) - return; - p = ++email_end; - while (isspace(*p)) - p++; - date = strtoul(p, &p, 10); - while (isspace(*p)) - p++; - tz = (int)strtol(p, NULL, 10); - printf("Tagger: %.*s\nDate: %s\n", (int)(email_end - buf), buf, - show_date(date, tz, rev->date_mode)); + pp_user_info("Tagger", rev->commit_format, &out, buf, rev->date_mode, + git_log_output_encoding ? + git_log_output_encoding: git_commit_encoding); + printf("%s\n", out.buf); + strbuf_release(&out); } static int show_object(const unsigned char *sha1, int show_tag_object, @@@ -815,7 -825,7 +816,7 @@@ int cmd_format_patch(int argc, const ch committer = git_committer_info(IDENT_ERROR_ON_NO_NAME); endpos = strchr(committer, '>'); if (!endpos) - die("bogus committer info %s\n", committer); + die("bogus committer info %s", committer); add_signoff = xmemdupz(committer, endpos - committer + 1); } else if (!strcmp(argv[i], "--attach")) { @@@ -1061,13 -1071,14 +1062,14 @@@ static int add_pending_commit(const cha } static const char cherry_usage[] = - "git cherry [-v] [] []"; + "git cherry [-v] [ [ []]]"; int cmd_cherry(int argc, const char **argv, const char *prefix) { struct rev_info revs; struct patch_ids ids; struct commit *commit; struct commit_list *list = NULL; + struct branch *current_branch; const char *upstream; const char *head = "HEAD"; const char *limit = NULL; @@@ -1090,7 -1101,17 +1092,17 @@@ upstream = argv[1]; break; default: - usage(cherry_usage); + current_branch = branch_get(NULL); + if (!current_branch || !current_branch->merge + || !current_branch->merge[0] + || !current_branch->merge[0]->dst) { + fprintf(stderr, "Could not find a tracked" + " remote branch, please" + " specify manually.\n"); + usage(cherry_usage); + } + + upstream = current_branch->merge[0]->dst; } init_revisions(&revs, prefix);