Upstream: https://anonscm.debian.org/cgit/collab-maint/tardiff.git/tree/debian/patches/fix-unique-uniquebase.diff

Patch to allow to compare to tar balls with the same base
directory. Also fixes an issue with listing a directory as present in
the wrong tar ball.

Author: Axel Beckert <abe@debian.org>

Index: tardiff
===================================================================
--- tardiff	2005-05-17 14:52:27.000000000 +0200
+++ tardiff	2011-12-01 21:56:59.000000000 +0100
@@ -80,6 +80,7 @@
 sub analyzetar{
 	my $filelist = shift(@_);
 	my $filehash = shift(@_);
+	my $tarball = shift(@_);
 
 	my %files = %{$filehash};
 
@@ -92,12 +93,12 @@
 		if(!$uniquebase){
 			$uniquebase = $base;
 		}else{
-			($base eq $uniquebase) or die "$tarball1 contains different base dirs: $base and $uniquebase";
+			($base eq $uniquebase) or die "$tarball contains different base dirs: $base and $uniquebase";
 		}
 		if($files{$remainder}){
 			$files{$remainder} = "__both";
 		}else{
-			$files{$remainder} = "$uniquebase";
+			$files{$remainder} = "$tarball";
 		}
 	}
 
@@ -174,8 +175,8 @@
 
 	my %files;
 
-	my ($base1, %files) = analyzetar($filelist1, \%files);
-	my ($base2, %files) = analyzetar($filelist2, \%files);
+	my ($base1, %files) = analyzetar($filelist1, \%files, $tarball1);
+	my ($base2, %files) = analyzetar($filelist2, \%files, $tarball2);
 
 	foreach my $file(sort(keys(%files))){
 		next if $file eq "";
@@ -196,9 +197,9 @@
 			if($opt_list and not $modified){
 				print "  $file\n";
 			}
-		}elsif($base eq $base1){
+		}elsif($base eq $tarball1){
 			print "- $file\n";
-		}elsif($base eq $base2){
+		}elsif($base eq $tarball2){
 			print "+ $file\n";
 		}else{
 			print "? $file\n";
