summaryrefslogtreecommitdiff
path: root/t/t0027-auto-crlf.sh
diff options
context:
space:
mode:
authorLibravatar Jacob Keller <jacob.keller@gmail.com>2020-10-01 14:46:53 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-10-01 15:22:10 -0700
commit7efba5fa39fa1608fccea51a849b36b0f85825bb (patch)
treefe40b85fef64486d6c70d994ddcc0abc68630ca5 /t/t0027-auto-crlf.sh
parentSeventeenth batch (diff)
downloadtgif-7efba5fa39fa1608fccea51a849b36b0f85825bb.tar.xz
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 't/t0027-auto-crlf.sh')
0 files changed, 0 insertions, 0 deletions