# Re: git svn should refuse to checkin .svn directories

3 messages from 2008-04-18 to 2008-04-19. Participants: JM Ibanez, Thomas Koch, Jānis Rūcis.
Thread: https://gitlist.dev/t/13171

## Thomas Koch, 2008-04-18 11:46

Subject: git svn should refuse to checkin .svn directories
Message-ID: <200804181346.50755.thomas@koch.ro>
URL: https://gitlist.dev/e/200804181346.50755.thomas%40koch.ro

```
As you might guess I just annoyed my collegues by (temporarily) destroying our 
svn repo. Nobody could checkout anymore, because I accidently checked in 
a .svn directory with git svn.

I'm lucky that I'm still allowed to use git svn to work on our svn repo...

Maybe you could add a warning or something else to avoid .svn directories to 
be ever checked in via git svn.

I'm sure that there is also a config option somewhere to get .svn directories 
ignored (also subdirs when adding the parent dir?). But this check should 
really be a default setting to avoid other newcommers to get into trouble 
because they gave git svn a try.


Cheers,
-- 
Thomas Koch, Software Developer
http://www.koch.ro

```

## JM Ibanez, 2008-04-18 21:09

Subject: Re: git svn should refuse to checkin .svn directories
Message-ID: <873apian0t.fsf@armitage.orangeandbronze.local>
URL: https://gitlist.dev/e/873apian0t.fsf%40armitage.orangeandbronze.local
In-Reply-To: <200804181346.50755.thomas@koch.ro>

```
Thomas Koch <thomas@koch.ro> writes:

> As you might guess I just annoyed my collegues by (temporarily) destroying our 
> svn repo. Nobody could checkout anymore, because I accidently checked in 
> a .svn directory with git svn.
>
> I'm lucky that I'm still allowed to use git svn to work on our svn repo...
>
> Maybe you could add a warning or something else to avoid .svn directories to 
> be ever checked in via git svn.
>
> I'm sure that there is also a config option somewhere to get .svn directories 
> ignored (also subdirs when adding the parent dir?). But this check should 
> really be a default setting to avoid other newcommers to get into trouble 
> because they gave git svn a try.

Well, this isn't a patch to git-svn, but this may help those working
with upstream SVN repositories via git and git-svn. Add this as the
pre-commit hook in .git/hooks (make sure to make it executable).



#!/bin/sh
#
# Used in a git repo interacting with an upstream SVN repo, this
# pre-commit hook will not allow a commit of any directory named .svn


if (git diff-index HEAD | cut -f2 | grep "^\(.*/\)*\.svn/" 2>&1 > /dev/null); then
    echo "Cowardly refusing to commit an .svn directory"
    exit 1
fi

    




-- 
JM Ibanez
Software Architect
Orange & Bronze Software Labs, Ltd. Co.

jm@orangeandbronze.com
http://software.orangeandbronze.com/

```

## Jānis Rūcis, 2008-04-19 18:49

Subject: Re: git svn should refuse to checkin .svn directories
Message-ID: <20080419184933.GA9724@localhost.localdomain>
URL: https://gitlist.dev/e/20080419184933.GA9724%40localhost.localdomain
In-Reply-To: <200804181346.50755.thomas@koch.ro>

```
Hi,

On Fri, Apr 18, 2008 at 01:46:50PM +0200, Thomas Koch wrote:
> I'm sure that there is also a config option somewhere to get .svn directories 
> ignored (also subdirs when adding the parent dir?). But this check should 
> really be a default setting to avoid other newcommers to get into trouble 
> because they gave git svn a try.

Perhaps it would help if you clarified why there are .svn directories in
your working copy.  They are neither required nor created by git-svn.

Jānis

```
