[master,v2] sed version number to current commit if no tag describe exists

Submitted by Jan-Tarek Butt on Sept. 24, 2016, 1:28 p.m.

Details

Message ID 20160924132827.12441-1-tarek@ring0.de
State Accepted
Headers show

Commit Message

Jan-Tarek Butt Sept. 24, 2016, 1:28 p.m.
---
 buildscript | 3 +++
 1 file changed, 3 insertions(+)

--
2.10.0

Patch hide | download patch | download mbox

diff --git a/buildscript b/buildscript
index 04942e6..0c8ef05 100755
--- a/buildscript
+++ b/buildscript
@@ -190,6 +190,9 @@  prebuild() {

     #insert actual firware version informations into release file
     version=$(git describe --tags --dirty)
+    if [ 0 -ne $? ]; then
+        version=$(git log -1 --pretty=format:%h)
+    fi
     community=$(basename "$(realpath selected_community)" .cfg)

     {

Comments

Jan Kraus Sept. 28, 2016, 4:40 p.m.
Hallo Tarek,

Am Samstag, den 24.09.2016, 15:28 +0200 schrieb Jan-Tarek Butt:
> ---
>  buildscript | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/buildscript b/buildscript
> index 04942e6..0c8ef05 100755
> --- a/buildscript
> +++ b/buildscript
> @@ -190,6 +190,9 @@ prebuild() {
> 
>      #insert actual firware version informations into release file
>      version=$(git describe --tags --dirty)
> +    if [ 0 -ne $? ]; then
in welcher Situation tritt es auf, das diese Variable nicht gesetzt ist
bzw. der vorherige Befehl nicht erfolgreich ist?

Grüße Jan
> +        version=$(git log -1 --pretty=format:%h)
> +    fi
>      community=$(basename "$(realpath selected_community)" .cfg)
> 
>      {
> --
> 2.10.0
>
Tim Niemeyer Sept. 29, 2016, 6:56 p.m.
Am Mittwoch, den 28.09.2016, 18:40 +0200 schrieb mayosemmel:
> Hallo Tarek,
> 
> Am Samstag, den 24.09.2016, 15:28 +0200 schrieb Jan-Tarek Butt:
> > ---
> >  buildscript | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/buildscript b/buildscript
> > index 04942e6..0c8ef05 100755
> > --- a/buildscript
> > +++ b/buildscript
> > @@ -190,6 +190,9 @@ prebuild() {
> > 
> >      #insert actual firware version informations into release file
> >      version=$(git describe --tags --dirty)
> > +    if [ 0 -ne $? ]; then
> in welcher Situation tritt es auf, das diese Variable nicht gesetzt ist
> bzw. der vorherige Befehl nicht erfolgreich ist?

--- %< ---
$ git init
Initialisierte leeres Git-Repository in /tmp/tttt/.git/
$ touch xx
$ git add xx
$ git commit -m xx
[master (Basis-Commit) e2cd93d] xx
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 xx
$ git describe 
fatal: Keine Namen gefunden, kann nichts beschreiben.
$ echo $?
128
$ git tag -s xx
$ git describe 
xx
$ echo $?
0
--- >% ---

Ich denke das ist im Subject gut erklärt. Schade, dass der Subject so
lang ist und keine Commit Message da ist.

Trotzdem scheint es nun zu passen:

Reviewed-by: Tim Niemeyer <tim@tn-x.org>

Tim

> Grüße Jan
> > +        version=$(git log -1 --pretty=format:%h)
> > +    fi
> >      community=$(basename "$(realpath selected_community)" .cfg)
> > 
> >      {
> > --
> > 2.10.0
> > 
> 
> -- 
> franken-dev mailing list
> franken-dev@freifunk.net
> http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
Tim Niemeyer Oct. 30, 2016, 12:21 p.m.
Hi

Da hier nix mehr gekommen is, habe ich es jetzt applied.

Tim

Am Donnerstag, den 29.09.2016, 20:56 +0200 schrieb Tim Niemeyer:
> Am Mittwoch, den 28.09.2016, 18:40 +0200 schrieb mayosemmel:
> > Hallo Tarek,
> > 
> > Am Samstag, den 24.09.2016, 15:28 +0200 schrieb Jan-Tarek Butt:
> > > ---
> > >  buildscript | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/buildscript b/buildscript
> > > index 04942e6..0c8ef05 100755
> > > --- a/buildscript
> > > +++ b/buildscript
> > > @@ -190,6 +190,9 @@ prebuild() {
> > > 
> > >      #insert actual firware version informations into release file
> > >      version=$(git describe --tags --dirty)
> > > +    if [ 0 -ne $? ]; then
> > in welcher Situation tritt es auf, das diese Variable nicht gesetzt ist
> > bzw. der vorherige Befehl nicht erfolgreich ist?
> 
> --- %< ---
> $ git init
> Initialisierte leeres Git-Repository in /tmp/tttt/.git/
> $ touch xx
> $ git add xx
> $ git commit -m xx
> [master (Basis-Commit) e2cd93d] xx
>  1 file changed, 0 insertions(+), 0 deletions(-)
>  create mode 100644 xx
> $ git describe 
> fatal: Keine Namen gefunden, kann nichts beschreiben.
> $ echo $?
> 128
> $ git tag -s xx
> $ git describe 
> xx
> $ echo $?
> 0
> --- >% ---
> 
> Ich denke das ist im Subject gut erklärt. Schade, dass der Subject so
> lang ist und keine Commit Message da ist.
> 
> Trotzdem scheint es nun zu passen:
> 
> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
> 
> Tim
> 
> > Grüße Jan
> > > +        version=$(git log -1 --pretty=format:%h)
> > > +    fi
> > >      community=$(basename "$(realpath selected_community)" .cfg)
> > > 
> > >      {
> > > --
> > > 2.10.0
> > > 
> > 
> > -- 
> > franken-dev mailing list
> > franken-dev@freifunk.net
> > http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
> 
> -- 
> franken-dev mailing list
> franken-dev@freifunk.net
> http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net