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] branch 정보 누락 문제 #90

Closed
blcklamb opened this issue Sep 6, 2022 · 1 comment
Closed

[engine] branch 정보 누락 문제 #90

blcklamb opened this issue Sep 6, 2022 · 1 comment
Assignees
Labels
🔍 analysis engine bug Something isn't working

Comments

@blcklamb
Copy link
Contributor

blcklamb commented Sep 6, 2022

관련 상세 정보 및 PR

문제 상황

terminal에 직접 git --no-pager log --all --parents --numstat --date-order --pretty=fuller -c 실행 시 branch 정보가 뜨는데,
image

[packages/analysis-engine/src/parseSpawn.ts]에서 실행되는 spawn으로 받아온 데이터에서는 branch가 누락되어 전달됩니다.
image

  • terminal에서 실행하는 git version과 spawn시 실행하는 git version은 동일합니다.

예상 원인

spawn에서 데이터를 받아서 가공하는 방식 또는 데이터를 받는 것 자체에서 문제가 생기는 것 같은데, 아직 제대로된 원인을 파악하지 못했습니다.

@blcklamb blcklamb added bug Something isn't working 🔍 analysis engine labels Sep 6, 2022
@blcklamb blcklamb self-assigned this Sep 6, 2022
@blcklamb
Copy link
Contributor Author

blcklamb commented Sep 6, 2022

관련 git documentation

image

image

자료를 읽고 해석한 바를 코멘트 남기자면, --decorate option을 주기 전에는 decoration 값은 auto입니다.

해당 값이 auto 일 경우, git log의 output이 터미널로 갈 경우에만 ref 정보(branch, tag, ref...)가 나타나지고,

그렇지 않다면 ref 정보를 보여주지 않는 것입니다.

여기서 spawn으로 git log output을 꺼내오는 과정이 터미널에 가는 경우에 해당하지 않는 것으로 보입니다.

혹시 다른 의견이 있다면 추가 코멘트 달아주세요!

우선 문제는 해결되었으니 닫도록 하겠습니다.

@blcklamb blcklamb closed this as completed Sep 6, 2022
blcklamb added a commit to blcklamb/githru-vscode-ext that referenced this issue Sep 6, 2022
git log output 중 ref 정보가 terminal에서는 보여지지만 spawn을 했을 때  보여지지 않는 에러를 해결
blcklamb added a commit that referenced this issue Sep 9, 2022
* feat(engine): add parseSpawn

* feat(engine): add parseIndex

* feat(engine): add parseLog ids, parents, branches

* feat(engine): parseLog to JSON

tags, author, authorDate, committer, commitDate, messages, differenceStatistics까지 추가하였습니다.

* chore(engine): 불필요한 코드 제거

* fix(engine): [object]로 표시되는 부분 수정

console.log로 찍을 때 2뎁스 이하로 내려가는 부분이 [object]로 표기되어 해당 depth를 설정하는 코드 추가

* feat(engine): parse 부분 index.ts 작성

build 후 바로 git log 명령어와 parse를 실행하도록 수정했습니다.
parseToJSON(value)의 return 값이 CommitRaw(JSON)입니다.

* refact(engine): erase useless lines

* chore(engine): delete parseIndex.ts

index.ts에 통합하여 기존 별도로 구분된 parse 전용 index는 삭제

* feat(engine): sequenceNumber field add

이후 DAG, STEM 작업을 위해 각 커밋의 순서를 나타내는 필드 추가

* fix(engine): eslint error

* refact(engine): 문기님 피드백 반영 사항

- getNameAndEmail 함수 추가
- eslint 걸리는 것 우회
- parseSpawn에서 오타 수정
- 선언자 수정
- sequenceNumber 이름 수정

* fix(engine): add trim()

branch 및 tag가 파싱될 때 앞에 공백이 들어가는 것을 제거하기 위해 trim()을 썼습니다.

* fix(engine): #90 이슈 해결

git log output 중 ref 정보가 terminal에서는 보여지지만 spawn을 했을 때  보여지지 않는 에러를 해결

* refact(engine): PR comment 피드백 반영

- slice를 startswith으로 대체했습니다.
- if else 중첩을 줄이고 early return을 적용했습니다.
- JSONArray 선언 코드 위치를 사용 직전으로 옮겼습니다.

* fix(engine): eslint error

- consistent-return 에러 해결을 위해 return false를 추가

* fix(engine): PR comment 반영

- inspect 출력 형식을 디버깅 때만 사용하여 제거
- 2D array의 경우 의미 파악을 위해 ~Matrix로 변수명을 변경하고 같은 의미를 가진 것에 대한 타입을 추가

* feat(engine): consider empty input

parseToJSON("")일 때 early return이 되도록 추가

* feat(engine): sequence field in test file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔍 analysis engine bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant