You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
It should not be too hard, I’m pretty sure I already have most of it done already. So, making sure all the approvals for contributing to open source software from my employer will be harder, even if they just say, “yeah, do it.” 😆
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 thegit 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, forrevisionFrom = "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 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=never
fixes this forgit diff
.The note in the source about
git ls-files
showing directories, might be a result of some.gitconfig
default overrides as well. Usinggit status --porcelain
is the recommended way to get a reliably appropriate-for-script-processing output.The text was updated successfully, but these errors were encountered: