]> thyrsus.com Git - rcs-fast-import.git/commitdiff
Fix importing of inline data
authorMike Fleetwood <mike.fleetwood@googlemail.com>
Thu, 29 Aug 2013 22:43:25 +0000 (23:43 +0100)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 3 Sep 2013 18:19:04 +0000 (14:19 -0400)
Import of inline data was failing because the temporary file containing
the inline data was written to .../.rs<PID>/inline-<OBJID> but was being
accessed from the current working directory .../temp-import-<PID> using
just the file name without a path.  Save the full path to the inline
data file, rather than just the file name.

Test case:

$ cat test-01-inline-data.fastexp
commit refs/heads/master
mark :1
committer Joe Bloggs <joe.bloggs@example.com> 998655365 +0100
data 13
Add file.txt

M 644 inline file.txt
data 21
Contents of file.txt

$ rcs-fast-import -v -v -v < test-01-inline-data.fastexp
rcs-fast-import: repository fast import creates /tmp/test/.rs16719
rcs-fast-import:......(0.00 sec) done.
commit refs/heads/master
rcs-fast-import:    :1 M file.txt
rcs-fast-import: linking inline-164709420 to file.txt
cleaning up......(0.00 sec) done.
rcs-fast-import: cleaning up /tmp/test/.rs16719......(0.00 sec) done.
rcs-fast-import: refusing to step on file.txt: OSError(2, 'No such file or directory').

rcs-fast-import

index 7f95f854fef50557e7591e00a931fa920cfbf041..36272a669cbf6797dba6cba7beae1b5868dd1fa8 100755 (executable)
@@ -441,8 +441,8 @@ class Repository:
                                     else:
                                         self.error("no blob matches commit reference to %s" % fileop.ref)
                                 elif fileop.ref == 'inline':
-                                    fileop.copyname = "inline-" + `id(commit)`
-                                    read_data(open(os.path.join(self.subdir(), fileop.copyname), "w")).close()
+                                    fileop.copyname = os.path.join(self.subdir(), "inline-" + `id(commit)`)
+                                    read_data(open(fileop.copyname, "w")).close()
                                 else:
                                     self.error("unknown content type in filemodify")
                             # Handling of file ops ends.