Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General git command-line issues. #16

Open
puellanivis opened this issue Apr 23, 2019 · 2 comments
Open

General git command-line issues. #16

puellanivis opened this issue Apr 23, 2019 · 2 comments

Comments

@puellanivis
Copy link

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.

@bradleyfalzon
Copy link
Owner

Thanks @puellanivis, do you have time to submit a PR and I'll address these.

@puellanivis
Copy link
Author

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.” 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants