Why gcc 4.1 + gcov reports 100% branch coverage and newer (4.4, 4.6, 4.8) reports 50% for “p = new class;” line?

Solved ! We have some C/C++ files with and without exceptions handling, so lcov/gcov process “exceptions handling” for each code block. Inside a normal block, for example: int main(void) { … … [+ -] printf(“Hello\n”); … } gcov reports that printf line has a “branch coverage” of 50% —> WHY ? Because exceptions handling is … Read more

Block a git branch from being pushed

Here’s how the pre-push hook approach works, with a branch called dontpushthis. Create this file as .git/hooks/pre-push: #!/usr/bin/bash if [[ `grep ‘dontpushthis’` ]]; then echo “You really don’t want to push this branch. Aborting.” exit 1 fi This works because the list of refs being pushed is passed on standard input. So this will also … Read more

How to see commits that were merged in to a merge commit?

git log abc123^..abc123 shows the commits that got merged into merge-commit abc123. Create a git alias log-merge for easy reuse: $ git config –global alias.log-merge \ ‘!f() { git log –stat “$1^..$1”; }; f’ $ git log-merge abc123 For a one-line version: $ git config –global alias.log-merge-short \ ‘!f() { git log –pretty=oneline “$1^..$1”; }; … Read more