Skip to content

[BUG] parent file is invalid json #5

@hjylewis

Description

@hjylewis

What / Why

Often times our "parent" file contains the closing } but not the opening {. The opening { is instead part of the "ours" and theirs" files. Since the closing } is common, it is part of "parent". Because of this, the "parent" file is invalid JSON and the function fails.

Where

  • npm/parse-conflict-json

How

Current Behavior

parseConflictJSON fails because the parent file is includes the common ending }.

Steps to Reproduce

Pass the following string to parseConflictJSON

{
	"/ikB9l": {
		"message": "first"
	},
<<<<<<< HEAD
	"/ikD9l": {
		"message": "second!"
	},
	"/ikE9l": {
		"message": "third"
=======
	"/ikB9m": {
		"message": "2 second"
	},
	"/ikB9p": {
		"message": "2 third"
>>>>>>> git-conflict-2
	},
	"+BB+Te": {
		"message": "last"
	}
}

Expected Behavior

Since this is a common conflict for our use case, ideally this would be resolved without throwing an error. Removing parsing the "parent" and just merging "ours" and "theirs" fixes the issue for us. Not sure what would be ideal for this library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions