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

Can't analyse deleted paths #7

Open
L3viathan opened this issue Mar 19, 2025 · 3 comments
Open

Can't analyse deleted paths #7

L3viathan opened this issue Mar 19, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@L3viathan
Copy link

In a repo of mine, the directory containing most code was moved relatively recently.

When I call git who without params, the top committer has hundreds of commits, but most of these commits happened on the (moved) folder.

$ git who
┌─────────────────────────────────────────────────────┐
│Author                            Last Edit   Commits│
├─────────────────────────────────────────────────────┤
│[REDACTED]                        1 month ago     676│
│[REDACTED]                        2 mon. ago       78│
│[REDACTED]                        4 yr. ago         5│
...
$ git who src
┌─────────────────────────────────────────────────────┐
│Author                            Last Edit   Commits│
├─────────────────────────────────────────────────────┤
│[REDACTED]                        1 month ago      16│
│[REDACTED]                        6 mon. ago        1│
└─────────────────────────────────────────────────────┘
$ git who previousname  # now at "src/previousname"
Git subprocess exited with code 128. Error output:
fatal: ambiguous argument 'previousname': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
$ git who *
┌─────────────────────────────────────────────────────┐
│Author                            Last Edit   Commits│
├─────────────────────────────────────────────────────┤
│[REDACTED]                        1 month ago     385│
│[REDACTED]                        2 mon. ago       51│
│[REDACTED]                        4 yr. ago         3│
...
@sinclairtarget
Copy link
Owner

I'm not sure what you're asking exactly. Are you trying to run git who on previousname, to get a sense for how many commits were made by each author to that old directory?

You should be able to do this by running git who -- previousname. Just like with git log, if the path isn't present in the working tree, you need to add the --.

Let me know if that works!

@L3viathan
Copy link
Author

L3viathan commented Mar 20, 2025

Yeah, that doesn't work.

git log -- previousname shows me all commits made involving that path, git who -- previousname has the same error output as git who previousname.


Steps to reproduce:

$ git init
$ git commit -m 'commit 1' --allow-empty
$ echo test >foo
$ git add foo && git commit -am 'commit 2'
$ git who  # shows 2 commits
$ git mv foo bar && git commit -m 'commit 3'
$ git who  # shows 3 commits
$ git who bar  # shows only 1 commit
$ git who foo  # errors

@sinclairtarget
Copy link
Owner

Hmm, thanks for spotting this. I think I had this working at one point but maybe since broke it.

I definitely intended that this should work, so stay tuned for a fix.

@sinclairtarget sinclairtarget added the bug Something isn't working label Mar 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants