If git diff is run against a branch name or commit reference that is also a file, git diff will error out, and report that it has an ambiguous argument. Worse, if the commit reference does not exist, but the file does, then the git diff will happily only report changes in that single file.
In order to ensure that a commit reference is always taken as a commit reference, and only as a commit reference, you have to append -- after the commits. So, for revisionFrom = "master": git diff master -- is the unambiguous command-line. (git diff from to -- works as expected as well.)
Also, if one has a .gitconfig that has color.diff = always, the code that looks for changes silently breaks, since the lines starting with + are now starting with an ANSI color sequence instead. It’s recommended to always assume there could be some external default value-override set that could break the command-line output. Adding --color=never fixes this for git diff.
The note in the source about git ls-files showing directories, might be a result of some .gitconfig default overrides as well. Using git status --porcelain is the recommended way to get a reliably appropriate-for-script-processing output.
If
git diffis run against a branch name or commit reference that is also a file,git diffwill error out, and report that it has an ambiguous argument. Worse, if the commit reference does not exist, but the file does, then thegit diffwill happily only report changes in that single file.In order to ensure that a commit reference is always taken as a commit reference, and only as a commit reference, you have to append
--after the commits. So, forrevisionFrom = "master":git diff master --is the unambiguous command-line. (git diff from to --works as expected as well.)Also, if one has a
.gitconfigthat hascolor.diff = always, the code that looks for changes silently breaks, since the lines starting with+are now starting with an ANSI color sequence instead. It’s recommended to always assume there could be some external default value-override set that could break the command-line output. Adding--color=neverfixes this forgit diff.The note in the source about
git ls-filesshowing directories, might be a result of some.gitconfigdefault overrides as well. Usinggit status --porcelainis the recommended way to get a reliably appropriate-for-script-processing output.