Code

UI consistency: allow --force for where -f means force
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Sat, 29 Aug 2009 09:05:00 +0000 (11:05 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 29 Aug 2009 21:08:03 +0000 (14:08 -0700)
git branch, checkout, clean, mv and tag all have an option -f to override
certain checks.  This patch makes them accept the long option --force as
a synonym.

While we're at it, document that checkout support --quiet as synonym for
its short option -q.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-branch.txt
Documentation/git-checkout.txt
Documentation/git-clean.txt
Documentation/git-mv.txt
Documentation/git-tag.txt
builtin-branch.c
builtin-checkout.c
builtin-clean.c
builtin-mv.c
builtin-tag.c

index 99988872ebdcb8db895c0033f6233387dfdd3cde..aad71dc59a7c385be4f24ee9b981cd998fdd186f 100644 (file)
@@ -76,6 +76,7 @@ OPTIONS
        based sha1 expressions such as "<branchname>@\{yesterday}".
 
 -f::
        based sha1 expressions such as "<branchname>@\{yesterday}".
 
 -f::
+--force::
        Reset <branchname> to <startpoint> if <branchname> exists
        already. Without `-f` 'git-branch' refuses to change an existing branch.
 
        Reset <branchname> to <startpoint> if <branchname> exists
        already. Without `-f` 'git-branch' refuses to change an existing branch.
 
index ad4b31e89218e857001fce69f32acbe85fc7539c..b1314b561435029bb6fa468629cf71d9e3cad08a 100644 (file)
@@ -45,9 +45,11 @@ file can be discarded to recreate the original conflicted merge result.
 OPTIONS
 -------
 -q::
 OPTIONS
 -------
 -q::
+--quiet::
        Quiet, suppress feedback messages.
 
 -f::
        Quiet, suppress feedback messages.
 
 -f::
+--force::
        When switching branches, proceed even if the index or the
        working tree differs from HEAD.  This is used to throw away
        local changes.
        When switching branches, proceed even if the index or the
        working tree differs from HEAD.  This is used to throw away
        local changes.
index ae8938b2de9a5930ab18a220a6e8dd90ee6db3b1..9d291bdd266b49fe01b017dfce8e73dd288ad785 100644 (file)
@@ -32,6 +32,7 @@ OPTIONS
        if you really want to remove such a directory.
 
 -f::
        if you really want to remove such a directory.
 
 -f::
+--force::
        If the git configuration specifies clean.requireForce as true,
        'git-clean' will refuse to run unless given -f or -n.
 
        If the git configuration specifies clean.requireForce as true,
        'git-clean' will refuse to run unless given -f or -n.
 
index 9c5660275b326661bf7dc9a5162e5177b8a62b0f..bdcb58526ec2e838949e079891a420802df477db 100644 (file)
@@ -28,6 +28,7 @@ committed.
 OPTIONS
 -------
 -f::
 OPTIONS
 -------
 -f::
+--force::
        Force renaming or moving of a file even if the target exists
 -k::
         Skip move or rename actions which would lead to an error
        Force renaming or moving of a file even if the target exists
 -k::
         Skip move or rename actions which would lead to an error
index 5113eaec627940f9c4f2dd0b4396e7029e1b877e..299b04f726b2e7662fb7db64169726eec82a5c14 100644 (file)
@@ -51,6 +51,7 @@ OPTIONS
        Make a GPG-signed tag, using the given key
 
 -f::
        Make a GPG-signed tag, using the given key
 
 -f::
+--force::
        Replace an existing tag with the given name (instead of failing)
 
 -d::
        Replace an existing tag with the given name (instead of failing)
 
 -d::
index 1a03d5f356009de12364c320577e24853bec7959..9f57992062314a3d8d168b5cfb6b3c6737605033 100644 (file)
@@ -586,7 +586,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
                OPT_BIT('m', NULL, &rename, "move/rename a branch and its reflog", 1),
                OPT_BIT('M', NULL, &rename, "move/rename a branch, even if target exists", 2),
                OPT_BOOLEAN('l', NULL, &reflog, "create the branch's reflog"),
                OPT_BIT('m', NULL, &rename, "move/rename a branch and its reflog", 1),
                OPT_BIT('M', NULL, &rename, "move/rename a branch, even if target exists", 2),
                OPT_BOOLEAN('l', NULL, &reflog, "create the branch's reflog"),
-               OPT_BOOLEAN('f', NULL, &force_create, "force creation (when already exists)"),
+               OPT_BOOLEAN('f', "force", &force_create, "force creation (when already exists)"),
                {
                        OPTION_CALLBACK, 0, "no-merged", &merge_filter_ref,
                        "commit", "print only not merged branches",
                {
                        OPTION_CALLBACK, 0, "no-merged", &merge_filter_ref,
                        "commit", "print only not merged branches",
index c6d6ac99f63459094d3e1a110fed228a74f7927b..36e2116ea2020049aec660b0b10628152618c9cc 100644 (file)
@@ -584,7 +584,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
                            2),
                OPT_SET_INT('3', "theirs", &opts.writeout_stage, "stage",
                            3),
                            2),
                OPT_SET_INT('3', "theirs", &opts.writeout_stage, "stage",
                            3),
-               OPT_BOOLEAN('f', NULL, &opts.force, "force"),
+               OPT_BOOLEAN('f', "force", &opts.force, "force"),
                OPT_BOOLEAN('m', "merge", &opts.merge, "merge"),
                OPT_STRING(0, "conflict", &conflict_style, "style",
                           "conflict style (merge or diff3)"),
                OPT_BOOLEAN('m', "merge", &opts.merge, "merge"),
                OPT_STRING(0, "conflict", &conflict_style, "style",
                           "conflict style (merge or diff3)"),
index 05c763cbec61cd41bde3b424c22563c155105fd0..28cdcd0274dd5891c7ad3dc3804cb0acead883f2 100644 (file)
@@ -41,7 +41,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
        struct option options[] = {
                OPT__QUIET(&quiet),
                OPT__DRY_RUN(&show_only),
        struct option options[] = {
                OPT__QUIET(&quiet),
                OPT__DRY_RUN(&show_only),
-               OPT_BOOLEAN('f', NULL, &force, "force"),
+               OPT_BOOLEAN('f', "force", &force, "force"),
                OPT_BOOLEAN('d', NULL, &remove_directories,
                                "remove whole directories"),
                OPT_BOOLEAN('x', NULL, &ignored, "remove ignored files, too"),
                OPT_BOOLEAN('d', NULL, &remove_directories,
                                "remove whole directories"),
                OPT_BOOLEAN('x', NULL, &ignored, "remove ignored files, too"),
index b592c367b2cc016a50db6d49948e9efbbf0e8f2f..1b20028c67dec2f9954cb107620bd863b4b3a264 100644 (file)
@@ -53,7 +53,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
        int verbose = 0, show_only = 0, force = 0, ignore_errors = 0;
        struct option builtin_mv_options[] = {
                OPT__DRY_RUN(&show_only),
        int verbose = 0, show_only = 0, force = 0, ignore_errors = 0;
        struct option builtin_mv_options[] = {
                OPT__DRY_RUN(&show_only),
-               OPT_BOOLEAN('f', NULL, &force, "force move/rename even if target exists"),
+               OPT_BOOLEAN('f', "force", &force, "force move/rename even if target exists"),
                OPT_BOOLEAN('k', NULL, &ignore_errors, "skip move/rename errors"),
                OPT_END(),
        };
                OPT_BOOLEAN('k', NULL, &ignore_errors, "skip move/rename errors"),
                OPT_END(),
        };
index a51a6d1ea21412f151238e48984bc13110fcbc6c..c4790185ebb9979a6772cf7159d16c2a1deeeaf3 100644 (file)
@@ -390,7 +390,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
                OPT_BOOLEAN('s', NULL, &sign, "annotated and GPG-signed tag"),
                OPT_STRING('u', NULL, &keyid, "key-id",
                                        "use another key to sign the tag"),
                OPT_BOOLEAN('s', NULL, &sign, "annotated and GPG-signed tag"),
                OPT_STRING('u', NULL, &keyid, "key-id",
                                        "use another key to sign the tag"),
-               OPT_BOOLEAN('f', NULL, &force, "replace the tag if exists"),
+               OPT_BOOLEAN('f', "force", &force, "replace the tag if exists"),
 
                OPT_GROUP("Tag listing options"),
                {
 
                OPT_GROUP("Tag listing options"),
                {