git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: "David D. Kilzer" <ddkilzer@kilzer.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/3 v3] git-svn info: implement info command
Date: Wed, 21 Nov 2007 17:40:38 -0800	[thread overview]
Message-ID: <20071122014038.GA25341@soma> (raw)
In-Reply-To: <1195675039-26746-3-git-send-email-ddkilzer@kilzer.net>

"David D. Kilzer" <ddkilzer@kilzer.net> 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@yhbt.net> 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

  parent reply	other threads:[~2007-11-22  1:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-21 19:57 [PATCH 0/3 v3] Implement git-svn info David D. Kilzer
2007-11-21 19:57 ` [PATCH 1/3 v3] git-svn: extract reusable code into utility functions David D. Kilzer
2007-11-21 19:57   ` [PATCH 2/3 v3] git-svn info: implement info command David D. Kilzer
2007-11-21 19:57     ` [PATCH 3/3 v3] git-svn: info --url [path] David D. Kilzer
2007-11-22  1:40     ` Eric Wong [this message]
2007-11-22  3:16       ` [PATCH 2/3 v3] git-svn info: implement info command David D. Kilzer
2007-11-22  4:17         ` Eric Wong
2007-11-22  1:19   ` [PATCH 1/3 v3] git-svn: extract reusable code into utility functions Eric Wong
2007-11-22  2:23 ` [PATCH 4/3] git-svn: allow `info' command to work offline Eric Wong
2007-11-22  3:24   ` Adam Roben
2007-11-22  3:56     ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071122014038.GA25341@soma \
    --to=normalperson@yhbt.net \
    --cc=ddkilzer@kilzer.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).