I have created a simple PowerShell script to automate the creation of an archive containing all the files that were modified between two git tags.
It seemed to work quite well with the few tests I had done, but today a colleague complained that it wasn't adding a specific file. I started debugging it and I'm seeing a very strange behavior.
As you can see, the command I'm using to list the files modified is git diff, passing the to and from tags that I got from the PowerShell command's argument (as strings).
# Git tag or commit has from which we want the patch to start
# Path of the patch file
# Git tag or commit hash where to we want the patch to update to (default HEAD, current checkout)
[String] $ToTag = "HEAD"
$modifiedFiles = git diff $FromTag..$ToTag --no-commit-id --name-only --diff-filter=ACMRT
git diff v041.3.2..v041.3.6 --no-commit-id --name-only --diff-filter=ACMRT
$FromTag = "v041.3.2"
$ToTag = "v041.3.6"
git diff $FromTag..$ToTag --no-commit-id --name-only --diff-filter=ACMRT
git diff "v041.3.2".."v041.3.6" --no-commit-id --name-only --diff-filter=ACMRT
cmd /c echo $FromTag..$ToTag from PowerShell and you'll see a space after the first variable:
Use doublequotes to pass it as one parameter as-is (the quotes won't be passed to the program):
git diff "$FromTag..$ToTag"