trace-decision: find the commit inside a squash-merged pull request that changed a line
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Read the trace-decision collector change in #56 and the decision in #54, then review the manual git fetch and git blame steps in this issue. The proposal is explicitly deferred until a real squash merge demonstrates the problem or a user finds the manual steps too slow; done would require mapping questioned lines from the squash commit to the pull request head and identifying the relevant commit.
Written by the indexing model from the issue text.
Description
Problem to solve
After a squash merge, git blame finds only the squash commit. The commits inside the pull request are not in the Git history. GitHub keeps them in refs/pull/<number>/head, also after the head branch is deleted (tested in https://github.com/c-w-z/commit-decision-record/issues/49#issuecomment-7298506022).
The trace-decision collector finds the pull request of a squash commit and prints the messages of all its commits (#56). It does not tell which of those commits changed the lines of the question. #54 allows a reason for a choice inside a change to be in a commit of the pull request. In a pull request with many commits, each with its own Why, the reader must then read all messages and judge which one is about the lines.
With a merge commit, the commits inside the pull request stay in Git, and git blame already finds the commit that changed the lines.
Proposal
Do not build this now. This repository has no squash-merged pull request yet, so no case shows that the messages of all commits are not enough (C1 in #54).
Build it when one of these occurs:
trace-decisiongives a wrong reason, or cannot choose a reason, because a squash-merged pull request has many commits with different reasons.- A user asks for the commit inside a squash-merged pull request that changed a line, and the manual steps below are too slow.
Possible design: fetch refs/pull/<number>/head, map the lines of the question from the squash commit to the head of the pull request, and run git blame there. The mapping is needed because GitHub applies the changes of the pull request onto the base branch at the merge, and the head of the pull request can be on an older base. Not tested: how often the line numbers differ.
Manual steps until then:
git fetch origin pull/<number>/head
git blame -L <start>,<end> FETCH_HEAD -- <file>
The line numbers in FETCH_HEAD can differ from the line numbers in the current file.
Version
c304b28
More information
- Decision: #54
- Collector change: #56
- Dominant language
- Shell
- Stars
- 1
- Forks
- 0
- Avg merge
- 6h 59m
- Merged PRs (30d)
- 26
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from c-w-z/commit-decision-record
-
type/documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
c-w-z/commit-decision-record#90 · 1 comment ·
Maintainers usually reply within 1 day
-
type/documentation
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
c-w-z/commit-decision-record#85 ·
Maintainers usually reply within 1 day
-
type/documentation
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
c-w-z/commit-decision-record#84 ·
Maintainers usually reply within 1 day
-
type/feature
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
c-w-z/commit-decision-record#35 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue type/documentation
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
c-w-z/commit-decision-record#33 ·
Maintainers usually reply within 1 day
All issues in c-w-z/commit-decision-record
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsotto/sotto-authenticator#139 ·
Maintainers usually reply within 1 day
-
Battery "top up once" ends immediately when UPower reports fully-charged below 100%Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
omacom/omarchy#21286 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
libretro/libretro-super#2238 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ChurchCRM/docs.churchcrm.io#328 ·
Maintainers usually reply within 1 day