Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Diffing dirty submodule: Cannot read property 'old_mode' of null #828

Closed

Description

@siggirh

Description

I have three submodules in the project directory. Two of them have local commits and thus their subprojects are dirty. The third one has unstaged changes for that git repo but clicking on the submodule inside the 'Git -> Unstaged changes' window causes an error and doesn't appear to do anything - The diff still shows whichever file I looked at last in the diff.

Steps to Reproduce

  1. Modify any file in a git submodule of the project
  2. Try clicking that submodule (which shows in the unstaged files window)
  3. Booboo.

Expected behavior:

To be honest I didn't know what to expect as this is the first time I've tried the new plugin. Should clicking the submodule open up a new 'unstaged files' window listing the files in that submodule? Are submodule supposed to be supported at all? I imagine in any case this error isn't expected. :)

Actual behavior:

Two of submodules only have local commits (no unstaged changes inside) and thus the diff shows for each:

- Subproject commit {old-hash}
+ Subproject commit {new-commit-hash}-dirty

Clicking the third one (has unstaged changes and no local commits) produces a console error and does nothing in the UI:

Uncaught (in promise) TypeError: Cannot read property 'old_mode' of null
    at postProcessDiff ({removed}\AppData\Local\atom\app-1.18.0-beta0\resources\app\node_modules\what-the-diff\lib\parser.js:1885:1)
    at peg$c4 ({removed}\AppData\Local\atom\app-1.18.0-beta0\resources\app\node_modules\what-the-diff\lib\parser.js:148:1)
    at peg$parseregular_diff ({removed}\AppData\Local\atom\app-1.18.0-beta0\resources\app\node_modules\what-the-diff\lib\parser.js:564:1)
    at peg$parsediff ({removed}\AppData\Local\atom\app-1.18.0-beta0\resources\app\node_modules\what-the-diff\lib\parser.js:439:1)
    at peg$parsediffs ({removed}\AppData\Local\atom\app-1.18.0-beta0\resources\app\node_modules\what-the-diff\lib\parser.js:403:1)
    at Object.peg$parse [as parse] ({removed}\AppData\Local\atom\app-1.18.0-beta0\resources\app\node_modules\what-the-diff\lib\parser.js:1933:1)
    at parse ({removed}\AppData\Local\atom\app-1.18.0-beta0\resources\app\node_modules\what-the-diff\index.js:6:1)
    at {removed}\AppData\Local\atom\app-1.18.0-beta0\resources\app\node_modules\github\lib\git-shell-out-strategy.js:637:1
    at next (<anonymous>)
    at step ({removed}\AppData\Local\atom\app-1.18.0-beta0\resources\app\node_modules\github\lib\git-shell-out-strategy.js:103:1)
    at {removed}\AppData\Local\atom\app-1.18.0-beta0\resources\app\node_modules\github\lib\git-shell-out-strategy.js:110:1

Reproduces how often:

100% so far :)

Versions

Windows 10 Pro 64-bit.
Atom 1.18.0-beta0 x64

Additional Information

Thank you for this plugin!

Activity

  1. BinaryMuse commented on May 17, 2017

    @BinaryMuse
    Contributor

    Thanks for the report! You're right that we don't yet support submodules well, but the error is unexpected. I'd like to leave this open to investigate.

  2. siggirh commented on May 17, 2017

    @siggirh
    Author

    Also worth noting: In the broken scenario (where the submodule has unstaged changes) - The error doesn't happen if the same submodule also has local commits. So, for each submodule:
    If local changes but no local commit - error
    If local changes and also local commit - shows Subproject hash diff
    If no local changes but has local commit - shows Subproject hash diff

  3. kuychaco commented on May 17, 2017

    @kuychaco
    Contributor

    Thanks for the report! Your last comment was very helpful in diagnosing the issue 🙇‍♀️. We've got a quick fix up in #838. It's a less than ideal solution that will prevent exceptions until we implement more full comprehensive submodule support in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions