git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git svn: Don't create empty directories whose parents were deleted

From
EWEric Wong <normalperson@yhbt.net>
Date
Dec 8, 2009, 04:59 UTC
Message-ID
<20091208045926.GA17683@dcvr.yhbt.net>
In-Reply-To
<20091208032831.GL30538@dr-wily.mit.edu>
Greg Price <price@ksplice.com> wrote:
> This is a regression in v1.6.6-rc0, so it would be good to fix before v1.6.6.
Thanks Greg,

I found another git svn bug (fixed in a patch below) while writing a test case for this.

Junio:
  The following are pushed out to git://git.bogomips.org/git-svn and
  should be ready for v1.6.6:
    Alex Vandiver (1):
          git-svn: sort svk merge tickets to account for minimal parents
    Eric Wong (1):
          git svn: log removals of empty directories
    Greg Price (1):
          git svn: Don't create empty directories whose parents were deleted
Thanks all
>From f9ad77a739c0d012ee58b64eda2d7ec0d4e1df9d Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Mon, 7 Dec 2009 20:49:38 -0800
Subject: [PATCH] git svn: log removals of empty directories
This also adds a test case for:
  "git svn: Don't create empty directories whose parents were deleted"
which was the reason we found this bug in the first place.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-svn.perl                  |    2 +-
 t/t9146-git-svn-empty-dirs.sh |   10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index bdd1f96..5a52068 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3891,11 +3891,11 @@ sub delete_entry {
 		}
 		print "\tD\t$gpath/\n" unless $::_q;
 		command_close_pipe($ls, $ctx);
-		$self->{empty}->{$path} = 0
 	} else {
 		$self->{gii}->remove($gpath);
 		print "\tD\t$gpath\n" unless $::_q;
 	}
+	$self->{empty}->{$path} = 0;
 	undef;
 }
 
diff --git a/t/t9146-git-svn-empty-dirs.sh b/t/t9146-git-svn-empty-dirs.sh
index 70c52c1..9b8d046 100755
--- a/t/t9146-git-svn-empty-dirs.sh
+++ b/t/t9146-git-svn-empty-dirs.sh
@@ -105,4 +105,14 @@ test_expect_success 'empty directories in trunk exist' '
 	)
 '
 
+test_expect_success 'remove a top-level directory from svn' '
+	svn_cmd rm -m "remove d" "$svnrepo"/d
+'
+
+test_expect_success 'removed top-level directory does not exist' '
+	git svn clone "$svnrepo" removed &&
+	test ! -e removed/d
+
+'
+
 test_done
-- 
Eric Wong
Previous: Greg Price
Message 2 of 2 in “git svn: Don't create empty directories whose parents were deleted”
  1. git svn: Don't create empty directories whose parents were deletedGreg Price, Dec 8, 2009
  2. Eric WongDec 8, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.