diff options
author | Chris Torek <chris.torek@gmail.com> | 2020-06-12 16:19:59 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-06-12 10:53:44 -0700 |
commit | 8bfcb3a690126e6222f0d4f7012b0f68bb748018 (patch) | |
tree | 23e39a459c38a0cc16a14c17ba87836bc5079f98 /t/t2018-checkout-branch.sh | |
parent | t/t3430: avoid undefined git diff behavior (diff) | |
download | tgif-8bfcb3a690126e6222f0d4f7012b0f68bb748018.tar.xz |
git diff: improve range handling
When git diff is given a symmetric difference A...B, it chooses
some merge base from the two specified commits (as documented).
This fails, however, if there is *no* merge base: instead, you
see the differences between A and B, which is certainly not what
is expected.
Moreover, if additional revisions are specified on the command
line ("git diff A...B C"), the results get a bit weird:
* If there is a symmetric difference merge base, this is used
as the left side of the diff. The last final ref is used as
the right side.
* If there is no merge base, the symmetric status is completely
lost. We will produce a combined diff instead.
Similar weirdness occurs if you use, e.g., "git diff C A...B D".
Likewise, using multiple two-dot ranges, or tossing extra
revision specifiers into the command line with two-dot ranges,
or mixing two and three dot ranges, all produce nonsense.
To avoid all this, add a routine to catch the range cases and
verify that that the arguments make sense. As a side effect,
produce a warning showing *which* merge base is being used when
there are multiple choices; die if there is no merge base.
Signed-off-by: Chris Torek <chris.torek@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2018-checkout-branch.sh')
0 files changed, 0 insertions, 0 deletions