gitdiff-parser
Advanced tools
Comparing version 0.2.1 to 0.2.2
ChangeLog | ||
======== | ||
0.2.2 | ||
------- | ||
+ 【feat】- 删除文件时加入 oldMode 信息;添加文件时加入 newMode 信息 | ||
0.2.1 | ||
------- | ||
+ 【bugfix】- index 行中的 mode 信息读取不正确。该问题为 0.2.0 引入 | ||
0.2.0 | ||
@@ -5,0 +17,0 @@ ------- |
31
index.js
@@ -53,17 +53,3 @@ /** | ||
// read mode change | ||
var nextLine = lines[i + 1]; | ||
if (nextLine.indexOf('old') === 0) { | ||
currentInfo.oldMode = nextLine.slice(9, 16); | ||
currentInfo.newMode = lines[i + 2].slice(9, 16); | ||
i += 2; | ||
nextLine = lines[i + 1]; | ||
} | ||
// read similarity | ||
if (nextLine.indexOf('similarity') === 0) { | ||
currentInfo.similarity = parseInt(nextLine.split(' ')[2], 10); | ||
i += 1; | ||
} | ||
// read type and index | ||
@@ -80,2 +66,14 @@ var simiLine; | ||
case 'deleted': | ||
case 'new': | ||
var leftStr = simiLine.slice(spaceIndex + 1); | ||
if (leftStr.indexOf('file mode') === 0) { | ||
currentInfo[infoType === 'new' ? 'newMode' : 'oldMode'] = leftStr.slice(10); | ||
} | ||
break; | ||
case 'similarity': | ||
currentInfo.similarity = parseInt(simiLine.split(' ')[2], 10); | ||
break; | ||
case 'index': | ||
@@ -102,2 +100,3 @@ var segs = simiLine.slice(spaceIndex + 1).split(' '); | ||
} | ||
currentInfoType = infoType; | ||
break; | ||
@@ -126,6 +125,2 @@ | ||
} | ||
if (!currentInfoType) { | ||
currentInfoType = infoType; | ||
} | ||
} | ||
@@ -132,0 +127,0 @@ |
{ | ||
"name": "gitdiff-parser", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "", | ||
@@ -14,3 +14,4 @@ "main": "index.js", | ||
"files": [ | ||
"index.js" | ||
"index.js", | ||
"index.d.ts" | ||
], | ||
@@ -17,0 +18,0 @@ "repository": { |
@@ -56,3 +56,3 @@ # gitdiff-parser | ||
isBinary?: boolean; | ||
type: 'add' | 'delete' | 'modify'; | ||
type: 'add' | 'delete' | 'modify' | 'rename'; | ||
} | ||
@@ -59,0 +59,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12243
6
216