rkotze / git-mob-vs-code

Co-author commits. A quick way to add co-author metadata to a Git commit via VS Code source control panel.
https://marketplace.visualstudio.com/items?itemName=RichardKotze.git-mob
MIT License
34 stars 9 forks source link

Empty co-authors panel / Cannot read property 'email' of undefined #25

Closed chakeresa closed 5 years ago

chakeresa commented 5 years ago

Prerequisites

Description

The GIT MOB CO-AUTHORS box in the git panel of VS Code is completely empty, and I get the following error whenever I click the commit message field or run the other git mob commands (like Git Mob: Add co-author): Cannot read property 'email' of undefined

Steps to Reproduce

  1. My .git-coauthors file looks like this (but the same happens when I make coauthors an empty object):
    {
    "coauthors": {
    "alias": {
      "name": "My Buddy",
      "email": "email@example.com"
    }
    }
    }
  2. Open VS Code's git panel
  3. Click in the commit message text box or run a command (like Git Mob: Add co-author)

Expected behaviour: I should see a list of project coauthors in the GIT MOB CO-AUTHORS box on the git panel of VS Code. I should be able to select co-authors, remove co-authors, etc. Actual behaviour: The GIT MOB CO-AUTHORS box is completely empty and I get a Cannot read property 'email' of undefined error when editing my commit message or running any git mob commands.

Reproduces how often: 100% (for the last week or two... it was working well before that)

Versions

Additional Information

chakeresa commented 5 years ago

Here are some screenshots: git mob empty git mob errors

rkotze commented 5 years ago

@chakeresa Thanks for reporting the issue. Can you open the terminal and CD to the same project folder you open vs code in. Run the commands git mob and after git mob --list. Do any of these commands give you an error?

chakeresa commented 5 years ago

Yep, I did get an error when I ran git mob just now:

Warning: Missing information for the primary author. Set with:
$ git config --global user.name "Jane Doe"
$ git config --global user.email "jane@example.com"

Running those (with my own GitHub details) solved the issue. 🎉

For others that may run into the same issue in the future, I'd recommend adding that to the "Setup" section of the extension details. Thanks @rkotze!

rkotze commented 5 years ago

@chakeresa glad you solved it. I'll update the setup section.

Just wondering, did you reinstall git?

chakeresa commented 5 years ago

Nope, I’ve been using git on this laptop without any changes since before it randomly stopped working.

I’d actually tried installing the extension on a different laptop months ago and uninstalled it almost immediately there because the panel was showing up blank there too.

rkotze commented 5 years ago

Thanks for the feedback. I would be interested in why Git Mob extension failed to install on the other laptop.

I would like to reduce the frustrations of setup and get people started quicker.

In terms of this issue you created, I've added another issue https://github.com/rkotze/git-mob-vs-code/issues/27. I don't think the extension should break cause there is no primary author, I would like to make that more obvious on what to do in the UI.

chakeresa commented 5 years ago

It installed fine on the other laptop -- it just wasn't working as expected (also had the blank panel), so I removed it.

rkotze commented 5 years ago

Ah sorry, I mean what caused it to show a blank panel. Do you think its a similar issue as you had with the primary author not being set?

No worries if you're not sure why. :)

chakeresa commented 5 years ago

I’m not sure. I just reinstalled the extension on that laptop and it worked fine this time. So did the git mob command. No idea what changed over the last few months.