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

Git blame fails from a worktree #19842

Closed
1 task done
fasterthanlime opened this issue Oct 28, 2024 · 1 comment · Fixed by #20164
Closed
1 task done

Git blame fails from a worktree #19842

fasterthanlime opened this issue Oct 28, 2024 · 1 comment · Fixed by #20164
Assignees
Labels
bug [core label] priority request A request from a stakeholder or influential user rust Rust programming language support workspace Feedback for workspace management, layout, interactions, etc

Comments

@fasterthanlime
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

CleanShot 2024-10-28 at 17 31 04@2x

This happens when the "inline git blame" feature triggers. From the main repo, it works fine.

Environment

Zed: v0.159.1 (Zed Preview)
OS: macOS 15.0.1
Memory: 8 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log
@fasterthanlime fasterthanlime added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Oct 28, 2024
@fasterthanlime
Copy link
Author

You can repro with something like:

mkdir ~/gh-19842
cd ~/gh-19842
git clone https://github.com/fasterthanlime/hi
cd hi
git worktree add ../hi-worktree 6341517

Then open zed in ~/gh-19842/hi-worktree, open any file, notice the notif that tells you it cannot git blame.

Notably, the .git/ folder in a worktree is... a file:

hi on  main [+] is 📦 v0.3.0 via 🦀 v1.81.0
❯ cat .git
cat: .git: Is a directory

hi on  main [+] is 📦 v0.3.0 via 🦀 v1.81.0
❯ cat ../hi-worktree/.git
gitdir: /Users/amos/axo/hi/.git/worktrees/hi-worktree

(When you're done, don't forget to git worktree remove ../hi-worktree — this needs to be run from within hi)

@notpeter notpeter added workspace Feedback for workspace management, layout, interactions, etc rust Rust programming language support priority request A request from a stakeholder or influential user and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Oct 28, 2024
@mrnugget mrnugget self-assigned this Nov 4, 2024
@mrnugget mrnugget moved this to In Progress in Quality Week Fall 2024 Nov 4, 2024
@github-actions github-actions bot added admin read Pending admin review triage Maintainer needs to classify the issue labels Nov 5, 2024
@as-cii as-cii self-assigned this Nov 5, 2024
@JosephTLyons JosephTLyons removed triage Maintainer needs to classify the issue admin read Pending admin review labels Nov 5, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Quality Week Fall 2024 Nov 6, 2024
CharlesChen0823 pushed a commit to CharlesChen0823/zed that referenced this issue Nov 18, 2024
This adds support for [git
worktrees](https://matklad.github.io/2024/07/25/git-worktrees.html). It
fixes the errors that show up (git blame not working) and actually adds
support for detecting git changes in a `.git` folder that's outside of
our path (and not even in the ancestor chain of our root path).

(While working on this we discovered that our `.gitignore` handling is
not 100% correct. For example: we do stop processing `.gitignore` files
once we found a `.git` repository and don't go further up the ancestors,
which is correct, but then we also don't take into account the
`excludesFile` that a user might have configured, see:
https://git-scm.com/docs/gitignore)


Closes zed-industries#19842
Closes zed-industries#4670

Release Notes:

- Added support for git worktrees. Zed can now open git worktrees and
the git status in them is correctly handled.

---------

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Bennet <bennet@zed.dev>
@mrnugget mrnugget mentioned this issue Nov 26, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] priority request A request from a stakeholder or influential user rust Rust programming language support workspace Feedback for workspace management, layout, interactions, etc
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants