Re: [PATCH 2/3 v3] git-svn info: implement info command
- From
- Eric Wong <normalperson@yhbt.net>
- Date
- Nov 22, 2007, 01:40 UTC
- Message-ID
- <20071122014038.GA25341@soma>
- In-Reply-To
- <1195675039-26746-3-git-send-email-ddkilzer@kilzer.net>
"David D. Kilzer" <ddkilzer@kilzer.net> wrote:
Show 5 quoted lines
> 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@yhbt.net> wrote:
Show 13 quoted lines
> 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