# git-svn: problem with svn cp trunk/subdir tags/subdir_1.0

3 messages from 2013-04-29 to 2013-05-02. Participants: Ilya Basin.
Thread: https://gitlist.dev/t/33669

## Ilya Basin, 2013-04-29 12:46

Subject: git-svn: problem with svn cp trunk/subdir tags/subdir_1.0
Message-ID: <1826029946.20130429164645@gmail.com>
URL: https://gitlist.dev/e/1826029946.20130429164645%40gmail.com

```
After fixing --preserve-empty-dirs plus --stdlayout a new problem
arised:
When creating a tag or branch from a subdir, a disjoint branch
is created. Then git-svn re-imports the commits using this dir as
strip path.

Why? I would instead keep the current commit as parent, delete
everything except the subdir and move its contents to root directory.

During this re-import the variable %added_placeholder is not up to
date. Because the branch is disjoint, this variable should be empty in
the beginning, but it's not.
Because of that git-svn tries to delete non-existent .gitignore files
and dies.

I think, if a disjoint branch is created, %added_placeholder should be
pushed and cleared. A new set of paths starting with "trunk/" will be
added to it during re-import.
When re-import is done, we should translate the paths to
"tags/subdir_1.0/" and merge with the original %added_placeholder.

```

## Ilya Basin, 2013-04-29 13:00

Subject: Re: git-svn: problem with svn cp trunk/subdir tags/subdir_1.0
Message-ID: <1531127990.20130429170032@gmail.com>
URL: https://gitlist.dev/e/1531127990.20130429170032%40gmail.com
In-Reply-To: <1826029946.20130429164645@gmail.com>

```
IB> After fixing --preserve-empty-dirs plus --stdlayout a new problem
IB> arised:
IB> When creating a tag or branch from a subdir, a disjoint branch
IB> is created. Then git-svn re-imports the commits using this dir as
IB> strip path.

IB> Why? I would instead keep the current commit as parent, delete
IB> everything except the subdir and move its contents to root directory.

IB> During this re-import the variable %added_placeholder is not up to
IB> date. Because the branch is disjoint, this variable should be empty in
IB> the beginning, but it's not.
IB> Because of that git-svn tries to delete non-existent .gitignore files
IB> and dies.

IB> I think, if a disjoint branch is created, %added_placeholder should be
IB> pushed and cleared. A new set of paths starting with "trunk/" will be
IB> added to it during re-import.
IB> When re-import is done, we should translate the paths to
IB> "tags/subdir_1.0/" and merge with the original %added_placeholder.

A simpler approach would be to store paths in %added_placeholder
already translated from "trunk/subdir/" to "tags/subdir_1.0/".
But in the beginning of re-import Fetcher doesn't know the new branch
name.

-- 

```

## Ilya Basin, 2013-05-02 18:19

Subject: Re: git-svn: problem with svn cp trunk/subdir tags/subdir_1.0
Message-ID: <603835689.20130502221926@gmail.com>
URL: https://gitlist.dev/e/603835689.20130502221926%40gmail.com
In-Reply-To: <1826029946.20130429164645@gmail.com>

```
IB> When creating a tag or branch from a subdir, a disjoint branch
IB> is created. Then git-svn re-imports the commits using this dir as
IB> strip path.

IB> Why? I would instead keep the current commit as parent, delete
IB> everything except the subdir and move its contents to root directory.

Even worse, git-svn does doble work, failing to find the parent branch:
The revision is imported 3 times (2 times creating the same SHA)

    r8803 = 7bfe8f8d950edd645c6f15193e639953c0b936ac (refs/remotes/trunk)
    Found possible branch point: file:///home/il/builds/sicap/gitsvn/prd_dmc4.svn/trunk/GUI => file:///home/il/builds/sicap/gitsvn/prd_dmc4.svn/tags/GUI_4.0.25, 8803
    Initializing parent: refs/remotes/tags/GUI_4.0.25@8803
    r6 = de89d3fd4dff9c44f1c79a316364196d0c81c9f6 (refs/remotes/tags/GUI_4.0.25@8803)
    ...
    r8803 = ffc46ad0e967636f2000d354481c0419a4c6cec4 (refs/remotes/tags/GUI_4.0.25@8803)
    Found branch parent: (refs/remotes/tags/GUI_4.0.25) ffc46ad0e967636f2000d354481c0419a4c6cec4
    Following parent with do_switch
    Successfully followed parent
    r8804 = 2cbe962f0fb58c3f2d236ca918941e353da45af4 (refs/remotes/tags/GUI_4.0.25)
    ...


    r8923 = ad38e54ca9bb6b26654571bb14d17301484437dc (refs/remotes/tags/GUI_4.0.26)
    r8924 = e1932e8fdeab291f54ed06064da3ae7eb1e3eddb (refs/remotes/trunk)
    Found possible branch point: file:///home/il/builds/sicap/gitsvn/prd_dmc4.svn/trunk/GUI => file:///home/il/builds/sicap/gitsvn/prd_dmc4.svn/tags/GUI_4.0.26, 8925
    Initializing parent: refs/remotes/tags/GUI_4.0.26@8925
    r6 = de89d3fd4dff9c44f1c79a316364196d0c81c9f6 (refs/remotes/tags/GUI_4.0.26@8925)
    ...
    r8803 = ffc46ad0e967636f2000d354481c0419a4c6cec4 (refs/remotes/tags/GUI_4.0.26@8925)
    r8805 = dac5886451f64e63d70b307bcc6f0c8ccf9c9882 (refs/remotes/tags/GUI_4.0.26@8925)
    ...

```
