git allows you to package commits up with the interactive rebase before you push them upward to the source. What you commit now isn't necessarily what gets pushed upward. It doesn't matter if you broke the compile with the commit, you still have a chance to fix it before a push. If it hasn't been pushed, no one will necessarily ever know or see it.
The whole point of git is that you can break the crap out of your local repo/branch and still have a chance to fix it before the changes ripple outward and become permanent. It also sounds like you're describing a workflow that entails working off master instead of using feature branches, which is going to create a lot more pain than there needs to be.
Now, the issue with the compile and testing can be real, but I have an easy workaround.
I have another working copy/checkout of the repository, called <repository>-ro. I never edit files in the read only copy, unless it's to fix a merge conflict. All tests and merges are done in this other copy.
Any revision does eventually exists on disk, in this copy.
bzr/fossil/git/hg/mtn/svn commit path1 ... pathn
will selectively commit only the listed files/directories (some of them will even allow you to commit individual hunks, as in "git add -p", if you like to live dangerously).The biggest problem with the staging area is that (1) it can happen accidentally that you forgot to "git add" a file or (2) it really only gives you any advantage over selective commits when you stage a non-trivial selection of files, which is exactly where things have a chance of going wrong.
Also, with 'git add -i' you can stage individual hunks of a change instead of the whole change. This can be useful when you need to break up changes into multiple commits. I don't think you can 'git stash' your way out of that situation.
Unfortunately, I don't think stashing helps much either. It's still too cumbersome to stash only some changes. If you're successful on the first shot, awesome. But much like the partial commit case, if the changes you left unstashed don't actually compile or pass tests, adjusting the partition between the changes to commit and not to commit is still a huge pain.
That seems... very wrong?
This is actually why I consider the index an anti-feature. It not only allows you to do partial commits (practically every VCS does), but encourages it and there's a good chance that you may do it wrong by accident.
This can result in broken revisions (because you're committing a state that may have never actually existed on your disk, let alone did compile or passed tests) and create problems for anything from "git bisect" to nightly builds.
The proper way, as far as I'm concerned, is to do the inverse: use "git stash" instead to remove all changes that you do not need, then compile and test what is in your working tree and only then commit the tested version. Afterwards, apply the stashed changes to get the working tree back to its original state. This way you can minimize the risk of broken commits.