Skip to content

Cannot read property 'oldlines' of undefined #3

@nwtn

Description

@nwtn

I'm getting this error with some of my patches with grunt-patch.

dnewton@newtron ~/Sites/gh/great 👍  grunt patch:parsedownExtra
Running "patch:parsedownExtra" (patch) task
Warning: Cannot read property 'oldlines' of undefined Use --force to continue.

Aborted due to warnings.

Grunt-patch works fine with other patches, and the patch works when applied on the command line with patch targetfile patchfile. My grunt task is:

'patch': {
    parsedownExtra: {
        options: {
            patch: 'src/perch-patches/ParsedownExtra.php.patch'
        },
        files: {
            'src/vendor/erusev/parsedown-extra/ParsedownExtra.php': 'build/vendor/erusev/parsedown-extra/ParsedownExtra.php'
        }
    }
}

The patch file is:

52,60d51
<         # add footnotes
< 
<         if (isset($this->DefinitionData['Footnote']))
<         {
<             $Element = $this->buildFootnoteElement();
< 
<             $markup .= "\n" . $this->element($Element);
<         }
< 
266,277d256
<             if ( ! isset($this->DefinitionData['Footnote'][$name]))
<             {
<                 return;
<             }
< 
<             $this->DefinitionData['Footnote'][$name]['count'] ++;
< 
<             if ( ! isset($this->DefinitionData['Footnote'][$name]['number']))
<             {
<                 $this->DefinitionData['Footnote'][$name]['number'] = ++ $this->footnoteCount; # » &
<             }
< 
280c259
<                 'attributes' => array('id' => 'fnref'.$this->DefinitionData['Footnote'][$name]['count'].':'.$name),

---
>                 'attributes' => array('id' => 'fnref-'.$name),
284,285c263,264
<                     'attributes' => array('href' => '#fn:'.$name, 'class' => 'footnote-ref'),
<                     'text' => $this->DefinitionData['Footnote'][$name]['number'],

---
>                     'attributes' => array('href' => '#fn-'.$name, 'class' => 'footnote-ref'),
>                     'text' => $name,
329c308,312
<                 $pattern = '/\b'.preg_quote($abbreviation).'\b/';

---
>                 if (substr($abbreviation, -1) === '.') {
>                     $pattern = '/\b'.preg_quote(rtrim($abbreviation, "."), '/').'\b\.(?!\b)/';
>                 } else {
>                     $pattern = '/\b'.preg_quote($abbreviation, '/').'\b/';
>                 }

…and the patch is being applied to https://raw.githubusercontent.com/erusev/parsedown-extra/a7eaaa5d1456626b7687eb4464b869acdee9061e/ParsedownExtra.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions