From: Junio C Hamano Date: Wed, 24 Nov 2010 23:55:19 +0000 (-0800) Subject: Merge branch 'rs/opt-help-text' X-Git-Tag: v1.7.4-rc0~120 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/20f84c8f56519b49fa91bb6cef8f8978c2ab4e09?hp=-c Merge branch 'rs/opt-help-text' * rs/opt-help-text: verify-tag: document --verbose branch: improve --verbose description archive: improve --verbose description Describe various forms of "be quiet" using OPT__QUIET add OPT__FORCE add description parameter to OPT__QUIET add description parameter to OPT__DRY_RUN add description parameter to OPT__VERBOSE --- 20f84c8f56519b49fa91bb6cef8f8978c2ab4e09 diff --combined builtin/apply.c index f051e66dcc,e1e9ecc815..96246e960f --- a/builtin/apply.c +++ b/builtin/apply.c @@@ -2645,12 -2645,6 +2645,12 @@@ static int apply_binary_fragment(struc unsigned long len; void *dst; + if (!fragment) + return error("missing binary patch data for '%s'", + patch->new_name ? + patch->new_name : + patch->old_name); + /* Binary patch is irreversible without the optional second hunk */ if (apply_in_reverse) { if (!fragment->next) @@@ -3849,7 -3843,7 +3849,7 @@@ int cmd_apply(int argc, const char **ar "don't expect at least one line of context"), OPT_BOOLEAN(0, "reject", &apply_with_reject, "leave the rejected hunks in corresponding *.rej files"), - OPT__VERBOSE(&apply_verbosely), + OPT__VERBOSE(&apply_verbosely, "be verbose"), OPT_BIT(0, "inaccurate-eof", &options, "tolerate incorrectly detected missing new-line at the end of file", INACCURATE_EOF), diff --combined builtin/checkout.c index 1fa9ce43f5,f9114de9a4..757f9a08dd --- a/builtin/checkout.c +++ b/builtin/checkout.c @@@ -686,7 -686,7 +686,7 @@@ int cmd_checkout(int argc, const char * int patch_mode = 0; int dwim_new_local_branch = 1; struct option options[] = { - OPT__QUIET(&opts.quiet), + OPT__QUIET(&opts.quiet, "suppress progress reporting"), OPT_STRING('b', NULL, &opts.new_branch, "branch", "create and checkout a new branch"), OPT_STRING('B', NULL, &opts.new_branch_force, "branch", @@@ -699,7 -699,7 +699,7 @@@ 2), OPT_SET_INT('3', "theirs", &opts.writeout_stage, "checkout their version for unmerged files", 3), - OPT_BOOLEAN('f', "force", &opts.force, "force checkout (throw away local modifications)"), + OPT__FORCE(&opts.force, "force checkout (throw away local modifications)"), OPT_BOOLEAN('m', "merge", &opts.merge, "perform a 3-way merge with the new branch"), OPT_STRING(0, "conflict", &conflict_style, "style", "conflict style (merge or diff3)"), @@@ -784,9 -784,9 +784,9 @@@ * between A and B, A...B names that merge base. * * With no paths, if is _not_ a commit, no -t nor -b - * was given, and there is a tracking branch whose name is + * was given, and there is a remote-tracking branch whose name is * in one and only one remote, then this is a short-hand - * to fork local from that remote tracking branch. + * to fork local from that remote-tracking branch. * * Otherwise shall not be ambiguous. * - If it's *only* a reference, treat it like case (1). diff --combined builtin/clean.c index fb24030751,5e47c53cdb..4a312abc6b --- a/builtin/clean.c +++ b/builtin/clean.c @@@ -38,7 -38,7 +38,7 @@@ int cmd_clean(int argc, const char **ar { int i; int show_only = 0, remove_directories = 0, quiet = 0, ignored = 0; - int ignored_only = 0, baselen = 0, config_set = 0, errors = 0; + int ignored_only = 0, config_set = 0, errors = 0; int rm_flags = REMOVE_DIR_KEEP_NESTED_GIT; struct strbuf directory = STRBUF_INIT; struct dir_struct dir; @@@ -48,9 -48,9 +48,9 @@@ const char *qname; char *seen = NULL; struct option options[] = { - OPT__QUIET(&quiet), - OPT__DRY_RUN(&show_only), - OPT_BOOLEAN('f', "force", &force, "force"), + OPT__QUIET(&quiet, "do not print names of files removed"), + OPT__DRY_RUN(&show_only, "dry run"), + OPT__FORCE(&force, "force"), OPT_BOOLEAN('d', NULL, &remove_directories, "remove whole directories"), { OPTION_CALLBACK, 'e', "exclude", &exclude_list, "pattern", @@@ -138,7 -138,7 +138,7 @@@ if (pathspec) { memset(seen, 0, argc > 0 ? argc : 1); matches = match_pathspec(pathspec, ent->name, len, - baselen, seen); + 0, seen); } if (S_ISDIR(st.st_mode)) { @@@ -153,7 -153,7 +153,7 @@@ printf("Removing %s\n", qname); if (remove_dir_recursively(&directory, rm_flags) != 0) { - warning("failed to remove '%s'", qname); + warning("failed to remove %s", qname); errors++; } } else if (show_only) { @@@ -173,7 -173,7 +173,7 @@@ printf("Removing %s\n", qname); } if (unlink(ent->name) != 0) { - warning("failed to remove '%s'", qname); + warning("failed to remove %s", qname); errors++; } } diff --combined builtin/fetch.c index 4243ef0223,6aaf8e96b4..6bcce55c0c --- a/builtin/fetch.c +++ b/builtin/fetch.c @@@ -43,8 -43,7 +43,7 @@@ static struct option builtin_fetch_opti "append to .git/FETCH_HEAD instead of overwriting"), OPT_STRING(0, "upload-pack", &upload_pack, "PATH", "path to upload pack on remote end"), - OPT_BOOLEAN('f', "force", &force, - "force overwrite of local branch"), + OPT__FORCE(&force, "force overwrite of local branch"), OPT_BOOLEAN('m', "multiple", &multiple, "fetch from multiple remotes"), OPT_SET_INT('t', "tags", &tags, @@@ -52,7 -51,7 +51,7 @@@ OPT_SET_INT('n', NULL, &tags, "do not fetch all tags (--no-tags)", TAGS_UNSET), OPT_BOOLEAN('p', "prune", &prune, - "prune tracking branches no longer on remote"), + "prune remote-tracking branches no longer on remote"), OPT_BOOLEAN(0, "dry-run", &dry_run, "dry run"), OPT_BOOLEAN('k', "keep", &keep, "keep downloaded pack"), @@@ -98,7 -97,7 +97,7 @@@ static void add_merge_config(struct re continue; /* - * Not fetched to a tracking branch? We need to fetch + * Not fetched to a remote-tracking branch? We need to fetch * it anyway to allow this branch's "branch.$name.merge" * to be honored by 'git pull', but we do not have to * fail if branch.$name.merge is misconfigured to point @@@ -359,7 -358,7 +358,7 @@@ static int store_updated_refs(const cha what = rm->name + 10; } else if (!prefixcmp(rm->name, "refs/remotes/")) { - kind = "remote branch"; + kind = "remote-tracking branch"; what = rm->name + 13; } else { diff --combined builtin/merge-file.c index 6c4afb5a38,9d75ed42c2..237abd3c0b --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@@ -28,7 -28,6 +28,7 @@@ int cmd_merge_file(int argc, const cha xmparam_t xmp = {{0}}; int ret = 0, i = 0, to_stdout = 0; int quiet = 0; + int prefixlen = 0; struct option options[] = { OPT_BOOLEAN('p', "stdout", &to_stdout, "send results to standard output"), OPT_SET_INT(0, "diff3", &xmp.style, "use a diff3 based merge", XDL_MERGE_DIFF3), @@@ -40,7 -39,7 +40,7 @@@ XDL_MERGE_FAVOR_UNION), OPT_INTEGER(0, "marker-size", &xmp.marker_size, "for conflicts, use this marker size"), - OPT__QUIET(&quiet), + OPT__QUIET(&quiet, "do not warn about conflicts"), OPT_CALLBACK('L', NULL, names, "name", "set labels for file1/orig_file/file2", &label_cb), OPT_END(), @@@ -66,14 -65,10 +66,14 @@@ "%s\n", strerror(errno)); } + if (prefix) + prefixlen = strlen(prefix); + for (i = 0; i < 3; i++) { + const char *fname = prefix_filename(prefix, prefixlen, argv[i]); if (!names[i]) names[i] = argv[i]; - if (read_mmfile(mmfs + i, argv[i])) + if (read_mmfile(mmfs + i, fname)) return -1; if (buffer_is_binary(mmfs[i].ptr, mmfs[i].size)) return error("Cannot merge binary files: %s\n", diff --combined builtin/remote.c index 6a06282196,30b992275a..cb26080956 --- a/builtin/remote.c +++ b/builtin/remote.c @@@ -507,7 -507,7 +507,7 @@@ static int add_branch_for_removal(cons return 0; } - /* don't delete non-remote refs */ + /* don't delete non-remote-tracking refs */ if (prefixcmp(refname, "refs/remotes")) { /* advise user how to delete local branches */ if (!prefixcmp(refname, "refs/heads/")) @@@ -791,9 -791,9 +791,9 @@@ static int rm(int argc, const char **ar if (skipped.nr) { fprintf(stderr, skipped.nr == 1 ? - "Note: A non-remote branch was not removed; " + "Note: A branch outside the refs/remotes/ hierarchy was not removed;\n" "to delete it, use:\n" : - "Note: Non-remote branches were not removed; " + "Note: Some branches outside the refs/remotes/ hierarchy were not removed;\n" "to delete them, use:\n"); for (i = 0; i < skipped.nr; i++) fprintf(stderr, " git branch -d %s\n", @@@ -1200,7 -1200,7 +1200,7 @@@ static int prune(int argc, const char * { int dry_run = 0, result = 0; struct option options[] = { - OPT__DRY_RUN(&dry_run), + OPT__DRY_RUN(&dry_run, "dry run"), OPT_END() }; @@@ -1512,7 -1512,7 +1512,7 @@@ static int show_all(void int cmd_remote(int argc, const char **argv, const char *prefix) { struct option options[] = { - OPT_BOOLEAN('v', "verbose", &verbose, "be verbose; must be placed before a subcommand"), + OPT__VERBOSE(&verbose, "be verbose; must be placed before a subcommand"), OPT_END() }; int result;