Skip to content

Commit 27d3603

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent b04672f commit 27d3603

3 files changed

Lines changed: 68 additions & 11 deletions

File tree

src/subcommand/add_subcommand.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ add_subcommand::add_subcommand(const libgit2_object&, CLI::App& app)
1111

1212
sub->add_option("<files>", m_add_files, "Files to add content from.");
1313

14-
sub->add_flag("-A,--all,--no-ignore-removal", m_all_flag, "Update the index not only where the working tree has a file matching <pathspec> but also where the index already has an entry. This adds, modifies, and removes index entries to match the working tree.\n\nIf no <pathspec> is given when -A option is used, all files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories).");
14+
sub->add_flag(
15+
"-A,--all,--no-ignore-removal",
16+
m_all_flag,
17+
"Update the index not only where the working tree has a file matching <pathspec> but also where the index already has an entry. This adds, modifies, and removes index entries to match the working tree.\n\nIf no <pathspec> is given when -A option is used, all files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories)."
18+
);
1519
// sub->add_flag("-n,--dryrun", dryrun_flag, "");
1620
// sub->add_flag("-u,--update", update_flag, "");
1721
// sub->add_flag("-v,--verbose", verbose_flag, "");

src/subcommand/reset_subcommand.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,28 @@ reset_subcommand::reset_subcommand(const libgit2_object&, CLI::App& app)
1818

1919
sub->add_option("<commit>", m_commit, "The ID of the commit that will become HEAD");
2020

21-
sub->add_flag("--soft", m_soft_flag, "Leave your working tree files and the index unchanged. For example, if you have no staged changes, you can use" + ansi_code::bold + "git reset --soft HEAD~5" + ansi_code::reset + "; " + ansi_code::bold + "git commit" + ansi_code::reset + " to combine the last 5 commits into 1 commit. This works even with changes in the working tree, which are left untouched, but such usage can lead to confusion.");
22-
sub->add_flag("--mixed", m_mixed_flag, "Leave your working directory unchanged. Update the index to match the new HEAD, so nothing will be staged.");
23-
sub->add_flag("--hard", m_hard_flag, "Overwrite all files and directories with the version from " + ansi_code::bold + "<commit>" + ansi_code::reset + ", and may overwrite untracked files. Tracked files not in " + ansi_code::bold + "<commit>" + ansi_code::reset + " are removed so that the working tree matches " + ansi_code::bold + "<commit>" + ansi_code::reset + ". Update the index to match the new HEAD, so nothing will be staged.");
21+
sub->add_flag(
22+
"--soft",
23+
m_soft_flag,
24+
"Leave your working tree files and the index unchanged. For example, if you have no staged changes, you can use"
25+
+ ansi_code::bold + "git reset --soft HEAD~5" + ansi_code::reset + "; " + ansi_code::bold
26+
+ "git commit" + ansi_code::reset
27+
+ " to combine the last 5 commits into 1 commit. This works even with changes in the working tree, which are left untouched, but such usage can lead to confusion."
28+
);
29+
sub->add_flag(
30+
"--mixed",
31+
m_mixed_flag,
32+
"Leave your working directory unchanged. Update the index to match the new HEAD, so nothing will be staged."
33+
);
34+
sub->add_flag(
35+
"--hard",
36+
m_hard_flag,
37+
"Overwrite all files and directories with the version from " + ansi_code::bold + "<commit>"
38+
+ ansi_code::reset + ", and may overwrite untracked files. Tracked files not in "
39+
+ ansi_code::bold + "<commit>" + ansi_code::reset
40+
+ " are removed so that the working tree matches " + ansi_code::bold + "<commit>"
41+
+ ansi_code::reset + ". Update the index to match the new HEAD, so nothing will be staged."
42+
);
2443

2544
sub->callback(
2645
[this]()

src/subcommand/stash_subcommand.cpp

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,49 @@ bool has_subcommand(CLI::App* cmd)
2727
stash_subcommand::stash_subcommand(const libgit2_object&, CLI::App& app)
2828
{
2929
auto* stash = app.add_subcommand("stash", "Stash the changes in a dirty working directory away\n");
30-
auto* push = stash->add_subcommand("push", "Save your local modifications to a new stash entry and roll them back to " + ansi_code::bold + "HEAD " + ansi_code::reset + "(in the working tree and in the index). The <message> part is optional and gives the description along with the stashed state.\n");
31-
auto* list = stash->add_subcommand("list", "List the stash entries that you currently have. Each stash entry is listed with its name (e.g. " + ansi_code::bold + "stash@" + ansi_code::reset + "{0} is the latest entry, " + ansi_code::bold + "stash@" + ansi_code::reset + "{1} is the one before, etc.), the name of the branch that was current when the entry was made, and a short description of the commit the entry was based on.\n"); //TODO: check if shows all of that
32-
auto* pop = stash->add_subcommand("pop", "Remove a single stashed state from the stash list and apply it on top of the current working tree state, i.e., do the inverse operation of " + ansi_code::bold + "git stash push.\n" + ansi_code::reset);
33-
auto* apply = stash->add_subcommand("apply", "Like " + ansi_code::bold + "pop" + ansi_code::reset + ", but do not remove the state from the stash list. Unlike " + ansi_code::bold + "pop" + ansi_code::reset + ", <stash> may be any commit that looks like a commit created by " + ansi_code::bold + "stash push" + ansi_code::reset + " or " + ".\n"); //TODO: add when "create" is implemented: ansi_code::bold + "stash create" + ansi_code::reset +
34-
auto* show = stash->add_subcommand("show", "Show the changes recorded in the stash entry as a diff between the stashed contents and the commit back when the stash entry was first created.\n");
30+
auto* push = stash->add_subcommand(
31+
"push",
32+
"Save your local modifications to a new stash entry and roll them back to " + ansi_code::bold
33+
+ "HEAD " + ansi_code::reset
34+
+ "(in the working tree and in the index). The <message> part is optional and gives the description along with the stashed state.\n"
35+
);
36+
auto* list = stash->add_subcommand(
37+
"list",
38+
"List the stash entries that you currently have. Each stash entry is listed with its name (e.g. "
39+
+ ansi_code::bold + "stash@" + ansi_code::reset + "{0} is the latest entry, " + ansi_code::bold
40+
+ "stash@" + ansi_code::reset
41+
+ "{1} is the one before, etc.), the name of the branch that was current when the entry was made, and a short description of the commit the entry was based on.\n"
42+
); // TODO: check if shows all of that
43+
auto* pop = stash->add_subcommand(
44+
"pop",
45+
"Remove a single stashed state from the stash list and apply it on top of the current working tree state, i.e., do the inverse operation of "
46+
+ ansi_code::bold + "git stash push.\n" + ansi_code::reset
47+
);
48+
auto* apply = stash->add_subcommand(
49+
"apply",
50+
"Like " + ansi_code::bold + "pop" + ansi_code::reset
51+
+ ", but do not remove the state from the stash list. Unlike " + ansi_code::bold + "pop"
52+
+ ansi_code::reset + ", <stash> may be any commit that looks like a commit created by "
53+
+ ansi_code::bold + "stash push" + ansi_code::reset + " or " + ".\n"
54+
); // TODO: add when "create" is implemented: ansi_code::bold + "stash create" + ansi_code::reset +
55+
auto* show = stash->add_subcommand(
56+
"show",
57+
"Show the changes recorded in the stash entry as a diff between the stashed contents and the commit back when the stash entry was first created.\n"
58+
);
3559

3660
push->add_option("-m,--message", m_message, "");
37-
pop->add_option("--index", m_index, "This option is only valid for " + ansi_code::bold + "pop" + ansi_code::reset + " and " + ansi_code::bold + "apply" + ansi_code::reset + " commands.\n");
38-
apply->add_option("--index", m_index, "This option is only valid for " + ansi_code::bold + "pop" + ansi_code::reset + " and " + ansi_code::bold + "apply" + ansi_code::reset + " commands.\n");
61+
pop->add_option(
62+
"--index",
63+
m_index,
64+
"This option is only valid for " + ansi_code::bold + "pop" + ansi_code::reset + " and "
65+
+ ansi_code::bold + "apply" + ansi_code::reset + " commands.\n"
66+
);
67+
apply->add_option(
68+
"--index",
69+
m_index,
70+
"This option is only valid for " + ansi_code::bold + "pop" + ansi_code::reset + " and "
71+
+ ansi_code::bold + "apply" + ansi_code::reset + " commands.\n"
72+
);
3973
show->add_flag("--stat", m_stat_flag, "Generate a diffstat\n");
4074
show->add_flag("--shortstat", m_shortstat_flag, "Output only the last line of --stat\n");
4175
show->add_flag("--numstat", m_numstat_flag, "Machine-friendly --stat\n");

0 commit comments

Comments
 (0)