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

Fix opening repos when .git is a soft link #21153

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

can2049
Copy link

@can2049 can2049 commented Nov 25, 2024

Closes #ISSUE

background

If a project is big, some times it will be splited into many small git repos.
google repo is a tool to manage a group of git repos.

But, any small git repo manged by this tool, have a difference with normal git repo.
That is , the path .git in the root of the git repo, is not a normal directory, but a soft link to real git bare dir.

zed can not recognize the git-repo managed git repos

you can use the procedure to genreate this problem

# tested on linux
mkdir -p bad_git_repo_project
cd bad_git_repo_project
git init
echo "hello" > hi.txt
git add .
git commit -m "init commit"
echo "hello world" >> hi.txt

# modify the repo
mv .git ../.real_git_repo
ln -sf ../.real_git_repo .git

with vscode, after opening this project, git works well.
but for Zed, git not work(not git status, no git blame)

how to fix

libgit2 can recognize git repo from the root of the project(dir that have .git).
so, we can recognize the git project by opening from the project root dir, but not the .git dir

This fix also works with normal git project.

before fix

image

after fix

image

Release Notes:

  • Fixed opening repos when .git is soft link

@maxdeviant maxdeviant changed the title fix: cannot recognize a project that .git is soft link Fix opening repos when .git is a soft link Nov 25, 2024
@can2049
Copy link
Author

can2049 commented Nov 25, 2024

@cla-bot check

@SomeoneToIgnore SomeoneToIgnore added the cla-signed The user has signed the Contributor License Agreement label Nov 25, 2024
@zed-industries-bot
Copy link

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against 9ca1803

@can2049
Copy link
Author

can2049 commented Nov 25, 2024

@maxbrunsfeld can you help me review this change?

@can2049 can2049 force-pushed the can/fix_not_recognize_git_repo_that_dot_git_is_soft_link_1125 branch from 9ca1803 to 06dccc5 Compare November 27, 2024 11:17
Copy link

cla-bot bot commented Nov 27, 2024

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: CanWang.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@cla-bot cla-bot bot removed the cla-signed The user has signed the Contributor License Agreement label Nov 27, 2024
@can2049 can2049 force-pushed the can/fix_not_recognize_git_repo_that_dot_git_is_soft_link_1125 branch from 06dccc5 to 0f1c680 Compare November 27, 2024 11:21
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Nov 27, 2024
@can2049 can2049 force-pushed the can/fix_not_recognize_git_repo_that_dot_git_is_soft_link_1125 branch from 0f1c680 to edb9813 Compare December 2, 2024 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants