git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Check revision and if no files modified (looking for svnversion equivalent)
@ 2011-10-09 16:29 fkater
  2011-10-09 18:10 ` Jonathan Nieder
  0 siblings, 1 reply; 2+ messages in thread
From: fkater @ 2011-10-09 16:29 UTC (permalink / raw)
  To: git

Hi,

in my subversion software repository I use the 'svnversion'
command to do both:

- get the last revision (e.g. r1001)
- check for modified files not yet checked in (e.g. r1001 M)

Both information is required for the application's build
process (Makefiles):

- to display the version in the application
- to refuse to build a proper 'release' version if something
  was not checked in

Would there be a way to do both in git somehow?

 Felix

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Check revision and if no files modified (looking for svnversion equivalent)
  2011-10-09 16:29 Check revision and if no files modified (looking for svnversion equivalent) fkater
@ 2011-10-09 18:10 ` Jonathan Nieder
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Nieder @ 2011-10-09 18:10 UTC (permalink / raw)
  To: fkater@googlemail.com; +Cc: git

fkater@googlemail.com wrote:

> - get the last revision (e.g. r1001)
> - check for modified files not yet checked in (e.g. r1001 M)

"git describe --dirty", maybe.  Thanks to Jean Privat for inventing
it.

> Both information is required for the application's build
> process (Makefiles):
>
> - to display the version in the application
> - to refuse to build a proper 'release' version if something
>   was not checked in

Ok, this seems like two different needs.

- For the former, see GIT-VERSION-GEN in git.git for inspiration.
- For the latter, I'd recommend something like

	git update-index -q --refresh &&
	git diff-index --quiet HEAD ||
	{
		echo >&2 fail
		exit 1
	}

Hope that helps,
Jonathan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-09 18:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-09 16:29 Check revision and if no files modified (looking for svnversion equivalent) fkater
2011-10-09 18:10 ` Jonathan Nieder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).