git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [new tool] git-project-version.sh
@ 2008-04-15 11:36 Nico -telmich- Schottelius
  2008-04-15 11:55 ` Björn Steinbrink
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Nico -telmich- Schottelius @ 2008-04-15 11:36 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

Hello!

As I want to use the latest commit id in all my projects, so I know
which commit the version is based on, I wrote an extremly simple script
that is based on git-show to display only the version named
git-project-version.sh.

You can find it in
   http://unix.schottelius.org/git/git-tools.git/.git/
   http://unix.schottelius.org/cgi-bin/gitweb.cgi?p=git-tools.git/.git;a=summary
and more information is available on
   http://nico.schottelius.org/notizbuch-blog/archive/2008/04/15/git-project-version-sh-written-versions-with-git/

Sincerly

Nico

ps: please cc on reply, I am not subscribed.

-- 
Think about Free and Open Source Software (FOSS).
http://nico.schottelius.org/documentations/foss/the-term-foss/

PGP: BFE4 C736 ABE5 406F 8F42  F7CF B8BE F92A 9885 188C

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [new tool] git-project-version.sh
  2008-04-15 11:36 [new tool] git-project-version.sh Nico -telmich- Schottelius
@ 2008-04-15 11:55 ` Björn Steinbrink
  2008-04-15 12:02   ` Nico -telmich- Schottelius
  2008-04-15 12:01 ` Santi Béjar
  2008-04-15 12:05 ` Luciano Rocha
  2 siblings, 1 reply; 8+ messages in thread
From: Björn Steinbrink @ 2008-04-15 11:55 UTC (permalink / raw)
  To: Nico -telmich- Schottelius; +Cc: git

On 2008.04.15 13:36:29 +0200, Nico -telmich- Schottelius wrote:
> Hello!
> 
> As I want to use the latest commit id in all my projects, so I know
> which commit the version is based on, I wrote an extremly simple script
> that is based on git-show to display only the version named
> git-project-version.sh.
> 
> You can find it in
>    http://unix.schottelius.org/git/git-tools.git/.git/
>    http://unix.schottelius.org/cgi-bin/gitweb.cgi?p=git-tools.git/.git;a=summary
> and more information is available on
>    http://nico.schottelius.org/notizbuch-blog/archive/2008/04/15/git-project-version-sh-written-versions-with-git/

Hm, except for the three trailing dots that you get with
--abbrev-commit, you can get the same results with rev-parse

$ git rev-parse  HEAD
8a18e8fe4e0e64222de6b063a976d0fe24955ddb

$ git rev-parse --short HEAD
8a18e8f

Björn

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

* Re: [new tool] git-project-version.sh
  2008-04-15 11:36 [new tool] git-project-version.sh Nico -telmich- Schottelius
  2008-04-15 11:55 ` Björn Steinbrink
@ 2008-04-15 12:01 ` Santi Béjar
  2008-04-15 12:52   ` Nico Schottelius
  2008-04-15 12:05 ` Luciano Rocha
  2 siblings, 1 reply; 8+ messages in thread
From: Santi Béjar @ 2008-04-15 12:01 UTC (permalink / raw)
  To: Nico -telmich- Schottelius; +Cc: git

On Tue, Apr 15, 2008 at 1:36 PM, Nico -telmich- Schottelius
<nico-git-20080415@schottelius.org> wrote:
> Hello!
>
>  As I want to use the latest commit id in all my projects, so I know
>  which commit the version is based on, I wrote an extremly simple script
>  that is based on git-show to display only the version named
>  git-project-version.sh.

an equivalent simpler version is:

git rev-parse [--short] HEAD

Also "git show" is a porcelain command, that means it is for humans,
not for scripts. The output of "git show" can change while the output
of "git rev-parse" (and the plumbing) is stable.

But maybe what you really want is:

git describe [--always]

Santi

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

* Re: [new tool] git-project-version.sh
  2008-04-15 11:55 ` Björn Steinbrink
@ 2008-04-15 12:02   ` Nico -telmich- Schottelius
  0 siblings, 0 replies; 8+ messages in thread
From: Nico -telmich- Schottelius @ 2008-04-15 12:02 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: Nico -telmich- Schottelius, git

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

Björn Steinbrink [Tue, Apr 15, 2008 at 01:55:29PM +0200]:
> > [...git-project-version.sh...]
> > 
> 
> Hm, except for the three trailing dots that you get with
> --abbrev-commit, you can get the same results with rev-parse
> 
> $ git rev-parse  HEAD
> 8a18e8fe4e0e64222de6b063a976d0fe24955ddb
> 
> $ git rev-parse --short HEAD
> 8a18e8f

Should have known that before... thank you for the hint!

So just forget my previous post :-)

Nico

-- 
Think about Free and Open Source Software (FOSS).
http://nico.schottelius.org/documentations/foss/the-term-foss/

PGP: BFE4 C736 ABE5 406F 8F42  F7CF B8BE F92A 9885 188C

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [new tool] git-project-version.sh
  2008-04-15 11:36 [new tool] git-project-version.sh Nico -telmich- Schottelius
  2008-04-15 11:55 ` Björn Steinbrink
  2008-04-15 12:01 ` Santi Béjar
@ 2008-04-15 12:05 ` Luciano Rocha
  2 siblings, 0 replies; 8+ messages in thread
From: Luciano Rocha @ 2008-04-15 12:05 UTC (permalink / raw)
  To: Nico -telmich- Schottelius; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

On Tue, Apr 15, 2008 at 01:36:29PM +0200, Nico -telmich- Schottelius wrote:
> Hello!
> 
> As I want to use the latest commit id in all my projects, so I know
> which commit the version is based on, I wrote an extremly simple script
> that is based on git-show to display only the version named
> git-project-version.sh.
> 
> You can find it in
>    http://unix.schottelius.org/git/git-tools.git/.git/

I couldn't clone:
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?

>    http://unix.schottelius.org/cgi-bin/gitweb.cgi?p=git-tools.git/.git;a=summary
> and more information is available on
>    http://nico.schottelius.org/notizbuch-blog/archive/2008/04/15/git-project-version-sh-written-versions-with-git/

I use "git describe" for this, it's more user-friendly.

-- 
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [new tool] git-project-version.sh
  2008-04-15 12:01 ` Santi Béjar
@ 2008-04-15 12:52   ` Nico Schottelius
  2008-04-15 12:55     ` Elijah Newren
  0 siblings, 1 reply; 8+ messages in thread
From: Nico Schottelius @ 2008-04-15 12:52 UTC (permalink / raw)
  To: Santi Béjar, Luciano Rocha; +Cc: Nico -telmich- Schottelius, git

[-- Attachment #1: Type: text/plain, Size: 888 bytes --]

Santi Béjar [Tue, Apr 15, 2008 at 02:01:06PM +0200]:
Luciano Rocha [Tue, Apr 15, 2008 at 01:05:07PM +0100]:
> [...git describe...]

Looks also quite nice, also added it to the blog entry,
but it seems to work wrong here:

The last tag I created on the master branch is called 1.20.3pre6,
but git-describe uses pre5:

[14:39] denkbrett:gpm% git-describe 
1.20.3pre5-17-gfccc331
[14:43] denkbrett:gpm% git tag 
1.20.3pre1
1.20.3pre2
1.20.3pre3
1.20.3pre4
1.20.3pre5
1.20.3pre6
1.99.0
1.99.1
1.99.2
1.99.2.1
1.99.2.2
1.99.3
1.99.4
1.99.5
[14:44] denkbrett:gpm% git branch  
  gpm-1-stable
  gpm-2-dev
* master
[14:51] denkbrett:gpm% git --version
git version 1.5.4.4


Nico

-- 
Think about Free and Open Source Software (FOSS).
http://nico.schottelius.org/documentations/foss/the-term-foss/

PGP: BFE4 C736 ABE5 406F 8F42  F7CF B8BE F92A 9885 188C

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [new tool] git-project-version.sh
  2008-04-15 12:52   ` Nico Schottelius
@ 2008-04-15 12:55     ` Elijah Newren
  2008-04-15 13:09       ` Nico Schottelius
  0 siblings, 1 reply; 8+ messages in thread
From: Elijah Newren @ 2008-04-15 12:55 UTC (permalink / raw)
  To: Nico Schottelius; +Cc: Santi Béjar, Luciano Rocha, git

On Tue, Apr 15, 2008 at 6:52 AM, Nico Schottelius
<nico-git-20080415@schottelius.org> wrote:
> Santi Béjar [Tue, Apr 15, 2008 at 02:01:06PM +0200]:
>  Luciano Rocha [Tue, Apr 15, 2008 at 01:05:07PM +0100]:
>  > [...git describe...]
>
>  Looks also quite nice, also added it to the blog entry,
>  but it seems to work wrong here:
>
>  The last tag I created on the master branch is called 1.20.3pre6,
>  but git-describe uses pre5:

Is your 1.20.3pre6 tag annotated?  git-describe only uses annotated
tags by default; pass the --tags option to have it consider all tags.
(This caught me be surprise a few times as well.)

Elijah

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

* Re: [new tool] git-project-version.sh
  2008-04-15 12:55     ` Elijah Newren
@ 2008-04-15 13:09       ` Nico Schottelius
  0 siblings, 0 replies; 8+ messages in thread
From: Nico Schottelius @ 2008-04-15 13:09 UTC (permalink / raw)
  To: Elijah Newren; +Cc: Nico Schottelius, Santi Béjar, Luciano Rocha, git

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

Elijah Newren [Tue, Apr 15, 2008 at 06:55:18AM -0600]:
> [...Is your 1.20.3pre6 tag annotated?...]

Got me, it is not!

Also added your hint, thank you!

Nico

-- 
Think about Free and Open Source Software (FOSS).
http://nico.schottelius.org/documentations/foss/the-term-foss/

PGP: BFE4 C736 ABE5 406F 8F42  F7CF B8BE F92A 9885 188C

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2008-04-15 13:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15 11:36 [new tool] git-project-version.sh Nico -telmich- Schottelius
2008-04-15 11:55 ` Björn Steinbrink
2008-04-15 12:02   ` Nico -telmich- Schottelius
2008-04-15 12:01 ` Santi Béjar
2008-04-15 12:52   ` Nico Schottelius
2008-04-15 12:55     ` Elijah Newren
2008-04-15 13:09       ` Nico Schottelius
2008-04-15 12:05 ` Luciano Rocha

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).