Version
latest
Details
When using the ${staged:separator} variable pattern (e.g., --include=${staged:;}) in a task definition, Husky.Net doesn't re-stage files after the task modifies them. This means formatting changes made by tools like jb cleanupcode are left as unstaged modifications in the working tree, while the commit is finalized with the original unformatted content.
The ${staged} pattern (without a separator) works correctly.
Steps to reproduce
- Configure a pre-commit task using
${staged:;}:
{
"tasks": [
{
"name": "resharper-cleanup",
"group": "pre-commit",
"command": "dotnet",
"pathMode": "relative",
"include": ["**/*.cs"],
"args": [
"jb",
"cleanupcode",
"--profile=Built-in: Reformat Code",
"--include=${staged:;}",
"MyProject.slnx"
]
}
]
}
- Stage a
.cs file that has formatting issues.
- Run
git commit.
- Observe that the commit contains unformatted code and the formatted changes are left in the working tree unstaged.
Version
latest
Details
When using the
${staged:separator}variable pattern (e.g.,--include=${staged:;}) in a task definition, Husky.Net doesn't re-stage files after the task modifies them. This means formatting changes made by tools likejb cleanupcodeare left as unstaged modifications in the working tree, while the commit is finalized with the original unformatted content.The
${staged}pattern (without a separator) works correctly.Steps to reproduce
${staged:;}:{ "tasks": [ { "name": "resharper-cleanup", "group": "pre-commit", "command": "dotnet", "pathMode": "relative", "include": ["**/*.cs"], "args": [ "jb", "cleanupcode", "--profile=Built-in: Reformat Code", "--include=${staged:;}", "MyProject.slnx" ] } ] }.csfile that has formatting issues.git commit.