Re: [PATCH 2/3 v3] git-svn info: implement info command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"David D. Kilzer" <ddkilzer@xxxxxxxxxx> wrote:
> Implement "git-svn info" for files and directories based on the
> "svn info" command.  Note that the -r/--revision argument is not
> supported yet.
> 
> Added 18 tests in t/t9119-git-svn-info.sh.

Eric Wong <normalperson@xxxxxxxx> wrote:
> I'm having a problem with [2/3] currently:
> 
> $file_type not being detected correctly when running "git svn info"
> on the top-level directory with no arguments.  It's opening the
> directory and trying to md5 it here:
> 
> 		} else {
> 			open FILE, "<", $path or die $!;
> 			$checksum = Git::SVN::Util::md5sum(\*FILE);
> 			close FILE or die $!;
> 		}
> 
>

When running from a top-level directory with no arguments, the first
line of git-ls-tree was being read.  This allowed the test case to pass
because ls-tree sorts the output and 'directory' just happened to
be up top; so we were getting the 040000 mode from the 'directory'
tree and not the top-level tree.

The below test should fix it for the trivial case I have.

diff --git a/git-svn.perl b/git-svn.perl
index 62801c8..7d86870 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1165,6 +1165,7 @@ sub linearize_history {
 
 sub find_file_type_and_diff_status {
 	my ($path) = @_;
+	return ('dir', '') if $path eq '.';
 
 	my $diff_output =
 	    command_oneline(qw(diff --cached --name-status --), $path) || "";
diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh
index e81457f..439bd93 100644
--- a/t/t9119-git-svn-info.sh
+++ b/t/t9119-git-svn-info.sh
@@ -19,6 +19,7 @@ ptouch() {
 test_expect_success 'setup repository and import' "
 	mkdir info &&
 	cd info &&
+		echo FIRST > A &&
 		echo one > file &&
 		ln -s file symlink-file &&
 		mkdir directory &&

-- 
Eric Wong
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux