* [PATCH] gen-version.sh: check if git is available before trying to call it @ 2014-01-31 23:02 t74jgwb88tli9ch [not found] ` <CAHmME9rwbdCfdeDYWcnKmyDjcsUQ_VaYF2755aHfbgUQeMNQQw@mail.gmail.com> 0 siblings, 1 reply; 10+ messages in thread From: t74jgwb88tli9ch @ 2014-01-31 23:02 UTC (permalink / raw) Hello, please merge this small fix. Thanks, Fabien C. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gen-version.sh-check-if-git-is-available-before-tryi.patch Type: text/x-patch Size: 888 bytes Desc: not available URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140201/3c95edea/attachment-0001.bin> ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <CAHmME9rwbdCfdeDYWcnKmyDjcsUQ_VaYF2755aHfbgUQeMNQQw@mail.gmail.com>]
[parent not found: <52EC2C77.10503@jetable.org>]
[parent not found: <CAHmME9qKOEU0Q+yAYUw5N4_AOS38bK4kHp2p8-MwYPGOh=ZOKg@mail.gmail.com>]
* [PATCH] gen-version.sh: check if git is available before trying to call it [not found] ` <CAHmME9qKOEU0Q+yAYUw5N4_AOS38bK4kHp2p8-MwYPGOh=ZOKg@mail.gmail.com> @ 2014-02-01 10:07 ` Jason 2014-02-01 13:23 ` t74jgwb88tli9ch 0 siblings, 1 reply; 10+ messages in thread From: Jason @ 2014-02-01 10:07 UTC (permalink / raw) > From a6844137677cfe782c7ef60c8547e18a81fca6e2 Mon Sep 17 00:00:00 2001 > From: Fabien C. <t74jgwb88tli9ch at jetable.org> > Date: Fri, 31 Jan 2014 23:19:43 +0100 > Subject: [PATCH] gen-version.sh: check if git is available before trying to > call it > Some people may clone the cgit repository and compile within a sandbox > or on another machine where git is not necessarily installed. When it > happens, cgit is getting compiled with an empty version number. > This commit fixes this. > --- > gen-version.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > diff --git a/gen-version.sh b/gen-version.sh > index 3a08015..3f28d54 100755 > --- a/gen-version.sh > +++ b/gen-version.sh > @@ -4,7 +4,7 @@ > V=$1 > > # Use `git describe` to get current version if we're inside a git repo > -if test -d .git > +if test -d .git && command -v git Maybe you want to direct the output to /dev/null? > then > V=$(git describe --abbrev=4 HEAD 2>/dev/null) > fi > -- > 1.7.10.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] gen-version.sh: check if git is available before trying to call it 2014-02-01 10:07 ` Jason @ 2014-02-01 13:23 ` t74jgwb88tli9ch 2014-02-01 13:56 ` john 0 siblings, 1 reply; 10+ messages in thread From: t74jgwb88tli9ch @ 2014-02-01 13:23 UTC (permalink / raw) On 01/02/2014 11:07, Jason A. Donenfeld wrote: > Maybe you want to direct the output to /dev/null? You're right, that was a too quick fix. Here you go with the /dev/null redirect. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gen-version.sh-check-if-git-is-available-before-tryi.patch Type: text/x-patch Size: 898 bytes Desc: not available URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140201/a41a13ad/attachment.bin> ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] gen-version.sh: check if git is available before trying to call it 2014-02-01 13:23 ` t74jgwb88tli9ch @ 2014-02-01 13:56 ` john 2014-02-01 14:06 ` lekensteyn 0 siblings, 1 reply; 10+ messages in thread From: john @ 2014-02-01 13:56 UTC (permalink / raw) On Sat, Feb 01, 2014 at 02:23:49PM +0100, Fabien C. wrote: > On 01/02/2014 11:07, Jason A. Donenfeld wrote: > > Maybe you want to direct the output to /dev/null? > > You're right, that was a too quick fix. > > Here you go with the /dev/null redirect. > From 3dc2ce06df3ccbdae9c05325e93cbbcabc1d1b7f Mon Sep 17 00:00:00 2001 > From: Fabien C. <t74jgwb88tli9ch at jetable.org> > Date: Sat, 1 Feb 2014 14:18:29 +0100 > Subject: [PATCH] gen-version.sh: check if git is available before trying to > call it > > Some people may clone the cgit repository and compile within a sandbox > or on another machine where git is not necessarily installed. When it > happens, cgit is getting compiled with an empty version number. > > This commit fixes this. > --- > gen-version.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gen-version.sh b/gen-version.sh > index 3a08015..13ff979 100755 > --- a/gen-version.sh > +++ b/gen-version.sh > @@ -4,7 +4,7 @@ > V=$1 > > # Use `git describe` to get current version if we're inside a git repo > -if test -d .git > +if test -d .git && command -v git > /dev/null Style: no space between redirect and file: >/dev/null I'm not sure command is the most portable way to achieve this, how about this instead: git --version >/dev/null 2>&1 > then > V=$(git describe --abbrev=4 HEAD 2>/dev/null) > fi > -- > 1.7.10.4 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] gen-version.sh: check if git is available before trying to call it 2014-02-01 13:56 ` john @ 2014-02-01 14:06 ` lekensteyn 2014-02-01 15:10 ` t74jgwb88tli9ch 0 siblings, 1 reply; 10+ messages in thread From: lekensteyn @ 2014-02-01 14:06 UTC (permalink / raw) On Saturday 01 February 2014 13:56:46 John Keeping wrote: > > diff --git a/gen-version.sh b/gen-version.sh > > index 3a08015..13ff979 100755 > > --- a/gen-version.sh > > +++ b/gen-version.sh > > @@ -4,7 +4,7 @@ > > > > V=$1 > > > > # Use `git describe` to get current version if we're inside a git repo > > > > -if test -d .git > > +if test -d .git && command -v git > /dev/null > > Style: no space between redirect and file: >/dev/null > > I'm not sure command is the most portable way to achieve this, how about > this instead: > > git --version >/dev/null 2>&1 If you are testing for git anyway, what about testing the result rather than the command: gitver=$(git describe --abbrev=4 HEAD 2>/dev/null) [ -z "$gitver" ] || V=$gitver > > then > > V=$(git describe --abbrev=4 HEAD 2>/dev/null) > > fi Regards, Peter ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] gen-version.sh: check if git is available before trying to call it 2014-02-01 14:06 ` lekensteyn @ 2014-02-01 15:10 ` t74jgwb88tli9ch 2014-02-05 10:23 ` cgit 2014-02-05 14:09 ` Jason 0 siblings, 2 replies; 10+ messages in thread From: t74jgwb88tli9ch @ 2014-02-01 15:10 UTC (permalink / raw) On 01/02/2014 15:06, Peter Wu wrote: > On Saturday 01 February 2014 13:56:46 John Keeping wrote: >>> diff --git a/gen-version.sh b/gen-version.sh >>> index 3a08015..13ff979 100755 >>> --- a/gen-version.sh >>> +++ b/gen-version.sh >>> @@ -4,7 +4,7 @@ >>> >>> V=$1 >>> >>> # Use `git describe` to get current version if we're inside a git repo >>> >>> -if test -d .git >>> +if test -d .git && command -v git > /dev/null >> >> Style: no space between redirect and file: >/dev/null >> >> I'm not sure command is the most portable way to achieve this, how about >> this instead: >> >> git --version >/dev/null 2>&1 "command -v" is POSIX compliant [1] but your version is nice, maybe nicer because POSIX is not that universal. Up to you. > If you are testing for git anyway, what about testing the result rather than > the command: > > gitver=$(git describe --abbrev=4 HEAD 2>/dev/null) > [ -z "$gitver" ] || V=$gitver > >>> then >>> V=$(git describe --abbrev=4 HEAD 2>/dev/null) >>> fi Not so nice I guess because git might find a .git folder in some parent directory and produce a (wrong) result. Here is yet another version (+ patch file): if test "$(git rev-parse --git-dir 2>/dev/null)" = '.git' then V=$(git describe --abbrev=4 HEAD 2>/dev/null) fi I think this one solves the above problems. Regards, Fabien [1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gen-version.sh-check-if-git-is-available-before-tryi.patch Type: text/x-patch Size: 910 bytes Desc: not available URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140201/6c49bd69/attachment.bin> ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] gen-version.sh: check if git is available before trying to call it 2014-02-01 15:10 ` t74jgwb88tli9ch @ 2014-02-05 10:23 ` cgit 2014-02-05 14:09 ` Jason 1 sibling, 0 replies; 10+ messages in thread From: cgit @ 2014-02-05 10:23 UTC (permalink / raw) On Sat, 01 Feb 2014 at 16:10:44, Fabien C. wrote: > [...] > if test "$(git rev-parse --git-dir 2>/dev/null)" = '.git' > then > V=$(git describe --abbrev=4 HEAD 2>/dev/null) > fi > > I think this one solves the above problems. I personally like this approach. Jason? > > Regards, > Fabien > > [1]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html > > > _______________________________________________ > CGit mailing list > CGit at lists.zx2c4.com > http://lists.zx2c4.com/mailman/listinfo/cgit ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] gen-version.sh: check if git is available before trying to call it 2014-02-01 15:10 ` t74jgwb88tli9ch 2014-02-05 10:23 ` cgit @ 2014-02-05 14:09 ` Jason 1 sibling, 0 replies; 10+ messages in thread From: Jason @ 2014-02-05 14:09 UTC (permalink / raw) On Sat, Feb 1, 2014 at 4:10 PM, Fabien C. <t74jgwb88tli9ch at jetable.org> wrote: > > Here is yet another version (+ patch file): > > if test "$(git rev-parse --git-dir 2>/dev/null)" = '.git' > then > V=$(git describe --abbrev=4 HEAD 2>/dev/null) > fi Merged, thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] gen-version.sh: check if git is available before trying to call it @ 2014-01-31 23:00 t74jgwb88tli9ch 0 siblings, 0 replies; 10+ messages in thread From: t74jgwb88tli9ch @ 2014-01-31 23:00 UTC (permalink / raw) Hello, please merge this small fix. Thanks, Fabien C. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gen-version.sh-check-if-git-is-available-before-tryi.patch Type: text/x-patch Size: 888 bytes Desc: not available URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140201/d5511ffe/attachment.bin> ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] gen-version.sh: check if git is available before trying to call it @ 2014-01-31 22:37 t74jgwb88tli9ch 0 siblings, 0 replies; 10+ messages in thread From: t74jgwb88tli9ch @ 2014-01-31 22:37 UTC (permalink / raw) Hello, please merge this small fix. Thanks, Fabien C. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gen-version.sh-check-if-git-is-available-before-tryi.patch Type: text/x-patch Size: 887 bytes Desc: not available URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20140131/bf1dc968/attachment.bin> ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-02-05 14:09 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-01-31 23:02 [PATCH] gen-version.sh: check if git is available before trying to call it t74jgwb88tli9ch [not found] ` <CAHmME9rwbdCfdeDYWcnKmyDjcsUQ_VaYF2755aHfbgUQeMNQQw@mail.gmail.com> [not found] ` <52EC2C77.10503@jetable.org> [not found] ` <CAHmME9qKOEU0Q+yAYUw5N4_AOS38bK4kHp2p8-MwYPGOh=ZOKg@mail.gmail.com> 2014-02-01 10:07 ` Jason 2014-02-01 13:23 ` t74jgwb88tli9ch 2014-02-01 13:56 ` john 2014-02-01 14:06 ` lekensteyn 2014-02-01 15:10 ` t74jgwb88tli9ch 2014-02-05 10:23 ` cgit 2014-02-05 14:09 ` Jason -- strict thread matches above, loose matches on Subject: below -- 2014-01-31 23:00 t74jgwb88tli9ch 2014-01-31 22:37 t74jgwb88tli9ch
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).