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

feat: sketch for git graph node types #13

Merged
merged 3 commits into from
Aug 17, 2022
Merged

feat: sketch for git graph node types #13

merged 3 commits into from
Aug 17, 2022

Conversation

ytaek
Copy link
Contributor

@ytaek ytaek commented Aug 15, 2022

Git Graph Node Type들에 대한 약간의 스케치를 올립니다.

  • 우선적으로 View에서 참고용입니다.
  • 엔진 구현 사항에 따라서 디테일하게 바뀔 수 있습니다. 골격만 일단 이렇게 되는구나.. 정도로 보시면 좋겠습니다.
  • engine쪽에도 동일 파일 복사해놓았습니다.
  • view에서는 추후에 engine쪽에 의존성을 걸어서 @types/.../engine 으로 해서 사용하면 될 것 같습니다 (예상).

구조에 관련된 토의/질문/토론 환영합니다. 리뷰에 남겨주세요!

@ytaek ytaek requested a review from a team as a code owner August 15, 2022 08:21
@ansrlm ansrlm self-requested a review August 15, 2022 09:40
Comment on lines +4 to +16
export type CommitRaw = {
id: string,
parents: string[],
message: string,
author: string,
authorDate: string,
committer: string,
date: string,
tags: string[],
branches: string[],

// fill necessary properties...
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

�요 type은 콘솔에 찍히는 commit log를 그대로 표현하려고 해봤습니다.

Copy link
Contributor Author

@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.

소스코드에 커멘트를 남겼으니 참고해주시고,
이건 말그대로 "스케치" 이니, 실제 구현에 따라서 바꾸면 되겠습니다.

  • directory 구조가 결정되면 그곳으로 옮기거나, 새로 만들어 주는게 좋겠고,
  • 추후에 engine은 이 type들을 외부로 export하고,
  • view는 type만 import해서 쓰면 되겠습니다.

Comment on lines +36 to +41
parents: Commit[],
author: GitHubUser,
committer: GitHubUser,
authorDate: Date,
commitDate: Date,
diffStatistics: DiffStatistics,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

CommitRaw의 primitive type들을 객체 형태로 바꾼 거라고 봐도 될 것 같습니다.

export type NodeTypeName = typeof NODE_TYPE_NAME[number];

export type NodeBase = {
nodeTypeName: NodeTypeName;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

여긴 나중에 node type별로 분기를 탈 일이 있을까봐 일단 선언해봤습니다.

Comment on lines +68 to +70
hasMajorTag: boolean,
hasMinorTag: boolean,
isMergeCommit: boolean,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

node에는 log에서 가져온 commit이라는 객체 외에
우리가 분석하는 과정, 분석한 후에 사용될 properties를 담는 곳이라고 보면 되겠습니다.

Comment on lines +73 to +76
export type ClusterNode = NodeBase & {
nodeTypeName: 'CLUSTR',
commitNodeList: CommitNode[],
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

commit들을 묶을 놈인데, 이게

  • PR이 될 수도 있고.
  • CSM이 된 node가 될 수도 있고,
  • 유사도에 따라 묶은 cluster가 될 수도 있을 것 같습니다.

이름이 별로 안 이�쁘긴 하네요 ㅜ.ㅜ

@@ -0,0 +1,7 @@
import { NodeType } from "./NodeTypes.temp"

export type ViewNode = {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

엔진에서 만든 node를 감싸서 view에서 사용될 정보들을 모아놓은 곳입니다.

githru(org) 에서는 상대적 x,y 위치나, 절대적 좌표 등등의 정보들이 다 들어갔는데, 이번에도 그런 rendering정보들을 넣으면 될 것 같습니다.

parents: string[],
message: string,
author: string,
authorDate: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

이름이 왜 commitDate이 아니라 authorDate인가 해서 찾아봤는데, 둘 다 기록되는 값이고 두가지가 다르게 쓰이네요!
참고: stackoverflow, Git book

  • authorDate => 커밋이 만들어진 시간, 변경되지 않음
  • commitDate => 커밋에 대한 작업이 마지막으로 적용된 시간, 변경될 수 있음 (ex. rebase, cherry-pick 등등)
  • author => 커밋을 생성한 오리지널 작업자
  • committer => 커밋에 영향을 주는 작업을 한 작업자

새로 알게되어서 기록 겸 코멘트로 남겨요 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

와우 날카로우시네요!!

명확한게 어떻다.. 이런건 저도 까먹고 있었는데;; 😄
정리 잘해주셔서 감사합니다!!!

저게 signed-off-by랑 엉켜서

가능하시면, 해당 부분을 어딘가에 정보 처럼 저장해놓는것도 괜찮을 것 같습니다.
Reference in new Issue로 열어주셔도 검색하기 편할 것 같네요. (아무나 해주셔요 ㅎㅎㅎ)

@ytaek ytaek merged commit 00ff228 into githru:main Aug 17, 2022
@hanseul-lee hanseul-lee added this to the v0.1.0 milestone Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants