threads / discuss / 27337

git svn info --url lacks username

Subject: git svn info --url lacks username

## tl;dr

2 messages between May 12, 2011 and May 17, 2011.

replies: 1people: 1as markdown or json

Geert Uytterhoeven· May 12, 2011, 12:13 UTC · lore
        Hi all,

I'm using git-svn. Due to local policies and for compatibility with the other developers using plain svn, I have to lock a file before committing anything to the svn repository.

Hence I wrote a small wrapper script around "git svn dcommit", which basically does:

| SVNROOT=$( ( cd ./$(git rev-parse --show-cdup) && git svn info --url ) )
| SVNLOCKFILE=$SVNROOT/lockfile
|
| svn lock $SVNLOCKFILE
| git svn dcommit $*
| svn unlock $SVNLOCKFILE

A while ago, I started seeing "svn: Network connection closed unexpectedly" messages being printed. Unfortunately, I didn't really look into them at that time, as everything seemed to continue working fine.

Recently, we noticed concurrent commits, and discovered I no longer lock the lockfile. It seems that both the lock and unlock fail with "svn: Network connection closed unexpectedly", because $SVNROOT doesn't contain the username I need to use for authentication.

My .git/config has
| [svn-remote "svn"]
|         url = svn+ssh://user@server/project
But "git svn info --url" only prints:
| svn+ssh://server/project/sub/branches/branch

i.e. the username part is missing. Obviously "git svn dcommit" does use the correct URL.

I'm using git version 1.7.0.4, but I also tried version 1.7.5.1.217.g4e3aa with the same results.

The funny thing is that I tested that locking did work when I wrote my script. But when I look at the history for git-svn.perl, I don't see any change that caused it to break, or even work at all. Nor do I have access to the same machine and software I originally used, as it got upgraded in the mean time.

I tried, "git config --get svn-remote.svn.url", but that only gives me "svn+ssh://user@server/project", i.e. it lacks the "/sub/branches/branch" part.

Do you have any idea what's going on, or how to fix it? Shouldn't "git svn info --url" include the username?

Thanks in advance!
Gr{oetje,eeting}s,
                        Geert

-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Geert Uytterhoeven· May 17, 2011, 16:51 UTC · re: Geert Uytterhoeven · lore

Re: git svn info --url lacks username

On Thu, May 12, 2011 at 14:13, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
Show 13 quoted lines
> I'm using git-svn. Due to local policies and for compatibility with the other
> developers using plain svn, I have to lock a file before committing anything to
> the svn repository.
>
> Hence I wrote a small wrapper script around "git svn dcommit", which basically
> does:
>
> | SVNROOT=$( ( cd ./$(git rev-parse --show-cdup) && git svn info --url ) )
> | SVNLOCKFILE=$SVNROOT/lockfile
> |
> | svn lock $SVNLOCKFILE
> | git svn dcommit $*
> | svn unlock $SVNLOCKFILE
[...]
Show 11 quoted lines
> My .git/config has
>
> | [svn-remote "svn"]
> |         url = svn+ssh://user@server/project
>
> But "git svn info --url" only prints:
>
> | svn+ssh://server/project/sub/branches/branch
>
> i.e. the username part is missing.
> Obviously "git svn dcommit" does use the correct URL.
[...]
Show 5 quoted lines
> I tried, "git config --get svn-remote.svn.url", but that only gives me
> "svn+ssh://user@server/project", i.e. it lacks the "/sub/branches/branch" part.
>
> Do you have any idea what's going on, or how to fix it?
> Shouldn't "git svn info --url" include the username?
I ended up adding:
| SVNURL=$(git config --get svn-remote.svn.url)
| case $SVNURL in svn+ssh://*@*)
|         SVNROOT=${SVNURL%%@*}@${SVNROOT#svn+ssh://}
|         ;;
| esac

so it hacks in the username from the config file. But I don't think that's the ideal solution?

Gr{oetje,eeting}s,
                        Geert

-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

← back to recent threads