git/git — pull request #87 by sun (2014-03-16 01:32:15+00:00)
Title: git-new-workdir: Add Windows support

The `contrib/workdir/git-new-workdir` script is tremendously useful, but does not work on Windows currently.

Adding Windows support was [discussed](https://groups.google.com/d/topic/msysgit/1z07lWg9Nts/discussion) in the past already. Former attempts did not succeed, because

1. The [original attempt](https://github.com/joero74/git-new-workdir/blob/master/git-new-workdir.cmd) rewrote the script entirely, making it hard to maintain it in parallel to the existing.

2. The [revised attempt](https://github.com/dansmith65/git/blob/master/contrib/workdir/git-new-workdir-win) tried to embed Windows support into the existing script, but it does not account for (extremely weird) circumstances caused by UAC in combination with a deeply nested `runas` → `cmd` → cygwin/mingw32/msysgit `bash` → `cmd` → `mklink` process invocation call chain, which happens to break the ACL/file permissions of all links and files created by the script (effectively owned by no one, which is very rare but possible on Windows).

#### Proposed solution

1. Port the script into a native Windows `.cmd` script, in order to resolve 2) above.
2. Ensure a 1:1 port to facilitate ongoing maintenance.
3. Document why this is necessary.

The `git-new-workdir.cmd` script added here (1) not only works 100% identically to the existing, (2) it also contains the exact same structure, comments, code, and execution flow as the existing script.