git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Trouble building newer git with older
@ 2006-08-08 18:47 Nishanth Aravamudan
  2006-08-08 20:11 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Nishanth Aravamudan @ 2006-08-08 18:47 UTC (permalink / raw)
  To: git

Hi all,

I am in the process of updating one of our system's set of git binaries
and noticed the following. When executing

git clone rsync://rsync.kernel.org/pub/scm/git/git.git git
cd git
git checkout
make

I get this error:

kernel:/home/nacc/download/git# make
GIT_VERSION = Usage: git COMMAND [OPTIONS] [TARGET]
 git command 'describe' not found: commands are:
    add apply archimport bisect branch checkout cherry clone
    commit count.objects cvsimport diff fetch format.patch
    fsck.cache get.tar.commit.id init.db log ls.remote octopus
    pack.objects parse.remote patch.id prune pull push rebase
    relink rename repack request.pull reset resolve revert
    send.email shortlog show.branch status tag verify.tag
    whatchanged-dirty
GIT-VERSION-FILE:2: *** multiple target patterns.  Stop.

This is because GIT-VERSION-GEN attempts to invoke `git describe` but
describe is not a valid parameter to the current version of git. This is
not treated as a failure case, though, as output is stored in VN.
Perhaps the return code of `git describe` should also be checked? Or am
I just not supposed to upgrade from this old of a version of git via
git?

Thanks,
Nish

-- 
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center

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

* Re: Trouble building newer git with older
  2006-08-08 18:47 Trouble building newer git with older Nishanth Aravamudan
@ 2006-08-08 20:11 ` Junio C Hamano
  2006-08-08 22:52   ` Nishanth Aravamudan
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2006-08-08 20:11 UTC (permalink / raw)
  To: Nishanth Aravamudan; +Cc: git

Nishanth Aravamudan <nacc@us.ibm.com> writes:

> This is because GIT-VERSION-GEN attempts to invoke `git describe` but
> describe is not a valid parameter to the current version of git. This is
> not treated as a failure case, though, as output is stored in VN.
> Perhaps the return code of `git describe` should also be checked? Or am
> I just not supposed to upgrade from this old of a version of git via
> git?

No, it was broken when this patch was applied.

        commit 1100ac81a90b03e0c037a286569a340decf7489b
        Author: Sean <seanlkml@sympatico.ca>
        Date:   Mon May 22 00:39:52 2006 -0400

Luckily, my copy of GNU interactive tools, when invoked like this:

	git describe --abbrev=4 HEAD 2>/dev/null

exits with an error code 1, so the existing code already catches it.

How about this patch?

-- >8 --
GIT-VERSION-GEN: adjust for ancient git

When an ancient "git" that does not understand "describe"
command is on the $PATH, "git describe" emitted a Usage message
without exiting non-zero status (which is a mistake we cannot
fix retroactively).  Catch this case to make sure we do not try
using phoney multi-line string as a version number.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 1ce217d..14923c9 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -3,9 +3,17 @@ #!/bin/sh
 GVF=GIT-VERSION-FILE
 DEF_VER=v1.4.2.GIT
 
+LF='
+'
+
 # First try git-describe, then see if there is a version file
 # (included in release tarballs), then default
-if VN=$(git describe --abbrev=4 HEAD 2>/dev/null); then
+if VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
+   case "$VN" in
+   *$LF*) (exit 1) ;;
+   v[0-9]*) : happy ;;
+   esac
+then
 	VN=$(echo "$VN" | sed -e 's/-/./g');
 elif test -f version
 then

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

* Re: Trouble building newer git with older
  2006-08-08 20:11 ` Junio C Hamano
@ 2006-08-08 22:52   ` Nishanth Aravamudan
  0 siblings, 0 replies; 3+ messages in thread
From: Nishanth Aravamudan @ 2006-08-08 22:52 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On 08.08.2006 [13:11:16 -0700], Junio C Hamano wrote:
> Nishanth Aravamudan <nacc@us.ibm.com> writes:
> 
> > This is because GIT-VERSION-GEN attempts to invoke `git describe` but
> > describe is not a valid parameter to the current version of git. This is
> > not treated as a failure case, though, as output is stored in VN.
> > Perhaps the return code of `git describe` should also be checked? Or am
> > I just not supposed to upgrade from this old of a version of git via
> > git?
> 
> No, it was broken when this patch was applied.
> 
>         commit 1100ac81a90b03e0c037a286569a340decf7489b
>         Author: Sean <seanlkml@sympatico.ca>
>         Date:   Mon May 22 00:39:52 2006 -0400
> 
> Luckily, my copy of GNU interactive tools, when invoked like this:
> 
> 	git describe --abbrev=4 HEAD 2>/dev/null
> 
> exits with an error code 1, so the existing code already catches it.
> 
> How about this patch?
> 
> -- >8 --
> GIT-VERSION-GEN: adjust for ancient git
> 
> When an ancient "git" that does not understand "describe"
> command is on the $PATH, "git describe" emitted a Usage message
> without exiting non-zero status (which is a mistake we cannot
> fix retroactively).  Catch this case to make sure we do not try
> using phoney multi-line string as a version number.
> 
> Signed-off-by: Junio C Hamano <junkio@cox.net>

Looks good to me and I can confirm this fixes the problem here.

Acked-by: Nishanth Aravamudan <nacc@us.ibm.com>

Thanks,
Nish

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

end of thread, other threads:[~2006-08-08 22:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-08 18:47 Trouble building newer git with older Nishanth Aravamudan
2006-08-08 20:11 ` Junio C Hamano
2006-08-08 22:52   ` Nishanth Aravamudan

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