Skip to content

${staged:separator} pattern does not re-stage files after task execution #172

@mvanhilst-msft

Description

@mvanhilst-msft

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

  1. 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"
         ]
      }
   ]
}
  1. Stage a .cs file that has formatting issues.
  2. Run git commit.
  3. Observe that the commit contains unformatted code and the formatted changes are left in the working tree unstaged.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions