[TxMt] diff bundle broken? seems to fail on multi-file-diff

Allan Odgaard throw-away-1 at macromates.com
Tue Feb 13 04:46:35 UTC 2007


On 11. Feb 2007, at 18:48, Allan Odgaard wrote:

> On 10. Feb 2007, at 12:06, m.zeckinger wrote:
>> [...] i am having a quite large diff file that should patch  
>> various files in a directory in several sub directories. if i am  
>> tryinge Bundles->Diff->Apply Patch to Files... and selecting the  
>> base directory from where it should patch, strange things happen.
>> The Output for all files is the following:
>> File to Patch
>> Skip this patch? [y]
>> Skipping patch.
>>
>> is there anything wrong with the current diff bundle? or is it maybe
>> not working with more than one file to patch?
>
> Does it work if you run patch from the shell?
>
> I find that quite often patch will not be able to find the proper  
> files (even though the paths in teh diff file should indicate them)  
> and goes into an interactive mode (which would certainly fail for  
> the TM command)

I just got a diff file which showed this problem, so I did a bit of  
investigation.

It turns out, that if you have a diff file e.g. with this top index:

     Index: JavaScript.tmbundle/Syntaxes/JavaScript.plist

Patch will, by default, only use the ‘JavaScript.plist’ part of the  
path, to locate the file to patch. I.e. by default it strips all the  
parent directories from the “what to patch” path.

This can be changed by using the -p option, which tells how many  
leading path components it should strip. I have now changed the Apply  
Patch command to give -p0. This should then work for all diffs file  
where the paths are relative to the selected destination.







More information about the textmate mailing list