-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
simplify git completion to use system-provided completions only #1635
simplify git completion to use system-provided completions only #1635
Conversation
Thanks for providing this, @cornfeedhobo! I'm all for removing old copy/paste code... The question I have is how does this compare to the existing The The Instead of building individual completions that mimic what the Thoughts? |
@nwinkler I did not know about Edit: After testing with MacOS, I see the biggest difference: |
@cornfeedhobo Thanks - good points!
|
@nwinkler Hey, I was just writing out my comment for the next commit, and it has me thinking; There might be more edge cases that come up, and a sprawling list of completion plugins that source system distributed files is probably not great. Then I got to looking at adding that to |
@nwinkler Please take another look. I think this better captures what we've learned and discussed. I'll clean up my other PRs after this is merged. Edit: gimme a sec. gonna fix this broken test :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a review comment...
For the broken test cases, it looks like you need to include the new |
I can't reproduce the failures locally and I don't see how you tracked this down to inclusion from the travis log |
This might help with Bash-it#1635.
I can see some errors related to the new log functionality here: https://travis-ci.com/github/Bash-it/bash-it/jobs/368158047#L283 I've tried to fix them in #1647 - let's see if that helps. I'll wait for the tests in #1647 to complete - if that fixes the error messages, you can try to rebase your branch on that. |
@cornfeedhobo #1647 has been merged, it fixed some error messages during the test run. Can you rebase your branch on top of this and see if it fixes the issue with this PR's build jobs? |
e35e7c1
to
12e1441
Compare
No dice. I can reproduce the exit code locally, but I don't see any actual failures. I can try to pry in later. |
OK, this is a tricky one... I think I found the issue, will open a PR in a moment. Here's what I did: Noticed that one of the test runs on Travis shows an error here: https://travis-ci.com/github/Bash-it/bash-it/jobs/368318142#L240 /Users/travis/build/Bash-it/bash-it/test/plugins/../../completion/available/git.completion.bash: line 7: _command_exists: command not found
241/Users/travis/build/Bash-it/bash-it/test/plugins/../../completion/available/git.completion.bash: line 7: _command_exists: command not found This seems to be related to the recent changes in this PR. To find out what's causing this, I ran the tests locally - to make sure that one test is executed at a time (not in parallel), I set the test execution threads to 1: TEST_JOBS=1 test/run I could see the same error in this case, and the final line read: 220 tests, 0 failures, 2 not run Those two error messages are causing two tests to not run, now to find out which these are. I noticed that the errors show before the > TEST_JOBS=1 test/run test/plugins/alias-completion.plugin.bats
/Users/nils.winkler/.bash_it/test/plugins/../../completion/available/git.completion.bash: line 7: _command_exists: command not found
/Users/nils.winkler/.bash_it/test/plugins/../../completion/available/git.completion.bash: line 7: _command_exists: command not found
2 tests, 0 failures, 2 not run There it is... Will open a PR to fix this in a second. |
Merged #1648, can you please rebase your branch on top of that? That should hopefully do it - I did not see any other test errors so far. |
2363b53
to
dbc6ac3
Compare
@nwinkler I don't know how you got bats to show you those errors, but they are still happening. when I run that same command, the output is seemingly swallowed and i just see the test skips |
Interesting! If you take a look here, you will see that the macOS tests ran fine, it's the Linux ones that are failing now. No errors in the log (https://travis-ci.com/github/Bash-it/bash-it/jobs/369208799#L297), but you can see that the test cases 150 and 151 are missing for some reason - it goes straight from 149 to 152. The |
I'll try to install a Linux VM (Docker or Vagrant) later today if I find the time... |
@nwinkler Interesting. Yeah I see the skips from 149 to 152, and when I run that single test I of course still see the skips, but no actual error $ TEST_JOBS=1 test/run test/plugins/alias-completion.plugin.bats
2 tests, 0 failures, 2 not run But you are right, when I comment out the Darwin check, the tests start succeeding again. FWIW, I'm running these tests on opensuse 15.1 |
Please don't merge this until I reply. I'm going to test this at work with a MacBook and see if there is drift between the tests and reality, or what. I'm curious because I changed this to an |
Thanks for working through this! The other variations we have for checking for OS are these:
Plus some other variations. Not sure why your earlier version was failing. The |
BTW: This works consistently for me on both macOS and Linux (tested with Ubuntu Xenial64 in Vagrant): [[ "$(uname -s)" == 'Darwin' ]] || return 0 The With > [[ "$(uname -s)" -eq 'Darwin' ]] || echo "Foo"
> [[ "$(uname -s)" -eq 'Linux' ]] || echo "Foo"
> [[ "$(uname -s)" == 'Darwin' ]] || echo "Foo"
Foo |
@nwinkler Great find. I did mostly the same sleuthing but didn't even think to verify to exit code. I'm not sure why it would be anything but Edit: please squash-merge when you do :) |
@nwinkler I can't find documentation for this, but it would seem that TIL #!/bin/bash
source foobaar.sh
echo $? #!/bin/bash
bash foobaaar.sh || return #!/bin/bash
exit 127 $ bash foobar.sh
127 |
Awesome - thanks for working through this! |
@nwinkler No problem and thank you as well! Always fun uncovering another nuance I wasn't aware of. P.S. I'm getting a real kick out of my contribution record. So far I've removed much more than I've added, which I'm taking as a good sign :p |
Agreed - removing old/unused code that is no longer required feels good! |
This was always failing on macOS instead of working there... See Bash-it#1635 for the original commit that introduced this issue.
This might help with Bash-it#1635.
…-it#1635) * simplify git completion to use system-provided completions only * support ubuntu git completion * only search non-system paths * only operate on macos. * no need to return 1 in a plugin * make alias test happy * make alias test happy * make alias test happy * pass exit code when capturing expected errors * slightly more understandable code structure * make better use of the new logging feature
This was always failing on macOS instead of working there... See Bash-it#1635 for the original commit that introduced this issue.
* 'master' of https://github.com/bash-it/bash-it: (115 commits) system completion nitpicks hg SCM_CHANGE: prevent hexdump squeezing gitstatus: Add informative warning in case dir is not found [robbyrussell theme] Cleaning up bold markup after theme Fixed OS comparison for macOS Fix error "bash: _git_bash_completion_found: command not found..." simplify git completion to use system-provided completions only (Bash-it#1635) Fixed test execution Adding log library to search tests use terraform to complete itself allow the caller to pass a custom log message when the command is not found clean up jenv to follow the newer pattern attempt to simplify the description add logging for improperly prepared environments and better error handling. nit pick spacing minor cleanups to fzf plugin completion/ssh: support sftp command cleanup node plugin, and make it play nice with nodenv Added missing colon and space while loading custom files lib: log: Insert log level before message prefix ...
This might help with Bash-it#1635.
…-it#1635) * simplify git completion to use system-provided completions only * support ubuntu git completion * only search non-system paths * only operate on macos. * no need to return 1 in a plugin * make alias test happy * make alias test happy * make alias test happy * pass exit code when capturing expected errors * slightly more understandable code structure * make better use of the new logging feature
This was always failing on macOS instead of working there... See Bash-it#1635 for the original commit that introduced this issue.
This stops embedding a copied work, and it was broken anyways. I've only tested these paths on two distros, so suggestions are welcome!
Partially addresses #512