Merge branch 'rs/opt-help-text'
authorJunio C Hamano <gitster@pobox.com>
Wed, 24 Nov 2010 23:55:19 +0000 (15:55 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Nov 2010 23:55:19 +0000 (15:55 -0800)
* 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

1  2 
builtin/apply.c
builtin/checkout.c
builtin/clean.c
builtin/fetch.c
builtin/merge-file.c
builtin/remote.c
diff --combined builtin/apply.c
index f051e66dcc5260e4e7ecb28c36e2c6da8e823d6b,e1e9ecc815ad2bf2993ee3da0b6c245f0bffeb09..96246e960f9d9fb9230edc0f4e7a9a13267608f2
@@@ -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 1fa9ce43f548da542ec2e93c8d75fdd3d78131b2,f9114de9a41c73c4ce032cbbbf305a3763258cc9..757f9a08ddbaf102726a781b06d7294a4638984e
@@@ -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",
                            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)"),
         *   between A and B, A...B names that merge base.
         *
         *   With no paths, if <something> 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
         *   <something> in one and only one remote, then this is a short-hand
 -       *   to fork local <something> from that remote tracking branch.
 +       *   to fork local <something> from that remote-tracking branch.
         *
         *   Otherwise <something> shall not be ambiguous.
         *   - If it's *only* a reference, treat it like case (1).
diff --combined builtin/clean.c
index fb24030751ec5e755009a97439ffa08ff55f67d5,5e47c53cdb9c775c0de6d61421553fae9167b984..4a312abc6b3ecef5f174b2786ad31385ba058b44
@@@ -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",
                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)) {
                                        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) {
                                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 4243ef02232d977f37c34e4bd3b724469ef041a4,6aaf8e96b4b4415a909d244e200984fb586d574b..6bcce55c0cdb6686e0585bf11107559ba61a5700
@@@ -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 6c4afb5a38bc954be836c441b9b09b22ef82b132,9d75ed42c275bf292f88731021c9372ca23a8d10..237abd3c0b27b601aca140bfb67a302666ff9cf2
@@@ -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(),
                                     "%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 6a062821969d432d681cb810ae7fb775288160a2,30b992275a694562edd40b734cfdef06add145c4..cb26080956077f8c9ae02c91ffdc341293a4f9f1
@@@ -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;