* [PATCH 1/3] GIT-VERSION-GEN: make use of git describe --dirty [not found] <cover.1287746107.git.misfire@debugon.org> @ 2010-10-22 11:24 ` Mathias Lafeldt 2010-10-22 15:11 ` Jonathan Nieder 2010-10-22 11:24 ` [PATCH 2/3] GIT-VERSION-GEN: tweak processing of version file Mathias Lafeldt 2010-10-22 11:24 ` [PATCH 3/3] GIT-VERSION-GEN: style nitpicks Mathias Lafeldt 2 siblings, 1 reply; 7+ messages in thread From: Mathias Lafeldt @ 2010-10-22 11:24 UTC (permalink / raw) To: git Currently, GIT-VERSION-GEN invokes the plumbing commands "git update-index" and "git diff-index" to determine if the working tree is dirty. It then appends "-dirty" to the version string returned by "git describe". However, as of Git v1.6.6, "git describe" can be told to do all that with the "--dirty" option, saving us the plumbing. Signed-off-by: Mathias Lafeldt <misfire@debugon.org> --- GIT-VERSION-GEN | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index d441d88..73d5cf9 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -12,13 +12,10 @@ if test -f version then VN=$(cat version) || VN="$DEF_VER" elif test -d .git -o -f .git && - VN=$(git describe --match "v[0-9]*" --abbrev=4 HEAD 2>/dev/null) && + VN=$(git describe --match "v[0-9]*" --abbrev=4 --dirty 2>/dev/null) && case "$VN" in *$LF*) (exit 1) ;; - v[0-9]*) - git update-index -q --refresh - test -z "$(git diff-index --name-only HEAD --)" || - VN="$VN-dirty" ;; + v[0-9]*) : ;; esac then VN=$(echo "$VN" | sed -e 's/-/./g'); -- 1.7.3.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] GIT-VERSION-GEN: make use of git describe --dirty 2010-10-22 11:24 ` [PATCH 1/3] GIT-VERSION-GEN: make use of git describe --dirty Mathias Lafeldt @ 2010-10-22 15:11 ` Jonathan Nieder 2010-10-23 12:23 ` Mathias Lafeldt 0 siblings, 1 reply; 7+ messages in thread From: Jonathan Nieder @ 2010-10-22 15:11 UTC (permalink / raw) To: Mathias Lafeldt; +Cc: git Mathias Lafeldt wrote: > Currently, GIT-VERSION-GEN invokes the plumbing commands "git update-index" and > "git diff-index" to determine if the working tree is dirty. It then appends > "-dirty" to the version string returned by "git describe". > > However, as of Git v1.6.6, "git describe" can be told to do all that with the > "--dirty" option, saving us the plumbing. This has a minor downside, which is avoiding the nice version numbers when building Git with git 1.5.6 installed. What is the upside? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] GIT-VERSION-GEN: make use of git describe --dirty 2010-10-22 15:11 ` Jonathan Nieder @ 2010-10-23 12:23 ` Mathias Lafeldt 2010-10-27 7:50 ` Mathias Lafeldt 0 siblings, 1 reply; 7+ messages in thread From: Mathias Lafeldt @ 2010-10-23 12:23 UTC (permalink / raw) To: Jonathan Nieder; +Cc: git On 10/22/2010 05:11 PM, Jonathan Nieder wrote: > Mathias Lafeldt wrote: > >> Currently, GIT-VERSION-GEN invokes the plumbing commands "git update-index" and >> "git diff-index" to determine if the working tree is dirty. It then appends >> "-dirty" to the version string returned by "git describe". >> >> However, as of Git v1.6.6, "git describe" can be told to do all that with the >> "--dirty" option, saving us the plumbing. > > This has a minor downside, which is avoiding the nice version numbers when > building Git with git 1.5.6 installed. What is the upside? The upside is that the number of executed commands to get the version string is reduced from three to one. I understand your point, though it would only be a "problem" once when doing the upgrade. If backwards compatibility is more important here, I'd at least add a comment to GIT-VERSION-GEN. Something like: diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index d441d88..5c226f6 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -16,6 +16,10 @@ elif test -d .git -o -f .git && case "$VN" in *$LF*) (exit 1) ;; v[0-9]*) + # As of Git v1.6.6, we can use "git describe --dirty" to + # determine if the working tree is dirty. However, to still + # have nice version numbers when building Git with older + # versions of git installed, we keep using plumbing. git update-index -q --refresh test -z "$(git diff-index --name-only HEAD --)" || VN="$VN-dirty" ;; -Mathias ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] GIT-VERSION-GEN: make use of git describe --dirty 2010-10-23 12:23 ` Mathias Lafeldt @ 2010-10-27 7:50 ` Mathias Lafeldt 2010-10-27 14:28 ` Jakub Narebski 0 siblings, 1 reply; 7+ messages in thread From: Mathias Lafeldt @ 2010-10-27 7:50 UTC (permalink / raw) To: Jonathan Nieder; +Cc: git, Junio C Hamano Mathias Lafeldt wrote: > On 10/22/2010 05:11 PM, Jonathan Nieder wrote: >> Mathias Lafeldt wrote: >> >>> Currently, GIT-VERSION-GEN invokes the plumbing commands "git update-index" and >>> "git diff-index" to determine if the working tree is dirty. It then appends >>> "-dirty" to the version string returned by "git describe". >>> >>> However, as of Git v1.6.6, "git describe" can be told to do all that with the >>> "--dirty" option, saving us the plumbing. >> This has a minor downside, which is avoiding the nice version numbers when >> building Git with git 1.5.6 installed. What is the upside? > > The upside is that the number of executed commands to get the version string > is reduced from three to one. > > I understand your point, though it would only be a "problem" once when > doing the upgrade. > > If backwards compatibility is more important here, I'd at least add a comment > to GIT-VERSION-GEN. Something like: > > diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN > index d441d88..5c226f6 100755 > --- a/GIT-VERSION-GEN > +++ b/GIT-VERSION-GEN > @@ -16,6 +16,10 @@ elif test -d .git -o -f .git && > case "$VN" in > *$LF*) (exit 1) ;; > v[0-9]*) > + # As of Git v1.6.6, we can use "git describe --dirty" to > + # determine if the working tree is dirty. However, to still > + # have nice version numbers when building Git with older > + # versions of git installed, we keep using plumbing. > git update-index -q --refresh > test -z "$(git diff-index --name-only HEAD --)" || > VN="$VN-dirty" ;; > Any feedback would be welcome. -Mathias ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] GIT-VERSION-GEN: make use of git describe --dirty 2010-10-27 7:50 ` Mathias Lafeldt @ 2010-10-27 14:28 ` Jakub Narebski 0 siblings, 0 replies; 7+ messages in thread From: Jakub Narebski @ 2010-10-27 14:28 UTC (permalink / raw) To: Mathias Lafeldt; +Cc: Jonathan Nieder, git, Junio C Hamano Mathias Lafeldt <misfire@debugon.org> writes: > Mathias Lafeldt wrote: > > diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN > > index d441d88..5c226f6 100755 > > --- a/GIT-VERSION-GEN > > +++ b/GIT-VERSION-GEN > > @@ -16,6 +16,10 @@ elif test -d .git -o -f .git && > > case "$VN" in > > *$LF*) (exit 1) ;; > > v[0-9]*) > > + # As of Git v1.6.6, we can use "git describe --dirty" to > > + # determine if the working tree is dirty. However, to still > > + # have nice version numbers when building Git with older > > + # versions of git installed, we keep using plumbing. > > git update-index -q --refresh > > test -z "$(git diff-index --name-only HEAD --)" || > > VN="$VN-dirty" ;; > > > > Any feedback would be welcome. I like it, also because people who use GIT-VERSION-GEN from git repository as inspiration would get to know more modern technique. -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] GIT-VERSION-GEN: tweak processing of version file [not found] <cover.1287746107.git.misfire@debugon.org> 2010-10-22 11:24 ` [PATCH 1/3] GIT-VERSION-GEN: make use of git describe --dirty Mathias Lafeldt @ 2010-10-22 11:24 ` Mathias Lafeldt 2010-10-22 11:24 ` [PATCH 3/3] GIT-VERSION-GEN: style nitpicks Mathias Lafeldt 2 siblings, 0 replies; 7+ messages in thread From: Mathias Lafeldt @ 2010-10-22 11:24 UTC (permalink / raw) To: git - check for version file with "test -r" - read version file using shell builtin "read" rather than "cat" Signed-off-by: Mathias Lafeldt <misfire@debugon.org> --- GIT-VERSION-GEN | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 73d5cf9..427d5d6 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -8,9 +8,9 @@ LF=' # First see if there is a version file (included in release tarballs), # then try git-describe, then default. -if test -f version +if test -r version then - VN=$(cat version) || VN="$DEF_VER" + read VN 2>/dev/null < version || VN="$DEF_VER" elif test -d .git -o -f .git && VN=$(git describe --match "v[0-9]*" --abbrev=4 --dirty 2>/dev/null) && case "$VN" in -- 1.7.3.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] GIT-VERSION-GEN: style nitpicks [not found] <cover.1287746107.git.misfire@debugon.org> 2010-10-22 11:24 ` [PATCH 1/3] GIT-VERSION-GEN: make use of git describe --dirty Mathias Lafeldt 2010-10-22 11:24 ` [PATCH 2/3] GIT-VERSION-GEN: tweak processing of version file Mathias Lafeldt @ 2010-10-22 11:24 ` Mathias Lafeldt 2 siblings, 0 replies; 7+ messages in thread From: Mathias Lafeldt @ 2010-10-22 11:24 UTC (permalink / raw) To: git - remove superfluous semicolon - simplify version comparison - remove empty lines at end of file Signed-off-by: Mathias Lafeldt <misfire@debugon.org> --- GIT-VERSION-GEN | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index 427d5d6..60bef5a 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -18,7 +18,7 @@ elif test -d .git -o -f .git && v[0-9]*) : ;; esac then - VN=$(echo "$VN" | sed -e 's/-/./g'); + VN=$(echo "$VN" | sed -e 's/-/./g') else VN="$DEF_VER" fi @@ -31,9 +31,9 @@ then else VC=unset fi -test "$VN" = "$VC" || { + +if test "$VN" != "$VC" +then echo >&2 "GIT_VERSION = $VN" echo "GIT_VERSION = $VN" >$GVF -} - - +fi -- 1.7.3.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-10-27 14:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1287746107.git.misfire@debugon.org>
2010-10-22 11:24 ` [PATCH 1/3] GIT-VERSION-GEN: make use of git describe --dirty Mathias Lafeldt
2010-10-22 15:11 ` Jonathan Nieder
2010-10-23 12:23 ` Mathias Lafeldt
2010-10-27 7:50 ` Mathias Lafeldt
2010-10-27 14:28 ` Jakub Narebski
2010-10-22 11:24 ` [PATCH 2/3] GIT-VERSION-GEN: tweak processing of version file Mathias Lafeldt
2010-10-22 11:24 ` [PATCH 3/3] GIT-VERSION-GEN: style nitpicks Mathias Lafeldt
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.