Den mån 23 feb. 2026 kl 12:02 skrev Johan Corveleyn <[email protected]>:

> On Wed, Feb 18, 2026 at 6:17 PM Branko Čibej <[email protected]> wrote:
> > On 18. 2. 26 17:49, Daniel Sahlberg wrote:
> >> Hi,
> >>
> >> There was a message on the TortoiseSVN mailing list suggesting to add
> cmd.exe based hook script templates to repositories created on Windows[1].
> >>
> >> I think it was a great suggestion and I started thinking about how it
> should be implemented.
> >>
> >> We currently create /bin/sh based hook script templates (see around
> line 392 in repos.c[2]). sh (bash) is not generally available on Windows
> and from what I can tell there would at least be some path style conversion
> issues (c:\repositories\xyz\ vs. /c/repositories/xyz/).
> >>
> >> I see two options - on Windows:
> >> 1. Keeping the existing sh based templates and adding cmd.exe based
> templates as well.
> >> 2. Creating only cmd.exe based templates.
> >>
> >> (On other platforms there would be no change in behaviour).
> >>
> >> I think option 2 makes more sense, but maybe it would be "non-backwards
> compatible" if we stop offering the sh templates. OTOH I don't see how they
> would have worked anyway.
> >>
> >> Thoughts?
> >
> > The only thing that would make sense in a cross-platform kind of way
> would be to convert those templates to Python. and use that on all
> platforms. Just as we do in our test suite.
>
> Unfortunately Python isn't generally present on Windows either. If one
> would go for the lowest common denominator on Windows I think it would
> have to be cmd.exe (or perhaps powershell).
>

Python is at available in Windows Store so it isn't overly complicated to
get going. Maybe a Python rewrite would be nice in the long run? Would that
bring benefits to our *nix users?

Still, I think a BAT file is NEEDED on Windows to start a Python program.
check_hook_cmd seems to look for ".exe", ".cmd", ".bat", ".wsf". If I'm
reading the APR sources correctly, a .BAT/.CMD command is special-cased to
run via cmd.exe, otherwise the hook script is started via CreateProcess
which expects an EXECUTABLE file (don't quite know how it manages .WSF
files). So we would need a .BAT glue-file for both Python and Powershell
based scripts.

Coming back to my original question. Should we, on Windows:
[1] Provide only cmd.exe based (.BAT) hook script templates
[2] Keep the existing SH based templates and add cmd.exe based templates
[3] Don't change anything

I'm leaning towards [1].

Cheers,
Daniel

Reply via email to