{"thread":{"id":"40699","subject":"[PATCH v7] checkout: add --progress option","startedAt":"2015-11-01T21:12:44Z","lastAt":"2015-11-01T21:16:41Z","messageCount":3,"participants":["Edmundo Carmona Antoranz","Eric Sunshine"],"isPatch":true,"patchVersion":7,"patchTotal":null},"messages":[{"id":"272708","messageId":"1446412364-19377-1-git-send-email-eantoranz@gmail.com","threadId":"40699","inReplyTo":null,"subject":"[PATCH v7] checkout: add --progress option","fromName":"Edmundo Carmona Antoranz","fromEmail":"eantoranz@gmail.com","sentAt":"2015-11-01T21:12:44Z","receivedAt":"2015-11-01T21:12:44Z","isPatch":true,"sender":{"key":"eantoranz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1491018?v=4"},"body":"Under normal circumstances, and like other git commands,\ngit checkout will write progress info to stderr if\nattached to a terminal. This option allows progress\nto be forced even if not using a terminal. Also,\nprogress can be skipped if using option --no-progress.\n\nSigned-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>\n---\n Documentation/git-checkout.txt |  6 ++++++\n builtin/checkout.c             | 14 ++++++++++++--\n 2 files changed, 18 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt\nindex e269fb1..9973cf6 100644\n--- a/Documentation/git-checkout.txt\n+++ b/Documentation/git-checkout.txt\n@@ -107,6 +107,12 @@ OPTIONS\n --quiet::\n \tQuiet, suppress feedback messages.\n \n+--[no-]progress::\n+\tProgress status is reported on the standard error stream\n+\tby default when it is attached to a terminal, unless `--quiet`\n+\tis specified. This flag enables progress reporting even if not\n+\tattached to a terminal, regardless of `--quite`.\n+\n -f::\n --force::\n \tWhen switching branches, proceed even if the index or the\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex bc703c0..e346f52 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -37,6 +37,7 @@ struct checkout_opts {\n \tint overwrite_ignore;\n \tint ignore_skipworktree;\n \tint ignore_other_worktrees;\n+\tint show_progress;\n \n \tconst char *new_branch;\n \tconst char *new_branch_force;\n@@ -417,7 +418,7 @@ static int reset_tree(struct tree *tree, const struct checkout_opts *o,\n \topts.reset = 1;\n \topts.merge = 1;\n \topts.fn = oneway_merge;\n-\topts.verbose_update = !o->quiet && isatty(2);\n+\topts.verbose_update = o->show_progress;\n \topts.src_index = &the_index;\n \topts.dst_index = &the_index;\n \tparse_tree(tree);\n@@ -501,7 +502,7 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \t\ttopts.update = 1;\n \t\ttopts.merge = 1;\n \t\ttopts.gently = opts->merge && old->commit;\n-\t\ttopts.verbose_update = !opts->quiet && isatty(2);\n+\t\ttopts.verbose_update = opts->show_progress;\n \t\ttopts.fn = twoway_merge;\n \t\tif (opts->overwrite_ignore) {\n \t\t\ttopts.dir = xcalloc(1, sizeof(*topts.dir));\n@@ -1156,6 +1157,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \t\t\t\tN_(\"second guess 'git checkout <no-such-branch>'\")),\n \t\tOPT_BOOL(0, \"ignore-other-worktrees\", &opts.ignore_other_worktrees,\n \t\t\t N_(\"do not check if another worktree is holding the given ref\")),\n+\t\tOPT_BOOL(0, \"progress\", &opts.show_progress, N_(\"force progress reporting\")),\n \t\tOPT_END(),\n \t};\n \n@@ -1163,6 +1165,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \tmemset(&new, 0, sizeof(new));\n \topts.overwrite_ignore = 1;\n \topts.prefix = prefix;\n+\topts.show_progress = -1;\n \n \tgitmodules_config();\n \tgit_config(git_checkout_config, &opts);\n@@ -1172,6 +1175,13 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \targc = parse_options(argc, argv, prefix, options, checkout_usage,\n \t\t\t     PARSE_OPT_KEEP_DASHDASH);\n \n+\tif (opts.show_progress < 0) {\n+\t\tif (opts.quiet)\n+\t\t\topts.show_progress = 0;\n+\t\telse\n+\t\t\topts.show_progress = isatty(2);\n+\t}\n+\n \tif (conflict_style) {\n \t\topts.merge = 1; /* implied */\n \t\tgit_xmerge_config(\"merge.conflictstyle\", conflict_style, NULL);\n-- \n2.6.1\n"},{"id":"272710","messageId":"CAPig+cQZN_1f1wDwm7esHBhhrnQSx0eMye38Wc2ZxOjWoqjJvA@mail.gmail.com","threadId":"40699","inReplyTo":"1446412364-19377-1-git-send-email-eantoranz@gmail.com","subject":"Re: [PATCH v7] checkout: add --progress option","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-11-01T21:15:13Z","receivedAt":"2015-11-01T21:15:13Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Nov 1, 2015 at 4:12 PM, Edmundo Carmona Antoranz\n<eantoranz@gmail.com> wrote:\n> Under normal circumstances, and like other git commands,\n> git checkout will write progress info to stderr if\n> attached to a terminal. This option allows progress\n> to be forced even if not using a terminal. Also,\n> progress can be skipped if using option --no-progress.\n>\n> Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com>\n> ---\n> diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt\n> @@ -107,6 +107,12 @@ OPTIONS\n>  --quiet::\n>         Quiet, suppress feedback messages.\n>\n> +--[no-]progress::\n> +       Progress status is reported on the standard error stream\n> +       by default when it is attached to a terminal, unless `--quiet`\n> +       is specified. This flag enables progress reporting even if not\n> +       attached to a terminal, regardless of `--quite`.\n\ns/quite/quiet/\n"},{"id":"272711","messageId":"CAOc6etaC+W+qUg8VJOvCGcx2iJxw+DfzPuqxAdrTdBbs+monOw@mail.gmail.com","threadId":"40699","inReplyTo":"CAPig+cQZN_1f1wDwm7esHBhhrnQSx0eMye38Wc2ZxOjWoqjJvA@mail.gmail.com","subject":"Re: [PATCH v7] checkout: add --progress option","fromName":"Edmundo Carmona Antoranz","fromEmail":"eantoranz@gmail.com","sentAt":"2015-11-01T21:16:41Z","receivedAt":"2015-11-01T21:16:41Z","isPatch":true,"sender":{"key":"eantoranz@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1491018?v=4"},"body":"On Sun, Nov 1, 2015 at 3:15 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n>> +--[no-]progress::\n>> +       Progress status is reported on the standard error stream\n>> +       by default when it is attached to a terminal, unless `--quiet`\n>> +       is specified. This flag enables progress reporting even if not\n>> +       attached to a terminal, regardless of `--quite`.\n>\n> s/quite/quiet/\n\nhahaha. So close!!! v8 on the pipeline.\n"}]}