diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/apply.c | 1 | ||||
-rw-r--r-- | builtin/blame.c | 18 | ||||
-rw-r--r-- | builtin/cat-file.c | 2 | ||||
-rw-r--r-- | builtin/checkout.c | 3 | ||||
-rw-r--r-- | builtin/config.c | 12 | ||||
-rw-r--r-- | builtin/diff.c | 11 | ||||
-rw-r--r-- | builtin/fetch-pack.c | 20 | ||||
-rw-r--r-- | builtin/for-each-ref.c | 4 | ||||
-rw-r--r-- | builtin/grep.c | 112 | ||||
-rw-r--r-- | builtin/log.c | 22 | ||||
-rw-r--r-- | builtin/mailinfo.c | 28 | ||||
-rw-r--r-- | builtin/merge.c | 3 | ||||
-rw-r--r-- | builtin/prune.c | 3 | ||||
-rw-r--r-- | builtin/push.c | 29 | ||||
-rw-r--r-- | builtin/receive-pack.c | 9 | ||||
-rw-r--r-- | builtin/revert.c | 2 | ||||
-rw-r--r-- | builtin/send-pack.c | 15 |
17 files changed, 178 insertions, 116 deletions
diff --git a/builtin/apply.c b/builtin/apply.c index 0ab81e3435..537d33b061 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -188,7 +188,6 @@ struct patch { int is_new, is_delete; /* -1 = unknown, 0 = false, 1 = true */ int rejected; unsigned ws_rule; - unsigned long deflate_origlen; int lines_added, lines_deleted; int score; unsigned int is_toplevel_relative:1; diff --git a/builtin/blame.c b/builtin/blame.c index c0c99c3b41..0e102bf2c2 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -110,6 +110,7 @@ static int diff_hunks(mmfile_t *file_a, mmfile_t *file_b, long ctxlen, int textconv_object(const char *path, unsigned mode, const unsigned char *sha1, + int sha1_valid, char **buf, unsigned long *buf_size) { @@ -117,7 +118,7 @@ int textconv_object(const char *path, struct userdiff_driver *textconv; df = alloc_filespec(path); - fill_filespec(df, sha1, mode); + fill_filespec(df, sha1, sha1_valid, mode); textconv = get_textconv(df); if (!textconv) { free_filespec(df); @@ -142,7 +143,7 @@ static void fill_origin_blob(struct diff_options *opt, num_read_blob++; if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV) && - textconv_object(o->path, o->mode, o->blob_sha1, &file->ptr, &file_size)) + textconv_object(o->path, o->mode, o->blob_sha1, 1, &file->ptr, &file_size)) ; else file->ptr = read_sha1_file(o->blob_sha1, &type, &file_size); @@ -406,8 +407,7 @@ static struct origin *find_origin(struct scoreboard *sb, paths[1] = NULL; diff_tree_setup_paths(paths, &diff_opts); - if (diff_setup_done(&diff_opts) < 0) - die("diff-setup"); + diff_setup_done(&diff_opts); if (is_null_sha1(origin->commit->object.sha1)) do_diff_cache(parent->tree->object.sha1, &diff_opts); @@ -493,8 +493,7 @@ static struct origin *find_rename(struct scoreboard *sb, diff_opts.single_follow = origin->path; paths[0] = NULL; diff_tree_setup_paths(paths, &diff_opts); - if (diff_setup_done(&diff_opts) < 0) - die("diff-setup"); + diff_setup_done(&diff_opts); if (is_null_sha1(origin->commit->object.sha1)) do_diff_cache(parent->tree->object.sha1, &diff_opts); @@ -1074,8 +1073,7 @@ static int find_copy_in_parent(struct scoreboard *sb, paths[0] = NULL; diff_tree_setup_paths(paths, &diff_opts); - if (diff_setup_done(&diff_opts) < 0) - die("diff-setup"); + diff_setup_done(&diff_opts); /* Try "find copies harder" on new path if requested; * we do not want to use diffcore_rename() actually to @@ -2123,7 +2121,7 @@ static struct commit *fake_working_tree_commit(struct diff_options *opt, switch (st.st_mode & S_IFMT) { case S_IFREG: if (DIFF_OPT_TST(opt, ALLOW_TEXTCONV) && - textconv_object(read_from, mode, null_sha1, &buf_ptr, &buf_len)) + textconv_object(read_from, mode, null_sha1, 0, &buf_ptr, &buf_len)) strbuf_attach(&buf, buf_ptr, buf_len, buf_len + 1); else if (strbuf_read_file(&buf, read_from, st.st_size) != st.st_size) die_errno("cannot open or read '%s'", read_from); @@ -2516,7 +2514,7 @@ parse_done: die("no such path %s in %s", path, final_commit_name); if (DIFF_OPT_TST(&sb.revs->diffopt, ALLOW_TEXTCONV) && - textconv_object(path, o->mode, o->blob_sha1, (char **) &sb.final_buf, + textconv_object(path, o->mode, o->blob_sha1, 1, (char **) &sb.final_buf, &sb.final_buf_size)) ; else diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 512072a008..00528ddc38 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -146,7 +146,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name) die("git cat-file --textconv %s: <object> must be <sha1:path>", obj_name); - if (!textconv_object(obj_context.path, obj_context.mode, sha1, &buf, &size)) + if (!textconv_object(obj_context.path, obj_context.mode, sha1, 1, &buf, &size)) die("git cat-file --textconv: unable to run textconv on %s", obj_name); break; diff --git a/builtin/checkout.c b/builtin/checkout.c index 9f6dbe6198..d287ee6e48 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -316,8 +316,7 @@ static void show_local_changes(struct object *head, struct diff_options *opts) init_revisions(&rev, NULL); rev.diffopt.flags = opts->flags; rev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS; - if (diff_setup_done(&rev.diffopt) < 0) - die(_("diff_setup_done failed")); + diff_setup_done(&rev.diffopt); add_pending_object(&rev, head, NULL); run_diff_index(&rev, 0); } diff --git a/builtin/config.c b/builtin/config.c index 31e1354937..e1c33e0691 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -160,7 +160,7 @@ static int show_config(const char *key_, const char *value_, void *cb) static int get_value(const char *key_, const char *regex_) { - int ret = -1; + int ret = CONFIG_GENERIC_ERROR; char *global = NULL, *xdg = NULL, *repo_config = NULL; const char *system_wide = NULL, *local; struct config_include_data inc = CONFIG_INCLUDE_INIT; @@ -196,11 +196,14 @@ static int get_value(const char *key_, const char *regex_) if (regcomp(key_regexp, key, REG_EXTENDED)) { fprintf(stderr, "Invalid key pattern: %s\n", key_); free(key); + ret = CONFIG_INVALID_PATTERN; goto free_strings; } } else { - if (git_config_parse_key(key_, &key, NULL)) + if (git_config_parse_key(key_, &key, NULL)) { + ret = CONFIG_INVALID_KEY; goto free_strings; + } } if (regex_) { @@ -212,6 +215,7 @@ static int get_value(const char *key_, const char *regex_) regexp = (regex_t*)xmalloc(sizeof(regex_t)); if (regcomp(regexp, regex_, REG_EXTENDED)) { fprintf(stderr, "Invalid pattern: %s\n", regex_); + ret = CONFIG_INVALID_PATTERN; goto free_strings; } } @@ -396,8 +400,8 @@ int cmd_config(int argc, const char **argv, const char *prefix) */ die("$HOME not set"); - if (access(user_config, R_OK) && - xdg_config && !access(xdg_config, R_OK)) + if (access_or_warn(user_config, R_OK) && + xdg_config && !access_or_warn(xdg_config, R_OK)) given_config_file = xdg_config; else given_config_file = user_config; diff --git a/builtin/diff.c b/builtin/diff.c index da8f6aac2b..9650be2c50 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -29,6 +29,8 @@ static void stuff_change(struct diff_options *opt, unsigned old_mode, unsigned new_mode, const unsigned char *old_sha1, const unsigned char *new_sha1, + int old_sha1_valid, + int new_sha1_valid, const char *old_name, const char *new_name) { @@ -54,8 +56,8 @@ static void stuff_change(struct diff_options *opt, one = alloc_filespec(old_name); two = alloc_filespec(new_name); - fill_filespec(one, old_sha1, old_mode); - fill_filespec(two, new_sha1, new_mode); + fill_filespec(one, old_sha1, old_sha1_valid, old_mode); + fill_filespec(two, new_sha1, new_sha1_valid, new_mode); diff_queue(&diff_queued_diff, one, two); } @@ -84,6 +86,7 @@ static int builtin_diff_b_f(struct rev_info *revs, stuff_change(&revs->diffopt, blob[0].mode, canon_mode(st.st_mode), blob[0].sha1, null_sha1, + 1, 0, path, path); diffcore_std(&revs->diffopt); diff_flush(&revs->diffopt); @@ -108,6 +111,7 @@ static int builtin_diff_blobs(struct rev_info *revs, stuff_change(&revs->diffopt, blob[0].mode, blob[1].mode, blob[0].sha1, blob[1].sha1, + 1, 1, blob[0].name, blob[1].name); diffcore_std(&revs->diffopt); diff_flush(&revs->diffopt); @@ -298,8 +302,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix) argc = setup_revisions(argc, argv, &rev, NULL); if (!rev.diffopt.output_format) { rev.diffopt.output_format = DIFF_FORMAT_PATCH; - if (diff_setup_done(&rev.diffopt) < 0) - die(_("diff_setup_done failed")); + diff_setup_done(&rev.diffopt); } DIFF_OPT_SET(&rev.diffopt, RECURSIVE); diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 149db88726..fdda36f149 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -10,6 +10,7 @@ #include "remote.h" #include "run-command.h" #include "transport.h" +#include "version.h" static int transfer_unpack_limit = -1; static int fetch_unpack_limit = -1; @@ -18,6 +19,7 @@ static int prefer_ofs_delta = 1; static int no_done; static int fetch_fsck_objects = -1; static int transfer_fsck_objects = -1; +static int agent_supported; static struct fetch_pack_args args = { /* .uploadpack = */ "git-upload-pack", }; @@ -327,6 +329,8 @@ static int find_common(int fd[2], unsigned char *result_sha1, if (args.no_progress) strbuf_addstr(&c, " no-progress"); if (args.include_tag) strbuf_addstr(&c, " include-tag"); if (prefer_ofs_delta) strbuf_addstr(&c, " ofs-delta"); + if (agent_supported) strbuf_addf(&c, " agent=%s", + git_user_agent_sanitized()); packet_buf_write(&req_buf, "want %s%s\n", remote_hex, c.buf); strbuf_release(&c); } else @@ -783,6 +787,8 @@ static struct ref *do_fetch_pack(int fd[2], { struct ref *ref = copy_ref_list(orig_ref); unsigned char sha1[20]; + const char *agent_feature; + int agent_len; sort_ref_list(&ref, ref_compare_name); @@ -814,11 +820,25 @@ static struct ref *do_fetch_pack(int fd[2], fprintf(stderr, "Server supports side-band\n"); use_sideband = 1; } + if (!server_supports("thin-pack")) + args.use_thin_pack = 0; + if (!server_supports("no-progress")) + args.no_progress = 0; + if (!server_supports("include-tag")) + args.include_tag = 0; if (server_supports("ofs-delta")) { if (args.verbose) fprintf(stderr, "Server supports ofs-delta\n"); } else prefer_ofs_delta = 0; + + if ((agent_feature = server_feature_value("agent", &agent_len))) { + agent_supported = 1; + if (args.verbose && agent_len) + fprintf(stderr, "Server version is %.*s\n", + agent_len, agent_feature); + } + if (everything_local(&ref, nr_match, match)) { packet_flush(fd[1]); goto all_done; diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index afe83b9843..7f059c31df 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -962,7 +962,9 @@ static int opt_parse_sort(const struct option *opt, const char *arg, int unset) if (!arg) /* should --no-sort void the list ? */ return -1; - *sort_tail = s = xcalloc(1, sizeof(*s)); + s = xcalloc(1, sizeof(*s)); + s->next = *sort_tail; + *sort_tail = s; if (*arg == '-') { s->reverse = 1; diff --git a/builtin/grep.c b/builtin/grep.c index c9a65b372a..09ca4c980e 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -260,6 +260,53 @@ static int wait_all(void) } #endif +static int parse_pattern_type_arg(const char *opt, const char *arg) +{ + if (!strcmp(arg, "default")) + return GREP_PATTERN_TYPE_UNSPECIFIED; + else if (!strcmp(arg, "basic")) + return GREP_PATTERN_TYPE_BRE; + else if (!strcmp(arg, "extended")) + return GREP_PATTERN_TYPE_ERE; + else if (!strcmp(arg, "fixed")) + return GREP_PATTERN_TYPE_FIXED; + else if (!strcmp(arg, "perl")) + return GREP_PATTERN_TYPE_PCRE; + die("bad %s argument: %s", opt, arg); +} + +static void grep_pattern_type_options(const int pattern_type, struct grep_opt *opt) +{ + switch (pattern_type) { + case GREP_PATTERN_TYPE_UNSPECIFIED: + /* fall through */ + + case GREP_PATTERN_TYPE_BRE: + opt->fixed = 0; + opt->pcre = 0; + opt->regflags &= ~REG_EXTENDED; + break; + + case GREP_PATTERN_TYPE_ERE: + opt->fixed = 0; + opt->pcre = 0; + opt->regflags |= REG_EXTENDED; + break; + + case GREP_PATTERN_TYPE_FIXED: + opt->fixed = 1; + opt->pcre = 0; + opt->regflags &= ~REG_EXTENDED; + break; + + case GREP_PATTERN_TYPE_PCRE: + opt->fixed = 0; + opt->pcre = 1; + opt->regflags &= ~REG_EXTENDED; + break; + } +} + static int grep_config(const char *var, const char *value, void *cb) { struct grep_opt *opt = cb; @@ -270,12 +317,17 @@ static int grep_config(const char *var, const char *value, void *cb) if (!strcmp(var, "grep.extendedregexp")) { if (git_config_bool(var, value)) - opt->regflags |= REG_EXTENDED; + opt->extended_regexp_option = 1; else - opt->regflags &= ~REG_EXTENDED; + opt->extended_regexp_option = 0; return 0; } + if (!strcmp(var, "grep.patterntype")) { + opt->pattern_type_option = parse_pattern_type_arg(var, value); + return 0; + } + if (!strcmp(var, "grep.linenumber")) { opt->linenum = git_config_bool(var, value); return 0; @@ -669,14 +721,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) int i; int dummy; int use_index = 1; - enum { - pattern_type_unspecified = 0, - pattern_type_bre, - pattern_type_ere, - pattern_type_fixed, - pattern_type_pcre, - }; - int pattern_type = pattern_type_unspecified; + int pattern_type_arg = GREP_PATTERN_TYPE_UNSPECIFIED; struct option options[] = { OPT_BOOLEAN(0, "cached", &cached, @@ -703,18 +748,18 @@ int cmd_grep(int argc, const char **argv, const char *prefix) N_("descend at most <depth> levels"), PARSE_OPT_NONEG, NULL, 1 }, OPT_GROUP(""), - OPT_SET_INT('E', "extended-regexp", &pattern_type, + OPT_SET_INT('E', "extended-regexp", &pattern_type_arg, N_("use extended POSIX regular expressions"), - pattern_type_ere), - OPT_SET_INT('G', "basic-regexp", &pattern_type, + GREP_PATTERN_TYPE_ERE), + OPT_SET_INT('G', "basic-regexp", &pattern_type_arg, N_("use basic POSIX regular expressions (default)"), - pattern_type_bre), - OPT_SET_INT('F', "fixed-strings", &pattern_type, + GREP_PATTERN_TYPE_BRE), + OPT_SET_INT('F', "fixed-strings", &pattern_type_arg, N_("interpret patterns as fixed strings"), - pattern_type_fixed), - OPT_SET_INT('P', "perl-regexp", &pattern_type, + GREP_PATTERN_TYPE_FIXED), + OPT_SET_INT('P', "perl-regexp", &pattern_type_arg, N_("use Perl-compatible regular expressions"), - pattern_type_pcre), + GREP_PATTERN_TYPE_PCRE), OPT_GROUP(""), OPT_BOOLEAN('n', "line-number", &opt.linenum, N_("show line numbers")), OPT_NEGBIT('h', NULL, &opt.pathname, N_("don't show filenames"), 1), @@ -799,6 +844,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix) opt.header_tail = &opt.header_list; opt.regflags = REG_NEWLINE; opt.max_depth = -1; + opt.pattern_type_option = GREP_PATTERN_TYPE_UNSPECIFIED; + opt.extended_regexp_option = 0; strcpy(opt.color_context, ""); strcpy(opt.color_filename, ""); @@ -824,28 +871,13 @@ int cmd_grep(int argc, const char **argv, const char *prefix) PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_STOP_AT_NON_OPTION | PARSE_OPT_NO_INTERNAL_HELP); - switch (pattern_type) { - case pattern_type_fixed: - opt.fixed = 1; - opt.pcre = 0; - break; - case pattern_type_bre: - opt.fixed = 0; - opt.pcre = 0; - opt.regflags &= ~REG_EXTENDED; - break; - case pattern_type_ere: - opt.fixed = 0; - opt.pcre = 0; - opt.regflags |= REG_EXTENDED; - break; - case pattern_type_pcre: - opt.fixed = 0; - opt.pcre = 1; - break; - default: - break; /* nothing */ - } + + if (pattern_type_arg != GREP_PATTERN_TYPE_UNSPECIFIED) + grep_pattern_type_options(pattern_type_arg, &opt); + else if (opt.pattern_type_option != GREP_PATTERN_TYPE_UNSPECIFIED) + grep_pattern_type_options(opt.pattern_type_option, &opt); + else if (opt.extended_regexp_option) + grep_pattern_type_options(GREP_PATTERN_TYPE_ERE, &opt); if (use_index && !startup_info->have_repository) /* die the same way as if we did it at the beginning */ diff --git a/builtin/log.c b/builtin/log.c index 1ff2d8d162..d76f359440 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -696,7 +696,7 @@ static int reopen_stdout(struct commit *commit, const char *subject, return 0; } -static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const char *prefix) +static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids) { struct rev_info check_rev; struct commit *commit; @@ -717,7 +717,8 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha init_patch_ids(ids); /* given a range a..b get all patch ids for b..a */ - init_revisions(&check_rev, prefix); + init_revisions(&check_rev, rev->prefix); + check_rev.max_parents = 1; o1->flags ^= UNINTERESTING; o2->flags ^= UNINTERESTING; add_pending_object(&check_rev, o1, "o1"); @@ -726,10 +727,6 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha die(_("revision walk setup failed")); while ((commit = get_revision(&check_rev)) != NULL) { - /* ignore merges */ - if (commit->parents && commit->parents->next) - continue; - add_commit_patch_id(commit, ids); } @@ -1306,7 +1303,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0) return 0; } - get_patch_ids(&rev, &ids, prefix); + get_patch_ids(&rev, &ids); } if (!use_stdout) @@ -1508,10 +1505,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) } init_revisions(&revs, prefix); - revs.diff = 1; - revs.combine_merges = 0; - revs.ignore_merges = 1; - DIFF_OPT_SET(&revs.diffopt, RECURSIVE); + revs.max_parents = 1; if (add_pending_commit(head, &revs, 0)) die(_("Unknown commit %s"), head); @@ -1525,7 +1519,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) return 0; } - get_patch_ids(&revs, &ids, prefix); + get_patch_ids(&revs, &ids); if (limit && add_pending_commit(limit, &revs, UNINTERESTING)) die(_("Unknown commit %s"), limit); @@ -1534,10 +1528,6 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) if (prepare_revision_walk(&revs)) die(_("revision walk setup failed")); while ((commit = get_revision(&revs)) != NULL) { - /* ignore merges */ - if (commit->parents && commit->parents->next) - continue; - commit_list_insert(commit, &list); } diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index eaf9e157a3..dd4f925475 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -481,36 +481,12 @@ static struct strbuf *decode_b_segment(const struct strbuf *b_seg) return out; } -/* - * When there is no known charset, guess. - * - * Right now we assume that if the target is UTF-8 (the default), - * and it already looks like UTF-8 (which includes US-ASCII as its - * subset, of course) then that is what it is and there is nothing - * to do. - * - * Otherwise, we default to assuming it is Latin1 for historical - * reasons. - */ -static const char *guess_charset(const struct strbuf *line, const char *target_charset) -{ - if (is_encoding_utf8(target_charset)) { - if (is_utf8(line->buf)) - return NULL; - } - return "ISO8859-1"; -} - static void convert_to_utf8(struct strbuf *line, const char *charset) { char *out; - if (!charset || !*charset) { - charset = guess_charset(line, metainfo_charset); - if (!charset) - return; - } - + if (!charset || !*charset) + return; if (!strcasecmp(metainfo_charset, charset)) return; out = reencode_string(line->buf, metainfo_charset, charset); diff --git a/builtin/merge.c b/builtin/merge.c index e9871ab96b..0ec8f0d449 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -404,8 +404,7 @@ static void finish(struct commit *head_commit, opts.output_format |= DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT; opts.detect_rename = DIFF_DETECT_RENAME; - if (diff_setup_done(&opts) < 0) - die(_("diff_setup_done failed")); + diff_setup_done(&opts); diff_tree_sha1(head, new_head, "", &opts); diffcore_std(&opts); diff_flush(&opts); diff --git a/builtin/prune.c b/builtin/prune.c index a9e2241a02..9a03d24dad 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -25,7 +25,8 @@ static int prune_tmp_object(const char *path, const char *filename) return error("Could not stat '%s'", fullpath); if (st.st_mtime > expire) return 0; - printf("Removing stale temporary file %s\n", fullpath); + if (show_only || verbose) + printf("Removing stale temporary file %s\n", fullpath); if (!show_only) unlink_or_warn(fullpath); return 0; diff --git a/builtin/push.c b/builtin/push.c index 8686a7a777..db9ba30b08 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -147,12 +147,37 @@ static void setup_push_upstream(struct remote *remote, int simple) add_refspec(refspec.buf); } +static char warn_unspecified_push_default_msg[] = +N_("push.default is unset; its implicit value is changing in\n" + "Git 2.0 from 'matching' to 'simple'. To squelch this message\n" + "and maintain the current behavior after the default changes, use:\n" + "\n" + " git config --global push.default matching\n" + "\n" + "To squelch this message and adopt the new behavior now, use:\n" + "\n" + " git config --global push.default simple\n" + "\n" + "See 'git help config' and search for 'push.default' for further information.\n" + "(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode\n" + "'current' instead of 'simple' if you sometimes use older versions of Git)"); + +static void warn_unspecified_push_default_configuration(void) +{ + static int warn_once; + + if (warn_once++) + return; + warning("%s\n", _(warn_unspecified_push_default_msg)); +} + static void setup_default_push_refspecs(struct remote *remote) { switch (push_default) { default: case PUSH_DEFAULT_UNSPECIFIED: default_matching_used = 1; + warn_unspecified_push_default_configuration(); /* fallthru */ case PUSH_DEFAULT_MATCHING: add_refspec(":"); @@ -186,8 +211,8 @@ static const char message_advice_pull_before_push[] = static const char message_advice_use_upstream[] = N_("Updates were rejected because a pushed branch tip is behind its remote\n" "counterpart. If you did not intend to push that branch, you may want to\n" - "specify branches to push or set the 'push.default' configuration\n" - "variable to 'current' or 'upstream' to push only the current branch."); + "specify branches to push or set the 'push.default' configuration variable\n" + "to 'simple', 'current' or 'upstream' to push only the current branch."); static const char message_advice_checkout_pull_push[] = N_("Updates were rejected because a pushed branch tip is behind its remote\n" diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 0afb8b2896..2cb854feb4 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -12,6 +12,7 @@ #include "string-list.h" #include "sha1-array.h" #include "connected.h" +#include "version.h" static const char receive_pack_usage[] = "git receive-pack <git-dir>"; @@ -121,10 +122,11 @@ static void show_ref(const char *path, const unsigned char *sha1) if (sent_capabilities) packet_write(1, "%s %s\n", sha1_to_hex(sha1), path); else - packet_write(1, "%s %s%c%s%s\n", + packet_write(1, "%s %s%c%s%s agent=%s\n", sha1_to_hex(sha1), path, 0, " report-status delete-refs side-band-64k quiet", - prefer_ofs_delta ? " ofs-delta" : ""); + prefer_ofs_delta ? " ofs-delta" : "", + git_user_agent_sanitized()); sent_capabilities = 1; } @@ -977,7 +979,8 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix) const char *argv_gc_auto[] = { "gc", "--auto", "--quiet", NULL, }; - run_command_v_opt(argv_gc_auto, RUN_GIT_CMD); + int opt = RUN_GIT_CMD | RUN_COMMAND_STDOUT_TO_STDERR; + run_command_v_opt(argv_gc_auto, opt); } if (auto_update_server_info) update_server_info(0); diff --git a/builtin/revert.c b/builtin/revert.c index 02ca95f4fe..17dc8c8d1e 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -117,6 +117,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_END(), OPT_END(), OPT_END(), + OPT_END(), }; if (opts->action == REPLAY_PICK) { @@ -124,6 +125,7 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) OPT_BOOLEAN('x', NULL, &opts->record_origin, N_("append commit name")), OPT_BOOLEAN(0, "ff", &opts->allow_ff, N_("allow fast-forward")), OPT_BOOLEAN(0, "allow-empty", &opts->allow_empty, N_("preserve initially empty commits")), + OPT_BOOLEAN(0, "allow-empty-message", &opts->allow_empty_message, N_("allow commits with empty messages")), OPT_BOOLEAN(0, "keep-redundant-commits", &opts->keep_redundant_commits, N_("keep redundant, empty commits")), OPT_END(), }; diff --git a/builtin/send-pack.c b/builtin/send-pack.c index d5d7105ba2..7d05064218 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -8,6 +8,7 @@ #include "send-pack.h" #include "quote.h" #include "transport.h" +#include "version.h" static const char send_pack_usage[] = "git send-pack [--all | --mirror] [--dry-run] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]\n" @@ -251,6 +252,7 @@ int send_pack(struct send_pack_args *args, int status_report = 0; int use_sideband = 0; int quiet_supported = 0; + int agent_supported = 0; unsigned cmds_sent = 0; int ret; struct async demux; @@ -266,6 +268,8 @@ int send_pack(struct send_pack_args *args, use_sideband = 1; if (server_supports("quiet")) quiet_supported = 1; + if (server_supports("agent")) + agent_supported = 1; if (!remote_refs) { fprintf(stderr, "No refs in common and none specified; doing nothing.\n" @@ -305,12 +309,17 @@ int send_pack(struct send_pack_args *args, char *new_hex = sha1_to_hex(ref->new_sha1); int quiet = quiet_supported && (args->quiet || !args->progress); - if (!cmds_sent && (status_report || use_sideband || args->quiet)) { - packet_buf_write(&req_buf, "%s %s %s%c%s%s%s", + if (!cmds_sent && (status_report || use_sideband || + quiet || agent_supported)) { + packet_buf_write(&req_buf, + "%s %s %s%c%s%s%s%s%s", old_hex, new_hex, ref->name, 0, status_report ? " report-status" : "", use_sideband ? " side-band-64k" : "", - quiet ? " quiet" : ""); + quiet ? " quiet" : "", + agent_supported ? " agent=" : "", + agent_supported ? git_user_agent_sanitized() : "" + ); } else packet_buf_write(&req_buf, "%s %s %s", |