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

support git blame hook #3917

Closed
Alex-Beng opened this issue Jan 10, 2025 · 3 comments
Closed

support git blame hook #3917

Alex-Beng opened this issue Jan 10, 2025 · 3 comments
Labels
triage Needs to be looked at

Comments

@Alex-Beng
Copy link

i have a private repo developed with other people, in which someone else deleted and recommitted some files. it make the gitlens blame in line showing that the recommitted files is committed by the latest guy. It makes me comfused.

when i use git blame to blame the file, it's truly showing all the lines werer committed by the guy. However, when i add git blame option with commit SHA hash before he committed, the blame result become read-able.

so i find the gitlens documentation and options, i found gitlens.advanced.blame.customArguments, so i add option in the setting.json like

{
    // other options
    "gitlens.advanced.blame.customArguments": [
        // "xxxxxx"
    ]
}

the xxxxxx is the SHA hash, the setting is global, which make it do not work with other files which is not deleted and recommitted.

i hope gitlens can support git blame hook, it work with giving the blame file name, then output blame options.

@Alex-Beng Alex-Beng added feature triage Needs to be looked at labels Jan 10, 2025
@Alex-Beng
Copy link
Author

Alex-Beng commented Jan 10, 2025

i tried to hook the setting like:

{
    // other options
    "gitlens.advanced.blame.customArguments": [
        "*>", "$null", "|", "python", "path/to/customBlame.py"
    ]
}

but it dont work when i saw the log:

[2025-01-10 07:01:05.253] [GIT      83ms] [path/to/project] git blame --root --incremental -w *> $null | python customBlame.py -- path/to/file [83ms]


[2025-01-10 07:02:18.968] [  500 →   501] LineTracker.updateState(e=10, t=path/to/file?{"path":"path/to/file","ref":"ad4bd56919ddde43a2a9d974861de041d144b27f"}) returned false • blame failed [0ms]

@Alex-Beng
Copy link
Author

i got a solution by using git rebase -i and squash commit.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
triage Needs to be looked at
Projects
None yet
Development

No branches or pull requests

1 participant