On Dec 2, 2015, at 7:06 PM, BALATON Zoltan wrote:
On Wed, 2 Dec 2015, Programmingkid wrote:
+ifeq ($(REVISION),) # Try using git to find the revision number
- REVISION := $(shell git svn log --oneline -1 | cut -d '|' -f1 | cut -d 'r' -f2 | cut -d ' ' -f 1)
Better but you could cut with separator ' ' right away instead of '|' in the first invocation and then you don't need the third cut. But I think using sed instead of cut could be the simplest here. For example like this:
git svn log --oneline -1 | sed -e 's/^r([0-9]*).*/\1/'
Looks like an indecipherable mess.
Goes and tries it out.... OK it does work. If you don't mind, I would prefer to stick with cut. Cut is a lot easier to understand. Regular expressions look like someone just pushed a bunch of random keys on their keyboard.
Mark which do you want to use?