Skip to content
This repository has been archived by the owner on Nov 28, 2018. It is now read-only.

parseDiffFile failed #219

Open
gallyamb opened this issue Apr 15, 2017 · 0 comments
Open

parseDiffFile failed #219

gallyamb opened this issue Apr 15, 2017 · 0 comments

Comments

@gallyamb
Copy link

gallyamb commented Apr 15, 2017

Given

diff --git a/views/blocks/sortPanel/index.styl b/views/blocks/sort_panel/index.styl
similarity index 100%
rename from views/blocks/sortPanel/index.styl
rename to views/blocks/sort_panel/index.styl
diff --git a/views/pages/authorization/index.styl b/views/pages/authorization/index.styl
new file mode 100644
index 0000000..06e0305
--- /dev/null
+++ b/views/pages/authorization/index.styl
@@ -0,0 +1,36 @@
+@import '../../blocks/index'
+@import '../../blocks/header'

When

parseDiffFile(givenLines)

Then

Error: Invalid line, should start with something like `diff --git a/`, instead got 
index 0000000..06e0305

    at parseDiffFile (/app/mention-bot.js:91:11)
    at parseDiff (/app/mention-bot.js:180:16)
    at Object.guessOwnersForPullRequest$ (/app/mention-bot.js:654:15)
    at tryCatch (/app/node_modules/regenerator-runtime/runtime.js:64:40)
    at Generator.invoke [as _invoke] (/app/node_modules/regenerator-runtime/runtime.js:299:22)
    at Generator.prototype.(anonymous function) [as next] (/app/node_modules/regenerator-runtime/runtime.js:116:21)
    at tryCatch (/app/node_modules/regenerator-runtime/runtime.js:64:40)
    at invoke (/app/node_modules/regenerator-runtime/runtime.js:154:20)
    at /app/node_modules/regenerator-runtime/runtime.js:164:13
    at process._tickCallback (internal/process/next_tick.js:109:7)

How to fix

https://github.com/facebook/mention-bot/blob/master/mention-bot.js#L109
Change from

line = lines.pop();

to

if (startsWith(line, 'index')) {
  line = lines.pop();
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant