Browse Source

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
maint
Junio C Hamano 7 years ago
parent
commit
ad7d3c3b39
  1. 4
      Documentation/git-format-patch.txt
  2. 10
      builtin/log.c
  3. 1
      git-rebase--am.sh
  4. 6
      git-rebase.sh

4
Documentation/git-format-patch.txt

@ -23,6 +23,7 @@ SYNOPSIS @@ -23,6 +23,7 @@ SYNOPSIS
[(--reroll-count|-v) <n>]
[--to=<email>] [--cc=<email>]
[--[no-]cover-letter] [--quiet] [--notes[=<ref>]]
[--progress]
[<common diff options>]
[ <since> | <revision range> ]

@ -283,6 +284,9 @@ you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`. @@ -283,6 +284,9 @@ you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`.
range are always formatted as creation patches, independently
of this flag.

--progress::
Show progress reports on stderr as patches are generated.

CONFIGURATION
-------------
You can specify extra mail header lines to be added to each message,

10
builtin/log.c

@ -27,6 +27,7 @@ @@ -27,6 +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;
@ -1422,6 +1423,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) @@ -1422,6 +1423,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
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 +1496,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) @@ -1493,6 +1496,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
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 +1757,12 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) @@ -1752,8 +1757,12 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
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 +1827,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) @@ -1818,6 +1827,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
if (!use_stdout)
fclose(rev.diffopt.file);
}
stop_progress(&progress);
free(list);
free(branch_name);
string_list_clear(&extra_to, 0);

1
git-rebase--am.sh

@ -53,6 +53,7 @@ else @@ -53,6 +53,7 @@ else

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=$?

6
git-rebase.sh

@ -74,6 +74,7 @@ test "$(git config --bool rebase.stat)" = true && diffstat=t @@ -74,6 +74,7 @@ test "$(git config --bool rebase.stat)" = true && diffstat=t
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 +446,11 @@ else @@ -445,6 +446,11 @@ else
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

Loading…
Cancel
Save