Мне нужно преобразовать вывод журнала git в объект.
Я использую команду git log --all --graph --oneline --date-order
.
* 8896805 (origin/firstbranch) test(firstbranch): this is my commit on this branch
| * 5fef2da (HEAD -> testbranch, origin/another, another) refactor(another): this is a change
| * 2a34d72 refactor(another): typo
| * 683d704 refactor(another): changes
* | 0120274 Merge remote-tracking branch 'origin/develop' into firstbranch
|\ \
После этого я создал массив, в котором каждый элементмассив соответствует строке этого вывода.
И с этим, я хотел бы иметь такой массив:
[
{
art: "*",
commitHash: "8896805",
branches: ["origin/firstbranch"],
commitString: "test(firstbranch): this is my commit on this branch"
},
{
art: "| *",
commitHash: "5fef2da",
branches: ["testbranch", "origin/another", "another"],
commitString: "refactor(another): this is a change"
},
{
art: "| *",
commitHash: "2a34d72",
branches: [],
commitString: "refactor(another): typo"
},
{
art: "| *",
commitHash: "683d704",
branches: [],
commitString: "refactor(another): changes"
},
{
art: "* |",
commitHash: "0120274",
branches: [],
commitString: "Merge remote-tracking branch 'origin/develop' into firstbranch"
},
{
art: "|\ \",
commitHash: "",
branches: [],
commitString: ""
}
]
Но я не могу получить этот результат.
Спасибо заранее!