Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command failed (output redirection?) #132

Closed
krmaxwell opened this issue Aug 15, 2013 · 41 comments
Closed

Command failed (output redirection?) #132

krmaxwell opened this issue Aug 15, 2013 · 41 comments

Comments

@krmaxwell
Copy link

Got the following error:

$ svn2git http://bletchley.googlecode.com/svn/trunk/
command failed:
2>&1 git checkout -f master
@hsn10
Copy link

hsn10 commented Aug 20, 2013

use --verbose to see what is wrong

@hsn10
Copy link

hsn10 commented Aug 20, 2013

fbsd9:~/jade-plugins> svn2git svn://svn.code.sf.net/p/jade-plugins/code/ --verbose
Running command: git svn init --prefix=svn/ --no-metadata --trunk=trunk --tags=tags --branches=branches svn://svn.code.sf.net/p/jade-plugins/code/
Running command: git svn fetch
Running command: git branch -l --no-color
* master
Running command: git branch -r --no-color
  svn/1.1
  svn/1.2
  svn/1.3-old
  svn/alphacsp-plugins
  svn/alphacsp-plugins.1.2.5
  svn/alphacsp-plugins.1.2.6
  svn/alphacsp-plugins.1.2.6-SNAPSHOT
  svn/alphacsp-plugins.1.3.x
  svn/alphacsp-plugins.trunk
  svn/maven.jboss
  svn/old-trunk
  svn/tags/1.1.1
  svn/tags/1.1.2
  svn/tags/1.2.1
  svn/tags/1.2.2
  svn/tags/1.3.1
  svn/tags/1.3.2
  svn/tags/1.3.3
  svn/tags/1.3.3@272
  svn/tags/1.3.5
  svn/tags/1.3.6
  svn/tags/1.3.7
  svn/tags/1.3.8
  svn/tags/1.4-alpha1
  svn/tags/alphacsp-plugins.1.2.6.3
  svn/tags/alphacsp-plugins.1.2.6.4
  svn/tags/alphacsp-plugins.1.2.6.7
  svn/tags/alphacsp-plugins.1.3.0.1
  svn/tags/alphacsp-plugins.1.3.0.2
  svn/tags/alphacsp-plugins.1.3.0.3
  svn/tags/alphacsp-plugins.1.3.1
  svn/tags/alphacsp-plugins.1.3.2
  svn/tags/alphacsp-plugins.1.3.3
  svn/tags/alphacsp-plugins.1.4.0
  svn/tags/alphacsp-plugins.1.4.0.1
  svn/tags/alphacsp-plugins.1.4.0.1@414
  svn/tags/alphacsp-plugins.1.4.0.2
  svn/tags/alphacsp-plugins.1.4.0.2@425
  svn/tags/alphacsp-plugins.1.4.0.2@431
  svn/tags/alphacsp-plugins.1.4.0@410
  svn/tags/freehep.2.0-acs-7
  svn/tags/freehep.2.0-acs-7@146
  svn/tags/jade-native-1.0.0
  svn/tags/jade-native-1.0.0@250
  svn/tags/jade-native-1.0.0@261
  svn/tags/jxr-jdk5
  svn/tags/jxr-jdk5@263
  svn/trunk
  svn/trunk@275
Running command: git branch --track "1.1" "remotes/svn/1.1"
fatal: Cannot setup tracking information; starting point 'remotes/svn/1.1' is not a branch.
command failed:
2>&1 git branch --track "1.1" "remotes/svn/1.1"

@greened
Copy link

greened commented Aug 23, 2013

I am seeing the same. This indicates it might be related to changes after git 1.8.1.3.

http://stackoverflow.com/questions/17852249/svn2git-cannot-setup-tracking-information

@greened
Copy link

greened commented Aug 23, 2013

Possibly related to this in branch.c?

static int check_tracking_branch(struct remote *remote, void *cb_data)
{
char *tracking_branch = cb_data;
struct refspec query;
memset(&query, 0, sizeof(struct refspec));
query.dst = tracking_branch;
return !(remote_find_tracking(remote, &query) ||
prefixcmp(query.src, "refs/heads/"));
}

static int validate_remote_tracking_branch(char *ref)
{
return !for_each_remote(check_tracking_branch, ref);
}

From a diff of v1.8.1.3 and v1.8.3.4. Looks like it verifies whether the branch exists on the remote but we don't have a remote yet after the svn fetch.

This was introduced in git 1.8.3.2

@greened
Copy link

greened commented Aug 23, 2013

Confirmed that it all works with git 1.8.3.1. That doesn't mean the code I pointed to is the problem, but it's a strong suggestion.

@aleskovets
Copy link

Having the same issue with git 1.8.4.

@stephenyeargin
Copy link

#136 sounds related.

@stephenyeargin
Copy link

Confirming that downgrading git to 1.8.3.1 worked for me as well.

@marcellodesales
Copy link

Same problem here... Git 1.8.5...

@chrisdembia
Copy link

I have this issue with git version 1.8.3.2.

@DanielRuf
Copy link

Changing this line https://github.com/nirvdrum/svn2git/blob/master/lib/svn2git/migration.rb#L319
from run_command("git branch --track \"#{branch}\" \"remotes/svn/#{branch}\"")
to run_command("git branch \"#{branch}\" \"remotes/svn/#{branch}\"")
should fix it.

At least it works now for me without any issues.

you can find the migration.rb file on Windows under C:\Ruby200-x64\lib\ruby\gems\2.0.0\gems\svn2git-2.2.2\lib\svn2git or something like this

@nirvdrum
Copy link
Owner

nirvdrum commented Jan 2, 2014

Thanks. I need to do a better job at version detection. We're supporting a wide swath of git versions, many with slightly differing behavior.

@sunew
Copy link

sunew commented Jan 7, 2014

a release soon would be really cool :) Thanks for the fix!

@nirvdrum
Copy link
Owner

nirvdrum commented Jan 7, 2014

I'm planning on one this weekend.

@chrisdembia
Copy link

Looking forward to a release.

chrisdembia added a commit to chrisdembia/svn2git that referenced this issue Jan 15, 2014
chrisdembia added a commit to chrisdembia/svn2git that referenced this issue Jan 15, 2014
@ghost
Copy link

ghost commented Feb 3, 2014

If the fix released yet? And if so how do I update? I've tried running sudo gem install svn2git just today and this problem persists with git version 1.8.3.2.

@nirvdrum
Copy link
Owner

nirvdrum commented Feb 3, 2014

No. I'm still in the midst of verifying on older git releases.

@DanielRuf
Copy link

@ava-dylang you can fix this also manually

@ghost
Copy link

ghost commented Feb 3, 2014

@DanielRuf Thanks; I had got it working, I had too. Thanks to your for listing the files to change! Saved me so much undue headache. <3

@DanielRuf
Copy link

@ava-dylang No problem, this is also the fix, which will be applied to the next release.
The manual fix is a temporary and working solution. ;-)

@vschiavoni
Copy link

The fix proposed by DanielRuf worked fine for me. I'm on git version 1.8.3.4 (Apple Git-47)

@jruuttun
Copy link

jruuttun commented Mar 7, 2014

I bumped into this too and fixed it manually. Thanks for your work on this tool!

@amichair
Copy link

Broken on git 1.9.1 as well (stock git from Ubuntu repos).
The workaround above works for me too (thanks!)
+1 for a release!

@Burstaholic
Copy link

Just echoing, this fix worked for me, please release.

👍

@erickertz
Copy link

@DanielRuf thanks!

@DanielRuf
Copy link

@erickertz you are welcome =)

@kohenkatz
Copy link

I had this problem on Ubuntu with Git 1.9.3. and can confirm that the fix from @DanielRuf works there too.

👍

@joshSzep
Copy link

I had this problem on OSX 10.9.2 with git 1.9.3 as well. Can confirm fix from @DanielRuf works here too. Fix should be released, github's official "importing svn into github" page recommends svn2git - experiencing errors with the most updated versions of everything has got to be turning a lot of people away who didn't do half an hour of searching to find this ticket. :)

@nirvdrum
Copy link
Owner

I'm working through several tickets right now. Making sure it works on all 3 LTS Ubuntu releases, Mac, and Windows, with system rubies and JRuby is a bit time-consuming. Almost every time I merge a PR, it ends up breaking someone else, so I'm being more conservative about that now until I can verify fixes work across the board. Trust me, I do want to get this fixed.

@chrisdembia
Copy link

Maybe you can ask GitHub to help with the testing =O

@DanielRuf
Copy link

I think this fix should work for all users.

@nirvdrum
Copy link
Owner

I just got the 2.3.0 release out, which required some hairy process management to support passing STDIN through the underlying git-svn process. That should free me up to look at this shortly.

@nirvdrum
Copy link
Owner

Okay, so as far as I can tell this issue got hijacked. @technoskald's original problem seems to have nothing to do with all the follow-on comments. I'm trying to address both but that does make resolving this one a bit trickier.

@nirvdrum
Copy link
Owner

For more of the history, it appears this behavior changed in in git 1.8.3.2. I happen to disagree with the change, but I understand the rationale. Tracking a remote is still valid when pulling changes. In any event, the proposed change here is not semantically equivalent and we have users that are using svn2git to basically keep git forks in sync. So, I'm reticent to just blindly make the change. I'll try to come up with something that works in both cases.

FYI, it appears this may break again when git 2.0 comes out.

@nirvdrum
Copy link
Owner

I just pushed 2.3.1 out which which should fix the problem everyone but @technoskald was reporting. I still need to get to the bottom of that one, but it's looking like it may be either git-svn related or repository-layout related.

If you're using git < 1.8.3.2, the semantics are retained (tracking information is established), but you'll see a deprecation message. If you're on git >= 1.8.3.2, branches should be created fine now. If you find otherwise, please open a new issue with details. Thanks.

@nirvdrum
Copy link
Owner

For my own sanity, I filed #165 for the issue originally reported here. For anyone affected by that, please follow the new issue. I'll be closing this one, treating it as related to tracking remote SVN branches.

@yrodiere
Copy link

With git 1.9.1 and svn2git 2.3.2, the bug mentioned in post 3 does not seem to be fixed. Maybe a regression?

I just ran svn2git svn://svn.code.sf.net/p/jade-plugins/code/ --verbose and got this output: https://gist.github.com/fenrhil/30a1115f012388fd10ee886dc8d75aa0

A possible reason why the bug was not fixed might be that git's error message is in my native language (French). Since the fix seems to rely on git's error messages, maybe svn2git should take care of setting git's language before executing commands?
From this google search result, I gather that one can change git's language by setting the LANG, LC_ALL or LANGUAGE environment variables to something like "C".
I just tested running LANG=C svn2git svn://svn.code.sf.net/p/jade-plugins/code/ --verbose and it does seem to work just fine: https://gist.github.com/fenrhil/896e2e73bfcf764826070f97fc0dace5

@DanielRuf
Copy link

With git 1.9.1

Isn't there Git 2.8 already? Git 1.9.1 is from 18-Mar-2014.

See here for a working workaround (should fix this): #132 (comment)

References, that also Git 1.9.x is affected:

#132 (comment)
#132 (comment)
#132 (comment)

This was changed in Git 1.8.x
#132 (comment)

This is still a bug in svn2git which has to use the new syntax for tracking branches and which was changed in Git 1.8.x.

Unfotunately there is no new release of svn2git, so you could try using the master branch or fix the file manually with the aforementioned workaround (well, it's mor elike the right fix of this bug / incompability with new Git versions).

So instead of using an outdated and insecure version of Git, just fix the mentioned file in svn2git and it should be fine.

I hope this fixes your issue.

@yrodiere
Copy link

@DanielRuf Thanks for you answer.

Git 1.9.1 is the current version of Git on Ubuntu LTS (trusty). But the new LTS will be released in the following days, as every 18 months, so yes, it's really old. See http://packages.ubuntu.com/fr/trusty/git

As for the issue:

  • your solution should indeed fix the problem
  • it seems a fix (that closely resemble your solution) has actually been committed here: 5842a2a and released in 2.3.1, as mentioned in message Command failed (output redirection?) #132 (comment)
  • but this fix relies on the user's system language: it parses git's error messages so as to switch to an alternative behavior when a specific error is encountered (as far as I can tell)
  • so I tried changing environment variables (in this case, LANG=C) before running svn2git, and it "fixes the fix" for me.

So, to sum up, everything fine with both the fix released in 2.3.1 and the workaround of changing the environment variable. I was just warning the developer (@nirvdrum?) that his fix does not seem to work in non-english environments.

@DanielRuf
Copy link

DanielRuf commented Mar 31, 2016

Possibly makes sense to open a new issue for this problem related to the system language. The proposed fix using LANG=C on the cli could be helpful for other users facing the same problem.

But even if my system language is in German I use Git in English and so I never faced or noticed this problem, I'm fine with English ;-)

The possible usage of LANG=C could be mentioned in the readme.

It seems this issue is still in the master branch, at least I got no result when I tried grepping for lang and so on.

I think @nirvdrum is quite busy with JRuby and development for svn2git stalled. There are still many open PRs and issues.

Documenting this as a separate issue with the workaround using LANG=C could be quite helpful for other users who stumple upon this here.

@mazong1123
Copy link

I've resolved this issue within a new release in svn2git.net. In case anyone wants it, just download the latest release from https://github.com/mazong1123/svn2gitnet/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests