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: Git_Bash calculation error in windows powershell. #139

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

Conversation

kvii
Copy link

@kvii kvii commented Sep 11, 2023

The file sturcture of git it's looks like below in windows:

C://Program Files/Git$ tree -L 2 .
.
├── bin
│   ├── bash.exe # here is what makefile want to calculate for
│   ├── git.exe
│   └── sh.exe
├── cmd
│   ├── git-gui.exe
│   ├── git-lfs.exe
│   ├── git-receive-pack.exe
│   ├── git-upload-pack.exe
│   ├── git.exe # here is where git is
│   ├── gitk.exe
│   ├── scalar.exe
│   ├── start-ssh-agent.cmd
│   └── start-ssh-pageant.cmd
...

Makefile used the code below to calculate the path of "bash.exe".

Git_Bash=$(subst \,/,$(subst cmd\,bin\bash.exe,$(dir $(shell where git))))

But it used a wrong command dir. dir is a command like ls ., even in windows. So user that using windows can not get a correct "Git_Bash". And now I have fixed this issue.

Makefile 计算 bash.exe 路径的时候使用了一个叫 dir 的命令。这里的原意是想获取一个路径的目录名,例如 "/a/b/c.exe" -> "/a/b"。但 dir 实际上相当于 ls . ,就算在 windows 中也是这样。也就是说用错命令了。

不过 windows 里也没有 dirname 命令,所以我用了其他的手段解决问题。

@shenqidebaozi
Copy link
Sponsor Member

I am considering using buf directly to

@kvii
Copy link
Author

kvii commented Feb 28, 2024

@shenqidebaozi I think that is a breaking change in next major version. This issue is a bug fix in next patch version. There is no conflict between them.

Copy link

@windzhu0514 windzhu0514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not working on windows when use Git Bash.the problem is to find a way to compatible with git-bash,cmd and linux bash.

@kvii kvii changed the title fix: Git_Bash path calculation error in windows. fix: Git_Bash calculation error in windows powershell. Apr 23, 2024
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 23, 2024
@kvii
Copy link
Author

kvii commented Apr 23, 2024

not working on windows when use Git Bash.the problem is to find a way to compatible with git-bash,cmd and linux bash.

@windzhu0514 It is no need to calculate Git_Bash when we already in git-bash.
You said we need a solution that supports all platform. But it's not the responsibility of this PR, which is only fix the bug in windows powershell.

原文:
在 git-bash 中本来就不需要计算 Git_Bash。就算出问题了也应该让其他 PR 解决,跟这个 PR 没关系。这个 PR 只解决了在 powershell 中的问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants