2

Hello and thanks for the help

Msys64 on Windows 10 platform

I am new to git. I am contributing to Kicad and this requires clang-format. I followed the instructions here https://dev-docs.kicad.org/en/rules-guidelines/code-style/ and I get no complaints.

However, when I run the suggested line

git check-format

I get "no modified files to format" if I run it after git commit

or

Traceback (most recent call last): File "C:/msys64/mingw64/bin/git-clang-format", line 579, in main()

File "C:/msys64/mingw64/bin/git-clang-format", line 154, in main cd_to_toplevel()

File "C:/msys64/mingw64/bin/git-clang-format", line 336, in os.chdir(toplevel)

FileNotFoundError: [WinError 3] The system cannot find the path specified: '/home/bjpic/brian_renum/kicad'

If I run it before git commit. I assume the "cannot find the path" error is because it is actually trying to do something but I have no idea how to fix this.

Thanks again.

Seth
  • 2,683
  • 18
  • 18

1 Answers1

1

If you are using the bash session which comes with Git for Windows, there is no /home

D:\git\git>bash

vonc@voncav MINGW64 /d/git/git (master)
$ cd /home
bash: cd: /home: No such file or directory

To be sure, in your shell session, export HOME:

export HOME /c/Users/bjpic

See if that works better with a $HOME referencing the right user Home folder

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for the effort. export HOME /c/Users/bjpic gave me an error so I tried export HOME=/c/Users/bjpic and various permutations such as c:/Users/bjpic and got the same error. When I do ls $HOME I get the right directory so the export seems to work. – Brian Piccioni Jan 12 '20 at 14:31
  • 1
    @BrianPiccioni What version of Git are you using, and is your shell a git bash session? (or a separate cygwin installation?) – VonC Jan 12 '20 at 14:32
  • I am using git version 2.24.0 from Msys64. I am using native bash. I do not know what a git bash session is. – Brian Piccioni Jan 12 '20 at 14:35
  • 1
    @BrianPiccioni The bash included with Git or Windows. Not, for instance, the bash from HyperV. – VonC Jan 12 '20 at 14:36
  • To the best of my knowledge I am just using the native Msys bash. bjpic@LAPTOP-70Q5CT1Q MINGW64 /home/bjpic/brian_renum/kicad $ echo "${BASH_VERSION}" 4.4.23(1)-release – Brian Piccioni Jan 12 '20 at 14:39
  • 1
    @BrianPiccioni OK. `where bash` should reference Git installation path. And its version is indeed `GNU bash, version 4.4.23(1)-release (x86_64-pc-msys)` – VonC Jan 12 '20 at 14:41
  • $ where bash C:\msys64\usr\bin\bash.exe C:\Windows\System32\bash.exe – Brian Piccioni Jan 12 '20 at 14:58
  • 1
    @BrianPiccioni Could you try again, after setting first a simplified PATH using Git only, not msys64: https://stackoverflow.com/a/59119220/6309 – VonC Jan 12 '20 at 15:00
  • I am sorry. I do not understand. If I open a dos cmd window and set a simplified path, I don't think that will impact msys64 (?). I did modify the path via a dos cmd shell, restarted msys, and got the same result. Thanks again for your help. – Brian Piccioni Jan 12 '20 at 15:24
  • 1
    @BrianPiccioni I meant, once the PATH is set, you can type bash, and use the one from Git, not the one from C:\msys64, which would no longer be referenced in your PATH: check that with `where bash`, after setting the simplified PATH. – VonC Jan 12 '20 at 15:26
  • I realize I must be very frustrating, but when I enter $ where git C:\msys64\usr\bin\git.exe – Brian Piccioni Jan 12 '20 at 15:51
  • 1
    @BrianPiccioni What is your `PATH`? `echo %PATH%` in a CMD. – VonC Jan 12 '20 at 15:52
  • My path is too long to post in the window, however, I noticed that I had 2 other git related paths C:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin; Which I have deleted. It will take me a while to test if this works because I am running a build. – Brian Piccioni Jan 12 '20 at 16:03
  • 1
    @BrianPiccioni The goal is to set a *simplified* path, which means your path will *not* be "too long" to post. – VonC Jan 12 '20 at 16:09
  • I opened a dos window and created a simple path (damn - I hate this editor) PATH=C:\msys64\usr\bin\\bin;C:\msys64\usr\bin\\usr\bin;C:\msys64\usr\bin\\cmd;C:\msys64\usr\bin\\mingw64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\ The problem is I can't start up mingw64 from the CMD window. I get "Could not find MSYSTEM variable Reason: c:\msys64\mingw64.ini" – Brian Piccioni Jan 12 '20 at 16:15
  • @BrianPiccioni The goal is to set *my* simplified path, one which does not on purpose use c:\mingw64, but only Git For Windows path, in order to test if this has any influence on your issue. – VonC Jan 12 '20 at 16:18
  • So set path to C:\Program Files\Git\cmd\git.exe ? – Brian Piccioni Jan 12 '20 at 16:22
  • PATH=C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\ And I can run git. – Brian Piccioni Jan 12 '20 at 16:26
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/205833/discussion-between-vonc-and-brian-piccioni). – VonC Jan 12 '20 at 16:26