From: Junio C Hamano Date: Wed, 23 Aug 2017 21:13:07 +0000 (-0700) Subject: Merge branch 'kw/rebase-progress' X-Git-Tag: v2.15.0-rc0~151 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ad7d3c3b391b73207fbb29da99d4f64ad0c54f00?hp=-c Merge branch 'kw/rebase-progress' "git rebase", especially when it is run by mistake and ends up trying to replay many changes, spent long time in silence. The command has been taught to show progress report when it spends long time preparing these many changes to replay (which would give the user a chance to abort with ^C). * kw/rebase-progress: rebase: turn on progress option by default for format-patch format-patch: have progress option while generating patches --- ad7d3c3b391b73207fbb29da99d4f64ad0c54f00 diff --combined builtin/log.c index 25c8241092,54b94107e5..25c0808409 --- a/builtin/log.c +++ b/builtin/log.c @@@ -27,6 -27,7 +27,7 @@@ #include "version.h" #include "mailmap.h" #include "gpg-interface.h" + #include "progress.h" /* Set a default date-time format for git log ("log.date" config variable) */ static const char *default_date_mode = NULL; @@@ -58,9 -59,9 +59,9 @@@ static int auto_decoration_style(void return (isatty(1) || pager_in_use()) ? DECORATE_SHORT_REFS : 0; } -static int parse_decoration_style(const char *var, const char *value) +static int parse_decoration_style(const char *value) { - switch (git_config_maybe_bool(var, value)) { + switch (git_parse_maybe_bool(value)) { case 1: return DECORATE_SHORT_REFS; case 0: @@@ -82,7 -83,7 +83,7 @@@ static int decorate_callback(const stru if (unset) decoration_style = 0; else if (arg) - decoration_style = parse_decoration_style("command line", arg); + decoration_style = parse_decoration_style(arg); else decoration_style = DECORATE_SHORT_REFS; @@@ -372,14 -373,11 +373,14 @@@ static int cmd_log_walk(struct rev_inf */ rev->max_count++; if (!rev->reflog_info) { - /* we allow cycles in reflog ancestry */ + /* + * We may show a given commit multiple times when + * walking the reflogs. + */ free_commit_buffer(commit); + free_commit_list(commit->parents); + commit->parents = NULL; } - free_commit_list(commit->parents); - commit->parents = NULL; if (saved_nrl < rev->diffopt.needed_rename_limit) saved_nrl = rev->diffopt.needed_rename_limit; if (rev->diffopt.degraded_cc_to_c) @@@ -412,7 -410,7 +413,7 @@@ static int git_log_config(const char *v if (!strcmp(var, "log.date")) return git_config_string(&default_date_mode, var, value); if (!strcmp(var, "log.decorate")) { - decoration_style = parse_decoration_style(var, value); + decoration_style = parse_decoration_style(value); if (decoration_style < 0) decoration_style = 0; /* maybe warn? */ return 0; @@@ -487,8 -485,8 +488,8 @@@ static int show_blob_object(const struc !DIFF_OPT_TST(&rev->diffopt, ALLOW_TEXTCONV)) return stream_blob_to_fd(1, oid, NULL, 0); - if (get_sha1_with_context(obj_name, GET_SHA1_RECORD_PATH, - oidc.hash, &obj_context)) + if (get_oid_with_context(obj_name, GET_OID_RECORD_PATH, + &oidc, &obj_context)) die(_("Not a valid object name %s"), obj_name); if (!obj_context.path || !textconv_object(obj_context.path, obj_context.mode, &oidc, 1, &buf, &size)) { @@@ -824,7 -822,7 +825,7 @@@ static int git_format_config(const cha return 0; } if (!strcmp(var, "format.from")) { - int b = git_config_maybe_bool(var, value); + int b = git_parse_maybe_bool(value); free(from); if (b < 0) from = xstrdup(value); @@@ -1422,6 -1420,8 +1423,8 @@@ int cmd_format_patch(int argc, const ch char *branch_name = NULL; char *base_commit = NULL; struct base_tree_info bases; + int show_progress = 0; + struct progress *progress = NULL; const struct option builtin_format_patch_options[] = { { OPTION_CALLBACK, 'n', "numbered", &numbered, NULL, @@@ -1493,6 -1493,8 +1496,8 @@@ OPT_FILENAME(0, "signature-file", &signature_file, N_("add a signature from a file")), OPT__QUIET(&quiet, N_("don't print the patch filenames")), + OPT_BOOL(0, "progress", &show_progress, + N_("show progress while generating patches")), OPT_END() }; @@@ -1752,8 -1754,12 +1757,12 @@@ start_number--; } rev.add_signoff = do_signoff; + + if (show_progress) + progress = start_progress_delay(_("Generating patches"), total, 0, 2); while (0 <= --nr) { int shown; + display_progress(progress, total - nr); commit = list[nr]; rev.nr = total - nr + (start_number - 1); /* Make the second and subsequent mails replies to the first */ @@@ -1818,6 -1824,7 +1827,7 @@@ if (!use_stdout) fclose(rev.diffopt.file); } + stop_progress(&progress); free(list); free(branch_name); string_list_clear(&extra_to, 0); diff --combined git-rebase--am.sh index 319933e70a,ff98fe3a73..6e64d40d6f --- a/git-rebase--am.sh +++ b/git-rebase--am.sh @@@ -45,7 -45,7 +45,7 @@@ the # itself well to recording empty patches. fortunately, cherry-pick # makes this easy git cherry-pick ${gpg_sign_opt:+"$gpg_sign_opt"} --allow-empty \ - --right-only "$revisions" \ + $allow_rerere_autoupdate --right-only "$revisions" \ ${restrict_revision+^$restrict_revision} ret=$? else @@@ -53,6 -53,7 +53,7 @@@ git format-patch -k --stdout --full-index --cherry-pick --right-only \ --src-prefix=a/ --dst-prefix=b/ --no-renames --no-cover-letter \ + $git_format_patch_opt \ "$revisions" ${restrict_revision+^$restrict_revision} \ >"$GIT_DIR/rebased-patches" ret=$? @@@ -82,7 -83,6 +83,7 @@@ fi git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" \ + $allow_rerere_autoupdate \ ${gpg_sign_opt:+"$gpg_sign_opt"} <"$GIT_DIR/rebased-patches" ret=$? diff --combined git-rebase.sh index f8b3d1fd97,06f5082dc3..ad8415e3cf --- a/git-rebase.sh +++ b/git-rebase.sh @@@ -55,10 -55,9 +55,10 @@@ LF= ' ok_to_skip_pre_rebase= resolvemsg=" -$(gettext 'When you have resolved this problem, run "git rebase --continue". -If you prefer to skip this patch, run "git rebase --skip" instead. -To check out the original branch and stop rebasing, run "git rebase --abort".') +$(gettext 'Resolve all conflicts manually, mark them as resolved with +"git add/rm ", then run "git rebase --continue". +You can instead skip this commit: run "git rebase --skip". +To abort and get back to the state before "git rebase", run "git rebase --abort".') " unset onto unset restrict_revision @@@ -74,6 -73,7 +74,7 @@@ test "$(git config --bool rebase.stat) autostash="$(git config --bool rebase.autostash || echo false)" fork_point=auto git_am_opt= + git_format_patch_opt= rebase_root= force_rebase= allow_rerere_autoupdate= @@@ -445,6 -445,11 +446,11 @@@ els state_dir="$apply_dir" fi + if test -t 2 && test -z "$GIT_QUIET" + then + git_format_patch_opt="$git_format_patch_opt --progress" + fi + if test -z "$rebase_root" then case "$#" in