Skip to content

fix: 같은 이름의 태그가 있어도 고른 브랜치로 diff한다 - #98

Merged
say8425 merged 2 commits into
mainfrom
fix/branch-tag-ambiguity
Oct 5, 2026
Merged

say8425 merged 2 commits into
mainfrom
fix/branch-tag-ambiguity

Conversation

@say8425

@say8425 say8425 commented Oct 4, 2026

Copy link
Copy Markdown
Owner

요약

Closes #73.

같은 이름의 브랜치와 태그가 함께 있으면 피커에서 브랜치를 골라도 git이 태그로 해석했다. 경고는 stderr로 삼켜져 에러 없이 엉뚱한(대개 빈) diff가 나왔다.

  • verifyBaseRef가 짧은 이름을 refs/heads/<n> → refs/remotes/<n> → 이름 그대로 순으로 전체 refname에 고정해 git에 넘긴다. base·head 두 축이 모두 이 함수를 지나므로 diff·summary·blob이 함께 고쳐진다.
  • auto base(resolveBaseRef)도 refs/remotes/origin/<n>·refs/heads/<n>을 쓴다(main이라는 태그가 있어도 기본 브랜치를 본다).
  • .claude/rules/server.md에 계약과 회귀망을 적었다.

이슈의 제안과 다르게 한 점

이슈는 wire에 전체 refname을 싣자고 했다. 하지만 두 축 모두 verifyBaseRef라는 한 지점을 지나 git에 닿으므로, 서버에서 고정하면 충분하다. 그래서:

  • wire·URL·피커·툴바·PR 칩은 짧은 이름 그대로다. 공유 URL이 길어지지 않고 기존 링크·CLI 플래그도 그대로 동작한다.
  • 브랜치가 아닌 태그·SHA·HEAD~1은 예전처럼 이름 그대로 git에 간다.
  • 같은 이름의 브랜치가 있을 때 URL로 태그를 원하면 tags/<n>나 refs/tags/<n>로 적으면 된다(피커는 태그를 내놓지 않는다).

테스트 계획

  • 회귀망 diff-server.test.ts "a branch and a tag with the same name": head·base·auto 세 축에서 태그를 브랜치와 다른 커밋에 붙인 픽스처. 구현 전에는 3개 모두 실패하는 것을 확인했고, 브랜치가 없는 태그는 그대로 풀리는 대조군도 있다
  • bun run test:coverage: 933 pass, 100% 게이트 통과
  • bun run typecheck · bun run lint · bun run format:check
  • 보안 검토: - 접두 검사는 원래 값에 그대로 먼저 돌고, 접두가 붙은 값은 refs/로 시작해 옵션이 될 수 없다
  • CI 필수 체크 5개 초록(e2e 포함)

🤖 Generated with Claude Code

https://claude.ai/code/session_01KpvgkrzKwuEHis6fKXgyPT

say8425 and others added 2 commits October 4, 2026 21:58
피커에서 고른 base·head는 짧은 이름 그대로 git에 갔는데, git은 같은 이름이면
태그를 브랜치보다 먼저 해석한다. 경고가 stderr로 삼켜져 에러 없이 엉뚱한(대개
빈) diff가 나왔다.

verifyBaseRef가 짧은 이름을 refs/heads/ → refs/remotes/ → 이름 그대로 순으로
전체 refname에 고정해 git에 넘긴다. auto base(resolveBaseRef)도 전체 refname을
쓴다. wire·URL·피커·툴바 표시는 짧은 이름 그대로라 기존 링크가 깨지지 않고,
브랜치가 아닌 태그·SHA·HEAD~1은 예전처럼 통과한다.

Closes #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KpvgkrzKwuEHis6fKXgyPT
verifyBaseRef가 head를 전체 refname으로 고정하면서 /api/summary의 branch가
"refs/heads/feat"가 되어 카드가 "on refs/heads/feat"라고 적었다. 카드에는
사용자가 고른 이름을 따로 넘긴다. RepoSummary.ref 주석도 바뀐 모양에 맞춘다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KpvgkrzKwuEHis6fKXgyPT
@say8425
say8425 merged commit 5ee8749 into main Oct 5, 2026
5 checks passed
@say8425
say8425 deleted the fix/branch-tag-ambiguity branch October 5, 2026 10:45
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.

head/base 축: 브랜치와 태그가 동명이면 태그가 이겨 엉뚱한 diff가 조용히 나온다

1 participant