]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t4013-diff-various.sh
Merge branch 'hn/refs-ref-log-only-bit'
[thirdparty/git.git] / t / t4013-diff-various.sh
index 3f60f7d96ce1998cd977751158c09cadfd926d15..5c7b0122b4f194d327d488d4b5dd6b8ad28e7673 100755 (executable)
@@ -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
@@ -297,6 +318,9 @@ log --root --patch-with-stat --summary master
 log --root -c --patch-with-stat --summary master
 # improved by Timo's patch
 log --root --cc --patch-with-stat --summary master
+log --no-diff-merges -p --first-parent master
+log --diff-merges=off -p --first-parent master
+log --first-parent --diff-merges=off -p master
 log -p --first-parent master
 log -m -p --first-parent master
 log -m -p master