{"thread":{"id":"28638","subject":"Check revision and if no files modified (looking for svnversion equivalent)","startedAt":"2011-10-09T16:29:02Z","lastAt":"2011-10-09T18:10:40Z","messageCount":2,"participants":["fkater@googlemail.com","Jonathan Nieder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"177277","messageId":"20111009162902.GA3000@comppasch2","threadId":"28638","inReplyTo":null,"subject":"Check revision and if no files modified (looking for svnversion equivalent)","fromName":"fkater@googlemail.com","fromEmail":"fkater@googlemail.com","sentAt":"2011-10-09T16:29:02Z","receivedAt":"2011-10-09T16:29:02Z","isPatch":false,"sender":{"key":"fkater@googlemail.com","avatar":null},"body":"Hi,\n\nin my subversion software repository I use the 'svnversion'\ncommand to do both:\n\n- get the last revision (e.g. r1001)\n- check for modified files not yet checked in (e.g. r1001 M)\n\nBoth information is required for the application's build\nprocess (Makefiles):\n\n- to display the version in the application\n- to refuse to build a proper 'release' version if something\n  was not checked in\n\nWould there be a way to do both in git somehow?\n\n Felix\n"},{"id":"177280","messageId":"20111009181040.GA31303@elie.hsd1.il.comcast.net","threadId":"28638","inReplyTo":"20111009162902.GA3000@comppasch2","subject":"Re: Check revision and if no files modified (looking for svnversion equivalent)","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2011-10-09T18:10:40Z","receivedAt":"2011-10-09T18:10:40Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"fkater@googlemail.com wrote:\n\n> - get the last revision (e.g. r1001)\n> - check for modified files not yet checked in (e.g. r1001 M)\n\n\"git describe --dirty\", maybe.  Thanks to Jean Privat for inventing\nit.\n\n> Both information is required for the application's build\n> process (Makefiles):\n>\n> - to display the version in the application\n> - to refuse to build a proper 'release' version if something\n>   was not checked in\n\nOk, this seems like two different needs.\n\n- For the former, see GIT-VERSION-GEN in git.git for inspiration.\n- For the latter, I'd recommend something like\n\n\tgit update-index -q --refresh &&\n\tgit diff-index --quiet HEAD ||\n\t{\n\t\techo >&2 fail\n\t\texit 1\n\t}\n\nHope that helps,\nJonathan\n"}]}