git svn interrupted, then i lost all the tags, how

2019-04-14 06:36发布

i am about to clone code from svn repo (on centos) using git svn clone -s svn://xxx, then it is interrupted for strange problems, the error message is as follows:

Following parent with do_switch
Successfully followed parent
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/SVN/Core.pm line 584.
Network connection closed unexpectedly:  at /usr/libexec/git-core/git-svn line 2693

then i continue this clone process using

    time git svn fetch -r HEAD

all the things seems goes well, and succeed to clone that svn repo at last:

W: -empty_dir: trunk/src/os/win32/ngx_gui.c
W: -empty_dir: trunk/src/os/win32/ngx_gui.h
W: -empty_dir: trunk/src/os/win32/ngx_gui_resources.h
W: -empty_dir: trunk/src/os/win32/ngx_shared.h
W: -empty_dir: trunk/src/os/win32/ngx_types.h
r4817 = 7b58fc00b5b8ebb0544053ecf63e53b28935f15b (refs/remotes/trunk)
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 12449, done.
Compressing objects: 100% (12177/12177), done.
Writing objects: 100% (12449/12449), done.
Total 12449 (delta 9475), reused 0 (delta 0)
Checked out HEAD:
  svn://svn.nginx.org/nginx/trunk r4817

real    0m9.630s
user    0m6.015s
sys     0m1.870s

the strange issue is that there is no tags in my local git repo which is cloned from svn repo:

[root@home nginx]# git branch
* master
[root@home nginx]# git tag   // no tags at all:(

[root@home nginx]# svn ls svn://svn.nginx.org/nginx/branches | wc -l
7
[root@home nginx]# svn ls svn://svn.nginx.org/nginx/tags | wc -l
388

in fact there are 388 tags in the svn repo, so how to fix my local .git repo?

should i have to restart to git clone from the remote svn server?

i have tried many times, with the same problem:(

1条回答
手持菜刀,她持情操
2楼-- · 2019-04-14 07:19

Basically git-svn doesn't support tags as Git tags. In order to convert SVN tags to Git tags you may use:

  • SubGit (+maybe svnsync if you have no access to the server with SVN repository)
  • git-svn + command for references update: "git update-ref refs/tags/TAGNAME refs/remotes/tags/TAGNAME"
  • SmartGit, if you want some UI and not writing a script

But note: only the 1st and the 3rd solutions allow you to push tags to the server to be conerted to SVN tags. With git-svn you should use additional "git svn branch" command.

查看更多
登录 后发表回答