[!umask:022] skip

# test chezmoi diff --exclude
exec chezmoi diff --exclude=scripts
[!windows] cmp stdout golden/diff-no-scripts.diff
[windows] cmp stdout golden/diff-no-scripts-windows.diff

# test that chezmoi diff respects the diff.exclude configuration variable
exec chezmoi diff
[!windows] cmp stdout golden/diff.diff
[windows] cmp stdout golden/diff-windows.diff
mkdir $CHEZMOICONFIGDIR
cp golden/chezmoi.toml $CHEZMOICONFIGDIR
exec chezmoi diff
[!windows] cmp stdout golden/diff-no-scripts.diff
[windows] cmp stdout golden/diff-no-scripts-windows.diff

chhome home2/user

# test that chezmoi diff --exclude=always excludes scripts that are always run
exec chezmoi diff --exclude=always
cmp stdout golden/diff-exclude-always.diff

-- golden/chezmoi.toml --
[diff]
    exclude = ["scripts"]
-- golden/diff-exclude-always.diff --
diff --git a/script-once.sh b/script-once.sh
new file mode 100755
index 0000000000000000000000000000000000000000..d7dff6100cefc930f4161600c12b6f7ea37b7d3a
--- /dev/null
+++ b/script-once.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo once
-- golden/diff-no-scripts-windows.diff --
diff --git a/.file b/.file
new file mode 100666
index 0000000000000000000000000000000000000000..8a52cb9ce9551221716a53786ad74104c5902362
--- /dev/null
+++ b/.file
@@ -0,0 +1 @@
+# contents of .file
-- golden/diff-no-scripts.diff --
diff --git a/.file b/.file
new file mode 100644
index 0000000000000000000000000000000000000000..8a52cb9ce9551221716a53786ad74104c5902362
--- /dev/null
+++ b/.file
@@ -0,0 +1 @@
+# contents of .file
-- golden/diff-windows.diff --
diff --git a/.file b/.file
new file mode 100666
index 0000000000000000000000000000000000000000..8a52cb9ce9551221716a53786ad74104c5902362
--- /dev/null
+++ b/.file
@@ -0,0 +1 @@
+# contents of .file
diff --git a/script.sh b/script.sh
new file mode 100755
index 0000000000000000000000000000000000000000..3747a7ba08ee591c41b7c518e430d2802137eac4
--- /dev/null
+++ b/script.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo $*
-- golden/diff.diff --
diff --git a/.file b/.file
new file mode 100644
index 0000000000000000000000000000000000000000..8a52cb9ce9551221716a53786ad74104c5902362
--- /dev/null
+++ b/.file
@@ -0,0 +1 @@
+# contents of .file
diff --git a/script.sh b/script.sh
new file mode 100755
index 0000000000000000000000000000000000000000..3747a7ba08ee591c41b7c518e430d2802137eac4
--- /dev/null
+++ b/script.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo $*
-- home/user/.local/share/chezmoi/dot_file --
# contents of .file
-- home/user/.local/share/chezmoi/run_script.sh --
#!/bin/sh

echo $*
-- home2/user/.local/share/chezmoi/run_once_script-once.sh --
#!/bin/sh

echo once
-- home2/user/.local/share/chezmoi/run_script-always.sh --
#!/bin/sh

echo always
