summaryrefslogtreecommitdiff
path: root/reset.c
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2020-10-01 21:46:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-10-01 22:22:10 (GMT)
commit7efba5fa39fa1608fccea51a849b36b0f85825bb (patch)
treefe40b85fef64486d6c70d994ddcc0abc68630ca5 /reset.c
parent9bc233ae1cf19a49e51842c7959d80a675dbd1c0 (diff)
downloadgit-7efba5fa39fa1608fccea51a849b36b0f85825bb.zip
git-7efba5fa39fa1608fccea51a849b36b0f85825bb.tar.gz
git-7efba5fa39fa1608fccea51a849b36b0f85825bb.tar.bz2
format-patch: teach format.useAutoBase "whenAble" option
The format.useAutoBase configuration option exists to allow users to enable '--base=auto' for format-patch by default. This can sometimes lead to poor workflow, due to unexpected failures when attempting to format an ancient patch: $ git format-patch -1 <an old commit> fatal: base commit shouldn't be in revision list This can be very confusing, as it is not necessarily immediately obvious that the user requested a --base (since this was in the configuration, not on the command line). We do want --base=auto to fail when it cannot provide a suitable base, as it would be equally confusing if a formatted patch did not include the base information when it was requested. Teach format.useAutoBase a new mode, "whenAble". This mode will cause format-patch to attempt to include a base commit when it can. However, if no valid base commit can be found, then format-patch will continue formatting the patch without a base commit. In order to avoid making yet another branch name unusable with --base, do not teach --base=whenAble or --base=whenable. Instead, refactor the base_commit option to use a callback, and rely on the global configuration variable auto_base. This does mean that a user cannot request this optional base commit generation from the command line. However, this is likely not too valuable. If the user requests base information manually, they will be immediately informed of the failure to acquire a suitable base commit. This allows the user to make an informed choice about whether to continue the format. Add tests to cover the new mode of operation for --base. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reset.c')
0 files changed, 0 insertions, 0 deletions