Teach/Fix pull/fetch -q/-v options
Implement git-pull --quiet and git-pull --verbose by adding the options to git-pull and fixing verbosity handling in git-fetch. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
a0d3ab9c27
commit
7f87aff22c
@ -50,6 +50,7 @@ static unsigned char head[20], stash[20];
|
||||
static struct strategy **use_strategies;
|
||||
static size_t use_strategies_nr, use_strategies_alloc;
|
||||
static const char *branch;
|
||||
static int verbosity;
|
||||
|
||||
static struct strategy all_strategy[] = {
|
||||
{ "recursive", DEFAULT_TWOHEAD | NO_TRIVIAL },
|
||||
@ -171,6 +172,7 @@ static struct option builtin_merge_options[] = {
|
||||
OPT_CALLBACK('m', "message", &merge_msg, "message",
|
||||
"message to be used for the merge commit (if any)",
|
||||
option_parse_message),
|
||||
OPT__VERBOSITY(&verbosity),
|
||||
OPT_END()
|
||||
};
|
||||
|
||||
@ -250,7 +252,8 @@ static void restore_state(void)
|
||||
/* This is called when no merge was necessary. */
|
||||
static void finish_up_to_date(const char *msg)
|
||||
{
|
||||
printf("%s%s\n", squash ? " (nothing to squash)" : "", msg);
|
||||
if (verbosity >= 0)
|
||||
printf("%s%s\n", squash ? " (nothing to squash)" : "", msg);
|
||||
drop_save();
|
||||
}
|
||||
|
||||
@ -331,14 +334,15 @@ static void finish(const unsigned char *new_head, const char *msg)
|
||||
if (!msg)
|
||||
strbuf_addstr(&reflog_message, getenv("GIT_REFLOG_ACTION"));
|
||||
else {
|
||||
printf("%s\n", msg);
|
||||
if (verbosity >= 0)
|
||||
printf("%s\n", msg);
|
||||
strbuf_addf(&reflog_message, "%s: %s",
|
||||
getenv("GIT_REFLOG_ACTION"), msg);
|
||||
}
|
||||
if (squash) {
|
||||
squash_message();
|
||||
} else {
|
||||
if (!merge_msg.len)
|
||||
if (verbosity >= 0 && !merge_msg.len)
|
||||
printf("No merge message -- not updating HEAD\n");
|
||||
else {
|
||||
const char *argv_gc_auto[] = { "gc", "--auto", NULL };
|
||||
@ -872,6 +876,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
|
||||
argc = parse_options(argc, argv, builtin_merge_options,
|
||||
builtin_merge_usage, 0);
|
||||
if (verbosity < 0)
|
||||
show_diffstat = 0;
|
||||
|
||||
if (squash) {
|
||||
if (!allow_fast_forward)
|
||||
@ -1013,10 +1019,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
|
||||
strcpy(hex, find_unique_abbrev(head, DEFAULT_ABBREV));
|
||||
|
||||
printf("Updating %s..%s\n",
|
||||
hex,
|
||||
find_unique_abbrev(remoteheads->item->object.sha1,
|
||||
DEFAULT_ABBREV));
|
||||
if (verbosity >= 0)
|
||||
printf("Updating %s..%s\n",
|
||||
hex,
|
||||
find_unique_abbrev(remoteheads->item->object.sha1,
|
||||
DEFAULT_ABBREV));
|
||||
strbuf_addstr(&msg, "Fast forward");
|
||||
if (have_message)
|
||||
strbuf_addstr(&msg,
|
||||
|
Reference in New Issue
Block a user