Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[engine] git log 파싱에 사용되는 separator 개선 #770

Merged
merged 12 commits into from
Oct 22, 2024

Conversation

yoouyeon
Copy link
Contributor

Related issue

Result

AS-IS

COMMIT_SEPARATORGIT_LOG_SEPARATOR를 난수 문자열로 사용

git log format

<COMMIT_SEPARATOR><commit hash><GIT_LOG_SEPARATOR><parent hashes><GIT_LOG_SEPARATOR><refs(branches, tags><GIT_LOG_SEPARATOR><author name><GIT_LOG_SEPARATOR><author email><GIT_LOG_SEPARATOR><author date><GIT_LOG_SEPARATOR><committer name><GIT_LOG_SEPARATOR><committer email><GIT_LOG_SEPARATOR><committer date><GIT_LOG_SEPARATOR><commit message><GIT_LOG_SEPARATOR>
<diffstat>

format example

4itc2s8hH-oA64s08h19ofyms0k2vdw7l3yjed2xwranqa0bx0oyeji6ult2I9M-0XOzvHlYPegVPpzbuiugrjiony42hzos0x8rz6aopsx3euzp6sxxthncI9M-0XOzvHlYPegVPpzbHEAD -> mainI9M-0XOzvHlYPegVPpzbJohn [email protected] Sep 4 20:17:59 2022 +0900I9M-0XOzvHlYPegVPpzbJohn Park [email protected] Sep 5 20:17:59 2022 +0900I9M-0XOzvHlYPegVPpzbcommit message title
commit message bodyI9M-0XOzvHlYPegVPpzb
1	0	a.ts

TO-BE

  • commit separator: \n 4개 (--numstat 옵션에서 기본적으로 적용되는 \n 2개 + 직접 지정한 \n 2개)
  • git log separator: \n

git log format


<commit hash>
<parent hashes>
<refs(branches, tags>
<author name>
<author email>
<author date>
<committer name>
<committer email>
<committer date>
<commit message subject>
<commit message body>
<diffstat>


format example



ofyms0k2vdw7l3yjed2xwranqa0bx0oyeji6ult2
uiugrjiony42hzos0x8rz6aopsx3euzp6sxxthnc
HEAD -> main
John Park
[email protected]
Sun Sep 4 20:17:59 2022 +0900
John Park 2
[email protected]
Sun Sep 5 20:17:59 2022 +0900
commit message title
    commit message body
1	0	a.ts


test result

Screen_Shot 2024-10-15 20 48 14

Work list

  • commit을 구분하는 separator를 난수에서 "\n"의 조합으로 변경했습니다.
    • commit separator: \n 4개 (--numstat 옵션에서 기본적으로 적용되는 \n 2개 + 직접 지정한 \n 2개)
    • git log separator: \n
  • commit message 데이터를 subject와 body로 분리하고, body 앞에 space(" ") 4개의 indentation을 두었습니다.
  • 변경된 format에 맞게 TC를 수정했습니다.

Discussion

Copy link
Contributor

@ytaek ytaek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGGGGTM 입니다!!!

``${FRONT_NEW_LINE}${fakeCommitHash}\n${fakeCommitRef}\n${fakeAuthor}\n${fakeCommitter}`

굳이 따지자면 요런 부분들이 가독성을 조금 해쳐서, 조금 변수화 시키는것도 괜찮을 것 같습니다.
아니면 아예 string value로 그대로 표현해도 좋을 것 같아요.

@@ -1,5 +1,4 @@
import { getCommitMessageType } from "./commit.util";
import { COMMIT_SEPARATOR, GIT_LOG_SEPARATOR } from "./constant";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

드디어 사라졌군요!!! 🎆🎆🎆

@yoouyeon yoouyeon merged commit 59d163c into githru:main Oct 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[engine] git log 파싱에 사용되는 separator 개선
3 participants