1
0
mirror of https://github.com/danog/gift.git synced 2024-11-26 20:04:47 +01:00

Use regex to improve commit id/hash test, cc #96

This commit is contained in:
Peter Dave Hello 2017-11-06 20:07:39 +08:00
parent b609d3d77b
commit 20ee38379e

View File

@ -83,7 +83,7 @@ module.exports = class Commit
lines = text.split "\n" lines = text.split "\n"
while lines.length while lines.length
id = _.last lines.shift().split(" ") id = _.last lines.shift().split(" ")
break if !id break if !/^[a-f0-9]{40}$/.test(id)
tree = _.last lines.shift().split(" ") tree = _.last lines.shift().split(" ")
parents = [] parents = []