summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorBen Peart <benpeart@microsoft.com>2017-11-10 16:03:11 -0500
committerJunio C Hamano <gitster@pobox.com>2017-11-13 10:02:20 +0900
commit1fff303fc2b31d5005f38f55f38c4e8521da5a93 (patch)
treed09834e5166574c82cfac644109614e9a6a80c1f /templates
parent3bd28eb29912801481b293691039b05caebf13a3 (diff)
downloadgit-1fff303fc2b31d5005f38f55f38c4e8521da5a93.tar.gz
fsmonitor: simplify determining the git worktree under Windowsav/fsmonitor
Simplify and speed up the process of finding the git worktree when running on Windows by keeping it in perl and avoiding spawning helper processes. Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'templates')
-rwxr-xr-xtemplates/hooks--fsmonitor-watchman.sample13
1 files changed, 3 insertions, 10 deletions
diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks--fsmonitor-watchman.sample
index ba6d88c5f8..e673bb3980 100755
--- a/templates/hooks--fsmonitor-watchman.sample
+++ b/templates/hooks--fsmonitor-watchman.sample
@@ -28,17 +28,10 @@ if ($version == 1) {
"Falling back to scanning...\n";
}
-# Convert unix style paths to escaped Windows style paths when running
-# in Windows command prompt
-
-my $system = `uname -s`;
-$system =~ s/[\r\n]+//g;
my $git_work_tree;
-
-if ($system =~ m/^MSYS_NT/ || $system =~ m/^MINGW/) {
- $git_work_tree = `cygpath -aw "\$PWD"`;
- $git_work_tree =~ s/[\r\n]+//g;
- $git_work_tree =~ s,\\,/,g;
+if ($^O =~ 'msys' || $^O =~ 'cygwin') {
+ $git_work_tree = Win32::GetCwd();
+ $git_work_tree =~ tr/\\/\//;
} else {
require Cwd;
$git_work_tree = Cwd::cwd();