atomist / sdm-local

Local software delivery machine support
Apache License 2.0
13 stars 4 forks source link

Improve directory path comparisons #197

Closed ddgenome closed 6 years ago

ddgenome commented 6 years ago

The "belt & suspenders" commit. Properly deal with path separators when determining project base directory when invoking Git hooks. When Git hooks were invoked, the $PWD was a Cygwin-style path, e.g., C:\Some\Path was /c/Some/Path. This broke determination of whether a repo directory was under the parent directory, which used process.cwd() which returned the C:\ style paths. This was fixed in two ways. First, on win32 we lowercase the paths and compare and if that does not work we cygwin-ize them and compare again. Second, we no longer have the Git hook shell script provide the current directory or any other argument, preferring to do all that work in Node.js. We do accept values for branch and SHA, but any provided directory is ignored.

On darwin, the file system can be either case sensitive or insensitive, with the latter being the default. Fortunately, it appears the casing is internally consistent on that platform as we have not seen an issue on it.

Add both directories to skipping message in handlePushBasedEventOnRepo to make it more clear what is going on.

Use HookEvent enum type more strictly.

Move expandedTreeUtils test under parallel directory as source.

Update TypeScript config and package scripts. Add test coverage. Remove tsfmt.

Fixes #195