On Tue, Aug 18, 2015 at 5:11 PM, Greg Freemyer <greg.freemyer@gmail.com> wrote:
Personally, in young code I find long lived branches hard to work with.
For new features I prefer to work first on the integration related code with a stub that gracefully does nothing or fails.
So at the start of adding a new feature that will be implemented via a subroutine,write the invoking code a stub that gracefully does nothing. Often the invoking code and the stub can be written in 10 minutes or less.
Then push/pull that into master immediately.
Then I would use an ifdef to work on a real subroutine to implement the feature. ie.
#ifndef FEATURE_X_TESTING /* Declare a a stub to use until the code is stable enough for master */ int new_function() { return(TRUE); } #else /* This is unstable code I am still writing */ int new_function() { /* New code */ } #endif
Then in my local makefile (or via a environment variable, I set FEATURE_X_TESTING true.
Now my new unstable code will have no negative impact on master, so I push it to master often. Probably at least once a day.
When I'm ready to first enable it in master, I just define FEATURE_X_TESTING in master.
This is interesting. However, I personally, don't like these preprocessor stuff, since a lot of those make it difficult for me to follow the code flow and we already have quite a few of them and was thinking of getting rid of as much I can. But, still a big thank you for your suggestion. - Amit