# git-svn dcommit losing/detaching head when commit message empty

3 messages from 2011-02-24 to 2011-02-27. Participants: Hin-Tak Leung, Eric Wong.
Thread: https://gitlist.dev/t/26587

## Hin-Tak Leung, 2011-02-24 01:27

Subject: git-svn dcommit losing/detaching head when commit message empty
Message-ID: <AANLkTi=A-UG2aOcwwNbjoBK4pYDtKp=0nFmcwrgVv0f8@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3DA-UG2aOcwwNbjoBK4pYDtKp%3D0nFmcwrgVv0f8%40mail.gmail.com

```
Hi,

I have just encountered a small problem with git-svn dcommit, which
while not fatal, were quite worrying as
it resulted in a detached head(?) for a while. This is with
git-1.7.4-1.fc14.x86_64 .

What happened is that I was trying to cherry-pick from one svn branch
(of commits from somebody else using genuine svn)
into another svn branch and then do some fix-ups before dcommit to
push into another svn branch.

When dcommit'ing, it bombed out in the middle because one of the older
cherry-picks has no/empty svn commit message. So it
results into this message:

-------------------
A repository hook failed: 'pre-commit' hook failed with error output:
Please enter a commit message which details what has changed during this commit.
 at /usr/libexec/git-core/git-svn line 576
-------------------

That's fair enough and obvious enough, but then at that point, the
index is at the pre-bomb, and the working directory is post-bomb, I
think, and neither is HEAD of
my working branch. This is quite worrying - I think if I had done 'git
gc --prune=now --aggressive' at this point I would have lost my work?
Luckily I had a "git log" display before, so I did "git checkout -b
preserving_work sha1_of_working_branch_head" to keep it.

So I did git rebase -i to edit the original commit messages to add
something to them. (which arguably git-svn should do automatically? or
empty messages really frowned upon? I always commit with at least a
trivial message, but as I said, I was cherry-picking others' commits,
whose development habits I have no control over)

After I fixed that and continue as I intended, then there is another
bomb-out, when git-svn complains about a git commit message of mine
(with minor edit):
-------------
Running
perl -pi -e 's(sometag="original")(sometag="replacement")' directory/*
-------------
being empty. On hind-sight, it is probably not a good idea to have
perl regular expression code within a commit message (git-svn itself
being in perl), but complaining about a non-empty commit message (and
seem to be a valid one, no strange utf8/chinese characters, etc) being
empty seems to be a bug.

Hope this helps. BTW, git-svn is a great tool, and thanks a lot for
that - I wouldn't use anything else (including the "authentic" svn
client) to interact with svn repositories these days.

Hin-Tak

```

## Hin-Tak Leung, 2011-02-24 02:37

Subject: Re: git-svn dcommit losing/detaching head when commit message empty
Message-ID: <AANLkTi=Dk4VDkzE=j=CCbkb6dUAQRKHT9xT6Oefn+Ujd@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3DDk4VDkzE%3Dj%3DCCbkb6dUAQRKHT9xT6Oefn%2BUjd%40mail.gmail.com
In-Reply-To: <AANLkTi=A-UG2aOcwwNbjoBK4pYDtKp=0nFmcwrgVv0f8@mail.gmail.com>

```
On Thu, Feb 24, 2011 at 1:27 AM, Hin-Tak Leung <hintak.leung@gmail.com> wrote:
...
> After I fixed that and continue as I intended, then there is another
> bomb-out, when git-svn complains about a git commit message of mine
> (with minor edit):
> -------------
> Running
> perl -pi -e 's(sometag="original")(sometag="replacement")' directory/*
> -------------
> being empty. On hind-sight, it is probably not a good idea to have
> perl regular expression code within a commit message (git-svn itself
> being in perl), but complaining about a non-empty commit message (and
> seem to be a valid one, no strange utf8/chinese characters, etc) being
> empty seems to be a bug.

Just adding to this part: it appears that git-svn doesn't like the
first-line of the commit message being just one word (in this case,
"Running"). I have just done one where the commit message was a single
word "renaming" (it would be obvious which file I was renaming, so I
thought there is no need to say more), which also caused git-svn
dcommit to complain about it being empty.

Many thanks for git-svn - as I wrote below, I wouldn't use anything
else these days.

> Hope this helps. BTW, git-svn is a great tool, and thanks a lot for
> that - I wouldn't use anything else (including the "authentic" svn
> client) to interact with svn repositories these days.
>
> Hin-Tak
>

```

## Eric Wong, 2011-02-27 02:50

Subject: Re: git-svn dcommit losing/detaching head when commit message empty
Message-ID: <20110227025039.GB26643@dcvr.yhbt.net>
URL: https://gitlist.dev/e/20110227025039.GB26643%40dcvr.yhbt.net
In-Reply-To: <AANLkTi=A-UG2aOcwwNbjoBK4pYDtKp=0nFmcwrgVv0f8@mail.gmail.com>

```
Hin-Tak Leung <hintak.leung@gmail.com> wrote:
> Hi,
> 
> I have just encountered a small problem with git-svn dcommit, which
> while not fatal, were quite worrying as
> it resulted in a detached head(?) for a while. This is with
> git-1.7.4-1.fc14.x86_64 .

This is a known issue for a while that nobody's had time to get around
to fixing just yet.  I think setting aside a temporary branch should
work...

> Hope this helps. BTW, git-svn is a great tool, and thanks a lot for
> that - I wouldn't use anything else (including the "authentic" svn
> client) to interact with svn repositories these days.

Thanks for the encouragement.  I hardly need git svn nowadays so I
need all the encouragement I can get to set aside time for it from
other projects :)

-- 
Eric Wong

```
