git-extras icon indicating copy to clipboard operation
git-extras copied to clipboard

Unable to update on Windows

Open Dominiquini opened this issue 2 years ago • 9 comments

I'm unable to update git-extras using the command "git extras update" on Windows 10:

>>> sudo git extras update
Setting up 'git-extras'....
'C:\Users\Rafael' is not recognized as an internal or external command,
operable program or batch file.

My home folder is: "C:\Users\Rafael Dominiquini" My git is installed on: "C:\Program Files\Git"

  • In the git-extras file, I debug this variables:
  local bin="$(command -v git-extras)"
  local prefix=${bin%/*/*}
  • Value:
BIN: /mingw64/bin/git-extras 
PREFIX: /mingw64

I was able to update the program using the installation method:

  • Cloning the repository
  • Running "sudo install.cmd"

Thanks

Dominiquini avatar Oct 14 '23 00:10 Dominiquini

Interesting. I am not familiar with mingw environment. Maybe you can add set -x in the script, and run the displayed command manually to see which part is broken?

spacewander avatar Oct 15 '23 02:10 spacewander

It looks like an issue with word splitting.

hyperupcall avatar Oct 15 '23 02:10 hyperupcall

Interesting. I am not familiar with mingw environment. Maybe you can add set -x in the script, and run the displayed command manually to see which part is broken?

This is the output:

>>>git extras update
+ unset -v GREP_OPTIONS
+ VERSION=7.0.0
+ INSTALL_SCRIPT=https://raw.githubusercontent.com/tj/git-extras/master/install.sh
+ case "$1" in
++ uname -s
+ platform=MINGW64_NT-10.0-19045
+ '[' MINGW64_N = CYGWIN_NT ']'
+ '[' MINGW = MINGW ']'
+ updateForWindows
++ command -v git-extras
+ local bin=/mingw64/bin/git-extras
+ local prefix=/mingw64
+ local 'orig=/f/Videos/ZZZ - Others'
+ cd /tmp
+ rm -rf ./git-extras
+ echo 'Setting up '\''git-extras'\''....'
Setting up 'git-extras'....
+ git clone https://github.com/tj/git-extras.git
+ cd git-extras
+++ git rev-list --tags --max-count=1
++ git describe --tags d7f0fcc5460af875dd919a06c170503f83bf57d3
+ git checkout 7.0.0
+ ./install.cmd /mingw64
'C:\Users\Rafael' is not recognized as an internal or external command,
operable program or batch file.
+ rm -rf /tmp/git-extras

Dominiquini avatar Oct 15 '23 03:10 Dominiquini

If I remove the "$prefix" from the "./install.cmd" command line (I don't need specify anything when I manually installed git-extras), this is the output:

>>>git extras update
+ unset -v GREP_OPTIONS
+ VERSION=7.0.0
+ INSTALL_SCRIPT=https://raw.githubusercontent.com/tj/git-extras/master/install.sh
+ case "$1" in
++ uname -s
+ platform=MINGW64_NT-10.0-19045
+ '[' MINGW64_N = CYGWIN_NT ']'
+ '[' MINGW = MINGW ']'
+ updateForWindows
++ command -v git-extras
+ local bin=/mingw64/bin/git-extras
+ local prefix=/mingw64
+ local 'orig=/f/Videos/ZZZ - Others'
+ cd /tmp
+ rm -rf ./git-extras
+ echo 'Setting up '\''git-extras'\''....'
Setting up 'git-extras'....
+ git clone https://github.com/tj/git-extras.git
+ cd git-extras
+++ git rev-list --tags --max-count=1
++ git describe --tags d7f0fcc5460af875dd919a06c170503f83bf57d3
+ git checkout 7.0.0
+ ./install.cmd
No mingw64 folder found in C:\Program Files\Git\mingw64\libexec.

Please supply a proper "Git for Windows 2.x" install path:
"install.cmd c:\[git-install-path]"
+ cd '/f/Videos/ZZZ - Others'
++ git extras --version
+ unset -v GREP_OPTIONS
+ VERSION=7.0.0
+ INSTALL_SCRIPT=https://raw.githubusercontent.com/tj/git-extras/master/install.sh
+ case "$1" in
+ echo 7.0.0
+ exit 0
+ echo '... updated git-extras 7.0.0 -> 7.0.0'
... updated git-extras 7.0.0 -> 7.0.0
+ rm -rf /tmp/git-extras

Dominiquini avatar Oct 15 '23 03:10 Dominiquini

This is the directory that the script needed to copy the files: "C:\Program Files\Git\mingw64\bin"!

Running the "install.cmd" on the powershell, it works fine! But running using "git extras update" not!

Thanks.

Dominiquini avatar Oct 15 '23 03:10 Dominiquini

I noticed another thing:

Running the install script manually, it try to copy the files on the path "C:\Program Files\Git\mingw64\bin" But using the update method, it try to copy the files on the path "C:\Program Files\Git\mingw64\libexec"

Thanks

Dominiquini avatar Oct 15 '23 03:10 Dominiquini

So the problem is inside the cmd script. I am not familiar with the cmd syntax. As @hyperupcall suggested, maybe there is a space after 'C:\Users\Rafael'? And the powershell environment can handle word splitting smartly.

spacewander avatar Oct 16 '23 03:10 spacewander

So the problem is inside the cmd script. I am not familiar with the cmd syntax. As @hyperupcall suggested, maybe there is a space after 'C:\Users\Rafael'?

Yes, my username is "Rafael Dominiquini"

And the powershell environment can handle word splitting smartly.

Probably! Running this script (install.cmd) on Powershell installs the application correctly!

Thanks

Dominiquini avatar Oct 16 '23 04:10 Dominiquini

I was able to reproduce it, but after fiddling trying to fix it, I get a different error:

C:\Program Files\Git\mingw64\bin\git-extras: line 23: ::::::::::::::: command not found
C:\Program Files\Git\mingw64\bin\git-extras: line 24: C:cygwin64tmpgit-extras\bingit-extras: No such file or directory
C:\Program Files\Git\mingw64\bin\git-extras: line 25: ::::::::::::::: command not found
Setting up 'git-extras'....
Using git install path "C:/Program Files/Git/mingw64" as PREFIX, please make sure it's really a
path to the mingw64 directory...

Installing to C:/Program Files/Git/mingw64

Directory for binaries ["C:/Program Files/Git/mingw64\bin"] is not writeable by install.cmd.

You probably need to run install.cmd from an admin prompt.
C:\Program Files\Git\mingw64\bin\git-extras: line 23: ::::::::::::::: command not found
C:\Program Files\Git\mingw64\bin\git-extras: line 24: C:cygwin64tmpgit-extras\bingit-extras: No such file or directory
C:\Program Files\Git\mingw64\bin\git-extras: line 25: ::::::::::::::: command not found
... updated git-extras 7.1.0 -> 7.1.0

I ran this in Windows with both PowerShell and cmd, and both worked. But, the issue only popped up when I was using Cygwin. So I think the issue might be Cygwin-related

hyperupcall avatar Dec 06 '23 09:12 hyperupcall