3 ms·
>And you can't use git's index to push files that have never been visible to your compiler and your tests. That's true w/in your scenario but a little misleadi
by jackowayed 18y ago
>And you can't use git's index to push files that have never been visible to your compiler and your tests.
That's true w/in your scenario but a little misleading because it's not always true.
If you don't use the experimental branch, you can add and commit pieces of files, yet the tests will run not on what's committed but what's in your directory. So if you had
print password_to_the_admin_interface
for some reason, and then you comment that out/delete it and forget to add that part of the file, you test it and see that it's not printing the pass, but then you push and deploy and bad shit goes down.
Just clarifying so no one's like "I can't push code I didn't test! Git is so safe!" and then allows disaster to occur.
- mechanical_fish 18y agoThat is true -- thanks for pointing that out. I generally don't do pushes without first handling all the local changes, one way or another (either committing them or deleting them) so this possibility had not occurred to me. But it is there. I'm guessing that you could fiddle with git's hooks to discourage or even prevent this problem, if you wanted to. For example, you could refuse to allow "git push" to be run from within a repository that contains uncommitted changes, and also include a requirement that your tests pass before the push commences.
- jackowayed 18y agoI do sometimes. Usually it's when I do one thing, then start another, then realize that I really should push the old thing first. So I add the old thing I did, commit, test (when I test. sometimes I'm bad and don't have real tests.) and push, leaving this half-finished method uncommitted. I guess I really should just git stash. C does not have nearly as many useful things built in as git.