Skip to content

Proposed quick-workaround to make git-subrepo accessible on Windows #667

@f-steff

Description

@f-steff

I ran into a Windows setup/documentation gap while getting git-subrepo working with Git for Windows.

What I found:

  • Documentation on the project isn't very Windows friendly - and the current versions are failing. (At least back to 5.4, perhaps earlier?)
  • lib/git-subrepo.d/bash+.bash is tracked as a symlink, but in my checkout core.symlinks=false, so it checked out as plain text.
  • That made the raw PATH=<repo>\lib approach fail on Windows.
  • A .cmd wrapper alone was not enough to make git subrepo discoverable here.
  • A no-extension git-subrepo wrapper with a shebang did work.
  • git subrepo upgrade only worked after the wrapper exec'd the real C:/Projects/git-subrepo/lib/git-subrepo script.
  • git subrepo help still fails because Git for Windows looks for installed docs under its own git-doc tree. I didn't attempt to fix that.

I made a small PowerShell script to ease setup on Windows (see attached file)

win_install.ps1.txt

The script, if placed in the root of the repository is to be invoked with the CWD in the checkout location.
If the script is added to the project, it will make it possible to do:

git clone https://github.com/ingydotnet/git-subrepo C:\Projects\git-subrepo
& C:\Projects\git-subrepo\win_install.ps1

When executed it looks something like this:

PS C:\Projects\git-subrepo> .\win_install.ps1
Added C:\Users\DKfls\.local\bin to the user PATH.

Windows git-subrepo wrapper installed.
Open a fresh PowerShell and verify:
  where.exe git-subrepo*
  git help -a | Select-String subrepo
  git subrepo version
  git subrepo upgrade

I'm well aware that this is a workaround, but at least it's better than an nonfunctional project on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions