git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: JM Ibanez <jm@orangeandbronze.com>
To: thomas@koch.ro
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: git svn should refuse to checkin .svn directories
Date: Sat, 19 Apr 2008 05:09:06 +0800	[thread overview]
Message-ID: <873apian0t.fsf@armitage.orangeandbronze.local> (raw)
In-Reply-To: <200804181346.50755.thomas@koch.ro> (Thomas Koch's message of "Fri, 18 Apr 2008 13:46:50 +0200")

[-- Attachment #1: Type: text/plain, Size: 900 bytes --]

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).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pre-commit --]
[-- Type: text/x-sh, Size: 309 bytes --]

#!/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

    

[-- Attachment #3: Type: text/plain, Size: 136 bytes --]



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

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

  reply	other threads:[~2008-04-18 21:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18 11:46 git svn should refuse to checkin .svn directories Thomas Koch
2008-04-18 21:09 ` JM Ibanez [this message]
2008-04-19 18:49 ` Jānis Rūcis

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=873apian0t.fsf@armitage.orangeandbronze.local \
    --to=jm@orangeandbronze.com \
    --cc=git@vger.kernel.org \
    --cc=thomas@koch.ro \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).