Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-09-01 01:49:46 +0300
committerJunio C Hamano <gitster@pobox.com>2020-09-01 01:49:46 +0300
commit096c948dabc7d13a6cc81a8ad803fd96fc1c5d15 (patch)
tree485338e755482416f20097587126fcaf795ec170 /t/t4013-diff-various.sh
parent1a753720c3c416ed53e985ace9f8f1232118c516 (diff)
parent3046c7f69a6337a971b219d047b8110e3f9ea971 (diff)
Merge branch 'dd/diff-customize-index-line-abbrev'
The output from the "diff" family of the commands had abbreviated object names of blobs involved in the patch, but its length was not affected by the --abbrev option. Now it is. * dd/diff-customize-index-line-abbrev: diff: index-line: respect --abbrev in object's name t4013: improve diff-post-processor logic
Diffstat (limited to 't/t4013-diff-various.sh')
-rwxr-xr-xt/t4013-diff-various.sh63
1 files changed, 42 insertions, 21 deletions
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index 5f97dd6d65..5c7b0122b4 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -130,27 +130,45 @@ test_expect_success setup '
EOF
process_diffs () {
- _x04="[0-9a-f][0-9a-f][0-9a-f][0-9a-f]" &&
- _x07="$_x05[0-9a-f][0-9a-f]" &&
- sed -e "s/$OID_REGEX/$ZERO_OID/g" \
- -e "s/From $_x40 /From $ZERO_OID /" \
- -e "s/from $_x40)/from $ZERO_OID)/" \
- -e "s/commit $_x40\$/commit $ZERO_OID/" \
- -e "s/commit $_x40 (/commit $ZERO_OID (/" \
- -e "s/$_x40 $_x40 $_x40/$ZERO_OID $ZERO_OID $ZERO_OID/" \
- -e "s/$_x40 $_x40 /$ZERO_OID $ZERO_OID /" \
- -e "s/^$_x40 $_x40$/$ZERO_OID $ZERO_OID/" \
- -e "s/^$_x40 /$ZERO_OID /" \
- -e "s/^$_x40$/$ZERO_OID/" \
- -e "s/$_x07\.\.$_x07/fffffff..fffffff/g" \
- -e "s/$_x07,$_x07\.\.$_x07/fffffff,fffffff..fffffff/g" \
- -e "s/$_x07 $_x07 $_x07/fffffff fffffff fffffff/g" \
- -e "s/$_x07 $_x07 /fffffff fffffff /g" \
- -e "s/Merge: $_x07 $_x07/Merge: fffffff fffffff/g" \
- -e "s/$_x07\.\.\./fffffff.../g" \
- -e "s/ $_x04\.\.\./ ffff.../g" \
- -e "s/ $_x04/ ffff/g" \
- "$1"
+ perl -e '
+ my $oid_length = length($ARGV[0]);
+ my $x40 = "[0-9a-f]{40}";
+ my $xab = "[0-9a-f]{4,16}";
+ my $orx = "[0-9a-f]" x $oid_length;
+
+ sub munge_oid {
+ my ($oid) = @_;
+ my $x;
+
+ return "" unless length $oid;
+
+ if ($oid =~ /^(100644|100755|120000)$/) {
+ return $oid;
+ }
+
+ if ($oid =~ /^0*$/) {
+ $x = "0";
+ } else {
+ $x = "f";
+ }
+
+ if (length($oid) == 40) {
+ return $x x $oid_length;
+ } else {
+ return $x x length($oid);
+ }
+ }
+
+ while (<STDIN>) {
+ s/($orx)/munge_oid($1)/ge;
+ s/From ($x40)( |\))/"From " . munge_oid($1) . $2/ge;
+ s/commit ($x40)($| \(from )($x40?)/"commit " . munge_oid($1) . $2 . munge_oid($3)/ge;
+ s/\b($x40)( |\.\.|$)/munge_oid($1) . $2/ge;
+ s/^($x40)($| )/munge_oid($1) . $2/e;
+ s/($xab)(\.\.|,| |\.\.\.|$)/munge_oid($1) . $2/ge;
+ print;
+ }
+ ' "$ZERO_OID" <"$1"
}
V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
@@ -221,6 +239,9 @@ diff-tree --root -r --abbrev=4 initial
:noellipses diff-tree --root -r --abbrev=4 initial
diff-tree -p initial
diff-tree --root -p initial
+diff-tree --root -p --abbrev=10 initial
+diff-tree --root -p --full-index initial
+diff-tree --root -p --full-index --abbrev=10 initial
diff-tree --patch-with-stat initial
diff-tree --root --patch-with-stat initial
diff-tree --patch-with-raw initial