Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property '0' of null #96

Closed
janbro opened this issue Jul 11, 2017 · 21 comments
Closed

Cannot read property '0' of null #96

janbro opened this issue Jul 11, 2017 · 21 comments

Comments

@janbro
Copy link

janbro commented Jul 11, 2017

This is happening when I pass "HEAD" and a merge commits hash to the diff function.

ref5 = /^index\s([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+)\s?(.+)?$/.exec(lines.shift()), m = ref5[0], a_blob = ref5[1], b_blob = ref5[2], b_mode = ref5[3];
                                                                                                ^

TypeError: Cannot read property '0' of null
    at Function.module.exports.Diff.parse (/Users/[redacted]/Documents/[redacted]/node_modules/gift/lib/diff.js:81:97)
    at /Users/[redacted]/Documents/[redacted/node_modules/gift/lib/repo.js:170:39
    at ChildProcess.exithandler (child_process.js:197:7)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at maybeClose (internal/child_process.js:899:16)
    at Socket.<anonymous> (internal/child_process.js:342:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at Pipe._handle.close [as _onclose] (net.js:511:12)```
@PeterDaveHello
Copy link

Same problem here.

@notatestuser
Copy link
Owner

It might just be a case of that regex having to catch "HEAD" too. Could you try that and let me know if it resolves the problem?

@PeterDaveHello
Copy link

PeterDaveHello commented Nov 1, 2017

for me, I don't know what's the problem yet but I got that problem on this repo: github.com/mervick/emojionearea, just FYI, I may test about the HEAD you mention soon :)

@MichalW
Copy link

MichalW commented Nov 4, 2017

Same problem here:

ref1 = /^.+? (.*) (\d+) .*$/.exec(line), m = ref1[0], actor = ref1[1], epoch = ref1[2];

TypeError: Cannot read property '0' of null
at Function.module.exports.Commit.actor (.npm/package/node_modules/gift/lib/commit.js:176:56)
at Function.module.exports.Commit.parse_commits (.npm/package/node_modules/gift/lib/commit.js:139:21)
at .npm/package/node_modules/gift/lib/commit.js:99:39
at ChildProcess.exithandler (child_process.js:191:7)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:862:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)

@notatestuser
Copy link
Owner

notatestuser commented Nov 5, 2017

Could you have a look into what the problem is here? A pull request to fix it would be appreciated.

@PeterDaveHello
Copy link

All I currently know is the problem appears with https://github.com/mervick/emojionearea, but I didn't know what's the problem to cause it yet, only some repos got this problem very recently, not sure if GitHub or git did anything.

@notatestuser
Copy link
Owner

@janbro @MichalW @PeterDaveHello which versions of git are you using?

@PeterDaveHello
Copy link

@notatestuser I use git v2.7.4 and v2.14, same problem.

btw, I found the problem also exists with https://github.com/zabuto/calendar (and slowly increasing on different repository)

@MRWS
Copy link

MRWS commented Nov 6, 2017

Got the same problem with https://github.com/shinnn/gulp-gh-pages/ on git v2.13.5

@MichalW
Copy link

MichalW commented Nov 6, 2017

I have the impression that the problem occurs only with github (not bitbucket)
my git version: v2.11.0

PeterDaveHello added a commit to PeterDaveHello/gift that referenced this issue Nov 6, 2017
@PeterDaveHello
Copy link

Okay I noticed that the commit id/hash test is not reliable, PR #98 sent!

@PeterDaveHello
Copy link

#98 merged! Anyone wants to help test it? (Or even help review some related code!)

@notatestuser
Copy link
Owner

notatestuser commented Nov 6, 2017

Guys, please have a quick test with the problematic repositories mentioned above and I'll get this published. I don't want to break anyone's project. And thanks @PeterDaveHello!

@brecke
Copy link

brecke commented Nov 6, 2017

The fix worked for me!

@PeterDaveHello
Copy link

PeterDaveHello commented Nov 6, 2017

@notatestuser give me few more mins to test :) BTW, It'll be great if #100 can also land on the next release.

@notatestuser
Copy link
Owner

Ran through some tests myself. Published in v0.10.1.

mhelvens added a commit to QubitProducts/bapistrano that referenced this issue Nov 6, 2017
…trano when installing with yarn, regardless of what gift-wrapper does.

Discussion about bug: notatestuser/gift#96
"resolutions" feature in yarn: https://yarnpkg.com/lang/en/docs/selective-version-resolutions
yeshiqing added a commit to yeshiqing/resume-generator that referenced this issue Dec 22, 2017
since the gulp-gh-pages doesn't update gift dependency for a long time,
I'm use the @tekd's fork as an interim solution.
refrence:
shinnn/gulp-gh-pages#117
notatestuser/gift#96
@shockwave22
Copy link

Found the fix to this error!
1> After you install gulp-gh-pages using npm, navigate to the below folder

node_modules\gulp-gh-pages\node_modules

2> delete gift folder under gulp-gh-pages

3> npm install gift

@notatestuser
Copy link
Owner

notatestuser commented Feb 18, 2018

Yes, the author of gulp-gh-pages should update gift to resolve shinnn/gulp-gh-pages#116 and shinnn/gulp-gh-pages#117.

@mryellow
Copy link

mryellow commented Jul 7, 2019

gulp-gh-pages doesn't support gulp <= v3.x. Update your project to use gulp >= v4.0.0.

Is this patched for a Gulp3 version of gulp-gh-pages? Not wishing to ever "upgrade" to Gulp4.

@flipsasser
Copy link

For anyone still having this problem who happens to also be using Yarn, I added a field to "resolutions" in package.json to ensure the right version of Gift wins when running yarn install:

In my package.json file I added:

{
  ...other package.json stuff...,
  "resolutions": {
    "gift": "^0.10.2"
  }
}

This solved the problem for me.

@pratha-solutelabs
Copy link

Same problem here:

ref1 = /^.+? (.*) (\d+) .*$/.exec(line), m = ref1[0], actor = ref1[1], epoch = ref1[2];

TypeError: Cannot read property '0' of null
at Function.module.exports.Commit.actor (.npm/package/node_modules/gift/lib/commit.js:176:56)
at Function.module.exports.Commit.parse_commits (.npm/package/node_modules/gift/lib/commit.js:139:21)
at .npm/package/node_modules/gift/lib/commit.js:99:39
at ChildProcess.exithandler (child_process.js:191:7)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:862:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)

I have received same issue right now. Can anyone tell me how do i fix it? @MichalW what solution worked for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants