Created
February 4, 2014 05:01
-
-
Save mdaniel/8798402 to your computer and use it in GitHub Desktop.
Reproducible reposurgeon 3.2 unicode path bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -e | |
mkdir orig | |
cd orig | |
git init | |
git fast-import <../original.fi | |
cd .. | |
echo -ne "read orig\nexpunge /.jar/\nwrite >bad.fi\n" | reposurgeon | |
mkdir bad | |
cd bad | |
git init | |
git fast-import <../bad.fi | |
# kaboom |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blob | |
mark :1 | |
data 0 | |
reset refs/heads/master | |
commit refs/heads/master | |
mark :2 | |
author Matthew L Daniel <[email protected]> 1391470152 -0800 | |
committer Matthew L Daniel <[email protected]> 1391470152 -0800 | |
data 24 | |
Added a latin1 filename | |
M 100644 :1 "foo/\303\251spere" | |
commit refs/heads/master | |
mark :3 | |
author Matthew L Daniel <[email protected]> 1391470437 -0800 | |
committer Matthew L Daniel <[email protected]> 1391470437 -0800 | |
data 26 | |
Renamed a latin1 filename | |
from :2 | |
R "foo/\303\251spere" "bar/\303\251spere" | |
commit refs/heads/master | |
mark :5 | |
author Matthew L Daniel <[email protected]> 1391470599 -0800 | |
committer Matthew L Daniel <[email protected]> 1391470599 -0800 | |
data 29 | |
Moving a bad file and latin1 | |
from :3 | |
R "bar/\303\251spere" "foo/\303\251spere" | |
reset refs/heads/master | |
from :5 | |
tag emptycommit-mark4 | |
from :3 | |
tagger Matthew L Daniel <[email protected]> 1391470553 -0800 | |
data 28 | |
Added a file named bob.jar | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blob | |
mark :1 | |
data 0 | |
reset refs/heads/master | |
commit refs/heads/master | |
mark :2 | |
author Matthew L Daniel <[email protected]> 1391470152 -0800 | |
committer Matthew L Daniel <[email protected]> 1391470152 -0800 | |
data 24 | |
Added a latin1 filename | |
M 100644 :1 "foo/\303\251spere" | |
commit refs/heads/master | |
mark :3 | |
author Matthew L Daniel <[email protected]> 1391470437 -0800 | |
committer Matthew L Daniel <[email protected]> 1391470437 -0800 | |
data 26 | |
Renamed a latin1 filename | |
from :2 | |
M 100644 :1 "bar/\303\251spere" | |
D "foo/\303\251spere" | |
commit refs/heads/master | |
mark :4 | |
author Matthew L Daniel <[email protected]> 1391470553 -0800 | |
committer Matthew L Daniel <[email protected]> 1391470553 -0800 | |
data 27 | |
Added a file named bob.jar | |
from :3 | |
M 100644 :1 bar/bob.jar | |
commit refs/heads/master | |
mark :5 | |
author Matthew L Daniel <[email protected]> 1391470599 -0800 | |
committer Matthew L Daniel <[email protected]> 1391470599 -0800 | |
data 29 | |
Moving a bad file and latin1 | |
from :4 | |
D bar/bob.jar | |
D "bar/\303\251spere" | |
M 100644 :1 foo/bob.jar | |
M 100644 :1 "foo/\303\251spere" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- reposurgeon~ 2014-02-03 02:39:30.000000000 -0800 | |
+++ reposurgeon 2014-02-03 21:58:38.000000000 -0800 | |
@@ -1198,10 +1198,11 @@ | |
self.path = os.path.join(os.path.dirname(self.path), ".gitignore") | |
def path_remap_out(self, path, vcs): | |
"Hack the fileop's basename to map it to a target VCS's conventions." | |
+ result = path | |
if vcs is not None and vcs.ignorename is not None: | |
if os.path.basename(path) == ".gitignore": | |
- return os.path.join(os.path.dirname(path), vcs.ignorename) | |
- return path | |
+ result = os.path.join(os.path.dirname(path), vcs.ignorename) | |
+ return '"%s"' % result | |
def setOp(self, op): | |
self.op = op | |
@staticmethod | |
@@ -1302,7 +1303,7 @@ | |
else: | |
parts.append(self.path_remap_out(self.path, vcs)) | |
elif self.op in ("R", "C"): | |
- parts = ['%s "%s" "%s"' % (self.op, | |
+ parts = ['%s %s %s' % (self.op, | |
self.path_remap_out(self.source, vcs), | |
self.path_remap_out(self.target, vcs))] | |
elif self.op == "deleteall": |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment