threads / discuss / 4359

git --version

Subject: git --version

## tl;dr

19 messages between May 30, 2006 and May 31, 2006.

replies: 18people: 3as markdown or json

Paolo Ciarrocchi· May 30, 2006, 22:16 UTC · lore

Hi all, I'm confused by the following: paolo@Italia:~/git$ ./GIT-VERSION-GEN GIT_VERSION = 1.3.3.g2186

paolo@Italia:~/git$ git --version git version 1.3.GIT

Why git --version is not reporting the "full" version number?
Thanks.
Ciao,
-- 
Paolo
http://paolociarrocchi.googlepages.com
Junio C Hamano· May 30, 2006, 22:29 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

"Paolo Ciarrocchi" <paolo.ciarrocchi@gmail.com> writes:
Show 8 quoted lines
> I'm confused by the following:
> paolo@Italia:~/git$ ./GIT-VERSION-GEN
> GIT_VERSION = 1.3.3.g2186
>
> paolo@Italia:~/git$ git --version
> git version 1.3.GIT
>
> Why git --version is not reporting the "full" version number?

There is a bit of chicken and egg problem involved. The build procedure wants to have an already installed git to figure out the "full" version number. If you are bootstrapping, make clean and rebuild after you install git once would give you a git binary that knows what version it is.

Paolo Ciarrocchi· May 31, 2006, 18:58 UTC · re: Junio C Hamano · lore

Re: git --version

On 5/31/06, Junio C Hamano <junkio@cox.net> wrote:
Show 16 quoted lines
> "Paolo Ciarrocchi" <paolo.ciarrocchi@gmail.com> writes:
>
> > I'm confused by the following:
> > paolo@Italia:~/git$ ./GIT-VERSION-GEN
> > GIT_VERSION = 1.3.3.g2186
> >
> > paolo@Italia:~/git$ git --version
> > git version 1.3.GIT
> >
> > Why git --version is not reporting the "full" version number?
>
> There is a bit of chicken and egg problem involved.  The build
> procedure wants to have an already installed git to figure out
> the "full" version number.  If you are bootstrapping, make clean
> and rebuild after you install git once would give you a git
> binary that knows what version it is.

Either I didn't understand your answer or something is wrong with my git installation:

paolo@Italia:~$ cd git/ paolo@Italia:~/git$ git --version git version 1.3.GIT paolo@Italia:~/git$ make >/dev/null paolo@Italia:~/git$ sudo make install >/dev/null Password: GIT_VERSION = 1.3.GIT paolo@Italia:~/git$ git --version git version 1.3.GIT paolo@Italia:~/git$

-- 
Paolo
http://paolociarrocchi.googlepages.com
Junio C Hamano· May 31, 2006, 19:06 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

"Paolo Ciarrocchi" <paolo.ciarrocchi@gmail.com> writes:
Show 7 quoted lines
> paolo@Italia:~$ cd git/
> paolo@Italia:~/git$ git --version
> git version 1.3.GIT
> paolo@Italia:~/git$ make >/dev/null
> paolo@Italia:~/git$ sudo make install >/dev/null
> Password:
> GIT_VERSION = 1.3.GIT

Unfortunate is we cannot see what this "sudo" did -- does it successfully run (installed) git to check the "full" version and manage to store it in ./GIT-VERSION-FILE?

Paolo Ciarrocchi· May 31, 2006, 19:13 UTC · re: Junio C Hamano · lore

Re: git --version

On 5/31/06, Junio C Hamano <junkio@cox.net> wrote:
Show 13 quoted lines
> "Paolo Ciarrocchi" <paolo.ciarrocchi@gmail.com> writes:
>
> > paolo@Italia:~$ cd git/
> > paolo@Italia:~/git$ git --version
> > git version 1.3.GIT
> > paolo@Italia:~/git$ make >/dev/null
> > paolo@Italia:~/git$ sudo make install >/dev/null
> > Password:
> > GIT_VERSION = 1.3.GIT
>
> Unfortunate is we cannot see what this "sudo" did -- does it
> successfully run (installed) git to check the "full" version and
> manage to store it in ./GIT-VERSION-FILE?
Just the few last lines:
install git-checkout-index git-clone-pack git-convert-objects
git-fetch-pack git-fsck-objects git-hash-object git-index-pack
git-local-fetch git-mailinfo git-merge-base git-merge-index git-mktag
git-mktree git-pack-objects git-patch-id git-peek-remote
git-prune-packed git-receive-pack git-rev-parse git-send-pack
git-shell git-show-index git-ssh-fetch git-ssh-upload git-unpack-file
git-unpack-objects git-update-index git-update-server-info
git-upload-pack git-verify-pack git-write-tree git-update-ref
git-symbolic-ref git-name-rev git-pack-redundant git-repo-config
git-var git-describe git-merge-tree git-blame git-imap-send
git-ssh-pull git-ssh-push git-http-fetch git-http-push
git-get-tar-commit-id git-mailsplit git-stripspace git-daemon
git-bisect git-branch git-checkout git-cherry git-clean git-clone
git-commit git-fetch git-ls-remote git-merge-one-file git-parse-remote
git-prune git-pull git-rebase git-repack git-request-pull git-reset
git-resolve git-revert git-sh-setup git-tag git-verify-tag
git-applymbox git-applypatch git-am git-merge git-merge-stupid
git-merge-octopus git-merge-resolve git-merge-ours git-lost-found
git-quiltimport git-archimport git-cvsimport git-relink git-shortlog
git-fmt-merge-msg git-rerere git-annotate git-cvsserver git-svnimport
git-mv git-cvsexportcommit git-send-email git-merge-recursive
git-cherry-pick git-status '/home/paolo/bin'
install git gitk '/home/paolo/bin'
make -C templates install
make[1]: Entering directory `/home/paolo/git/templates'
: no custom templates yet
install -d -m755 '/home/paolo/share/git-core/templates/'
(cd blt && tar cf - .) | \
        (cd '/home/paolo/share/git-core/templates/' && tar xf -)
make[1]: Leaving directory `/home/paolo/git/templates'
install -d -m755 '/home/paolo/share/git-core/python'
install gitMergeCommon.py '/home/paolo/share/git-core/python'
if test 'z/home/paolo/bin' != 'z/home/paolo/bin'; \
        then \
                ln -f '/home/paolo/bin/git' \
                        '/home/paolo/bin/git' || \
                cp '/home/paolo/bin/git' \
                        '/home/paolo/bin/git'; \
        fi
rm -f '/home/paolo/bin/git-log' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-log' ;  rm -f '/home/paolo/bin/git-whatchanged'
&& ln '/home/paolo/bin/git' '/home/paolo/bin/git-whatchanged' ;  rm -f
'/home/paolo/bin/git-show' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-show' ;  rm -f
'/home/paolo/bin/git-count-objects' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-count-objects' ;  rm -f
'/home/paolo/bin/git-diff' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-diff' ;  rm -f '/home/paolo/bin/git-push' && ln
'/home/paolo/bin/git' '/home/paolo/bin/git-push' ;  rm -f
'/home/paolo/bin/git-grep' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-grep' ;  rm -f '/home/paolo/bin/git-add' && ln
'/home/paolo/bin/git' '/home/paolo/bin/git-add' ;  rm -f
'/home/paolo/bin/git-rm' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-rm' ;  rm -f '/home/paolo/bin/git-rev-list' && ln
'/home/paolo/bin/git' '/home/paolo/bin/git-rev-list' ; rm -f
'/home/paolo/bin/git-check-ref-format' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-check-ref-format' ;  rm -f
'/home/paolo/bin/git-init-db' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-init-db' ;  rm -f '/home/paolo/bin/git-tar-tree'
&& ln '/home/paolo/bin/git' '/home/paolo/bin/git-tar-tree' ;  rm -f
'/home/paolo/bin/git-upload-tar' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-upload-tar' ;  rm -f
'/home/paolo/bin/git-format-patch' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-format-patch' ;  rm -f
'/home/paolo/bin/git-ls-files' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-ls-files' ;  rm -f '/home/paolo/bin/git-ls-tree'
&& ln '/home/paolo/bin/git' '/home/paolo/bin/git-ls-tree' ;  rm -f
'/home/paolo/bin/git-read-tree' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-read-tree' ;  rm -f
'/home/paolo/bin/git-commit-tree' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-commit-tree' ;  rm -f '/home/paolo/bin/git-apply'
&& ln '/home/paolo/bin/git' '/home/paolo/bin/git-apply' ;  rm -f
'/home/paolo/bin/git-show-branch' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-show-branch' ;  rm -f
'/home/paolo/bin/git-diff-files' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-diff-files' ;  rm -f
'/home/paolo/bin/git-diff-index' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-diff-index' ;  rm -f
'/home/paolo/bin/git-diff-stages' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-diff-stages' ;  rm -f
'/home/paolo/bin/git-diff-tree' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-diff-tree' ;  rm -f
'/home/paolo/bin/git-cat-file' && ln '/home/paolo/bin/git'
'/home/paolo/bin/git-cat-file' ;
paolo@Italia:~/git$ git --version

So yes, it's correctly installed (I pull, compile and install almost daily always without any problem).

Ciao and thanks!
-- 
Paolo
http://paolociarrocchi.googlepages.com
Paolo Ciarrocchi· May 31, 2006, 19:20 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

On 5/31/06, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:
 > So yes, it's correctly installed (I pull, compile and install almost
> daily always without any problem).
>
Tried with:
 make clean
 make && sudo make install
 [...]
 paolo@Italia:~/git$ git --version
 git version 1.3.GIT
 paolo@Italia:~/git$ ./GIT-VERSION-GEN
 GIT_VERSION = 1.3.3.g2186
Puzzled.
-- 
Paolo
http://paolociarrocchi.googlepages.com
Linus Torvalds· May 31, 2006, 19:25 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
Show 9 quoted lines
> 
> Tried with:
> make clean
> make && sudo make install
> [...]
> paolo@Italia:~/git$ git --version
> git version 1.3.GIT
> paolo@Italia:~/git$ ./GIT-VERSION-GEN
> GIT_VERSION = 1.3.3.g2186
What does
	git describe
	./git --version
	which git
say?
		Linus
Paolo Ciarrocchi· May 31, 2006, 19:30 UTC · re: Linus Torvalds · lore

Re: git --version

On 5/31/06, Linus Torvalds <torvalds@osdl.org> wrote:
Show 16 quoted lines
>
>
> On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
> >
> > Tried with:
> > make clean
> > make && sudo make install
> > [...]
> > paolo@Italia:~/git$ git --version
> > git version 1.3.GIT
> > paolo@Italia:~/git$ ./GIT-VERSION-GEN
> > GIT_VERSION = 1.3.3.g2186
>
> What does
>
>         git describe

paolo@Italia:~/git$ git describe v1.3.3-g2186d56

>         ./git --version

paolo@Italia:~/git$ ./git --version git version 1.3.3.g2186

Doh..
>         which git

paolo@Italia:~/git$ which git /home/paolo/bin/git

Ciao,
-- 
Paolo
http://paolociarrocchi.googlepages.com
Paolo Ciarrocchi· May 31, 2006, 19:32 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

On 5/31/06, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:
Show 33 quoted lines
> On 5/31/06, Linus Torvalds <torvalds@osdl.org> wrote:
> >
> >
> > On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
> > >
> > > Tried with:
> > > make clean
> > > make && sudo make install
> > > [...]
> > > paolo@Italia:~/git$ git --version
> > > git version 1.3.GIT
> > > paolo@Italia:~/git$ ./GIT-VERSION-GEN
> > > GIT_VERSION = 1.3.3.g2186
> >
> > What does
> >
> >         git describe
>
> paolo@Italia:~/git$ git describe
> v1.3.3-g2186d56
>
> >         ./git --version
>
> paolo@Italia:~/git$ ./git --version
> git version 1.3.3.g2186
>
> Doh..
>
> >         which git
>
> paolo@Italia:~/git$ which git
> /home/paolo/bin/git
>

Ok... make && make install

Now I get: paolo@Italia:~$ git --version git version 1.3.3.g2186

That is correct.

But I'm still wondering why doing sudo make install caused that problem, git was correcly installed in /home/paolo/git

Really puzzled.
Ciao,
-- 
Paolo
http://paolociarrocchi.googlepages.com
Linus Torvalds· May 31, 2006, 19:35 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
Show 5 quoted lines
> > 
> >         git describe
> 
> paolo@Italia:~/git$ git describe
> v1.3.3-g2186d56
Ok.
Show 6 quoted lines
> >         ./git --version
> 
> paolo@Italia:~/git$ ./git --version
> git version 1.3.3.g2186
> 
> Doh..
Ok, that's also good.
> >         which git
> 
> paolo@Italia:~/git$ which git
> /home/paolo/bin/git
I think I know what's up.

Your "sudo" made "$HOME" be /root. So by doing "sudo make install", you installed the git in _roots_ ~/bin, ie /root/bin/.

			Linus
Paolo Ciarrocchi· May 31, 2006, 19:43 UTC · re: Linus Torvalds · lore

Re: git --version

On 5/31/06, Linus Torvalds <torvalds@osdl.org> wrote:
Show 28 quoted lines
> On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
> > >
> > >         git describe
> >
> > paolo@Italia:~/git$ git describe
> > v1.3.3-g2186d56
>
> Ok.
>
> > >         ./git --version
> >
> > paolo@Italia:~/git$ ./git --version
> > git version 1.3.3.g2186
> >
> > Doh..
>
> Ok, that's also good.
>
> > >         which git
> >
> > paolo@Italia:~/git$ which git
> > /home/paolo/bin/git
>
> I think I know what's up.
>
> Your "sudo" made "$HOME" be /root. So by doing "sudo make install", you
> installed the git in _roots_ ~/bin, ie /root/bin/.
>

Doh... not sure to follow you, just did: sudo make install paolo@Italia:~/git$ ls /root/ paolo@Italia:~/git$ git --version git version 1.3.GIT

-- 
Paolo
http://paolociarrocchi.googlepages.com
Paolo Ciarrocchi· May 31, 2006, 19:49 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

On 5/31/06, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:
Show 35 quoted lines
> On 5/31/06, Linus Torvalds <torvalds@osdl.org> wrote:
> > On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
> > > >
> > > >         git describe
> > >
> > > paolo@Italia:~/git$ git describe
> > > v1.3.3-g2186d56
> >
> > Ok.
> >
> > > >         ./git --version
> > >
> > > paolo@Italia:~/git$ ./git --version
> > > git version 1.3.3.g2186
> > >
> > > Doh..
> >
> > Ok, that's also good.
> >
> > > >         which git
> > >
> > > paolo@Italia:~/git$ which git
> > > /home/paolo/bin/git
> >
> > I think I know what's up.
> >
> > Your "sudo" made "$HOME" be /root. So by doing "sudo make install", you
> > installed the git in _roots_ ~/bin, ie /root/bin/.
> >
>
> Doh... not sure to follow you, just did:
> sudo make install
> paolo@Italia:~/git$ ls /root/
> paolo@Italia:~/git$ git --version
> git version 1.3.GIT

And even more intersting: make clean && make && sudo make install git --version git version 1.3.GIT

make install [...] mv git-cherry-pick+ git-cherry-pick mv: sovrascrivo `git-cherry-pick' ignorando il modo 0755? that in english is something like: mv: overwrite `git-cherry-pick' ignoring mod 0755?

Wow...of course, make clean && make install fix everything
Ciao,
-- 
Paolo
http://paolociarrocchi.googlepages.com
Paolo Ciarrocchi· May 31, 2006, 19:56 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

On 5/31/06, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote: [...]

Show 14 quoted lines
> And even more intersting:
> make clean && make && sudo make install
> git --version
> git version 1.3.GIT
>
> make install
> [...]
> mv git-cherry-pick+ git-cherry-pick
> mv: sovrascrivo `git-cherry-pick' ignorando il modo 0755?
> that in english is something like:
> mv: overwrite `git-cherry-pick' ignoring mod 0755?
>
> Wow...of course, make clean && make install fix everything
>
Thanks to loops on #git for asking me to do the following test:

<PaoloC> paolo@Italia:~/git$ sudo ./GIT-VERSION-GEN <PaoloC> GIT_VERSION = 1.3.GIT <PaoloC> paolo@Italia:~/git$ ./GIT-VERSION-GEN <PaoloC> GIT_VERSION = 1.3.3.g2186

I don't know why it's happening...
-- 
Paolo
http://paolociarrocchi.googlepages.com
Linus Torvalds· May 31, 2006, 20:08 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
Show 9 quoted lines
> 
> Thanks to loops on #git for asking me to do the following test:
> 
> <PaoloC> paolo@Italia:~/git$ sudo ./GIT-VERSION-GEN
> <PaoloC> GIT_VERSION = 1.3.GIT
> <PaoloC> paolo@Italia:~/git$ ./GIT-VERSION-GEN
> <PaoloC> GIT_VERSION = 1.3.3.g2186
> 
> I don't know why it's happening...

Heh. You don't have git in your PATH as root. So as root you don't know what version of git you have ;)

		Linus
Paolo Ciarrocchi· May 31, 2006, 20:08 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

On 5/31/06, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:
Show 25 quoted lines
> On 5/31/06, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:
> [...]
> > And even more intersting:
> > make clean && make && sudo make install
> > git --version
> > git version 1.3.GIT
> >
> > make install
> > [...]
> > mv git-cherry-pick+ git-cherry-pick
> > mv: sovrascrivo `git-cherry-pick' ignorando il modo 0755?
> > that in english is something like:
> > mv: overwrite `git-cherry-pick' ignoring mod 0755?
> >
> > Wow...of course, make clean && make install fix everything
> >
>
> Thanks to loops on #git for asking me to do the following test:
>
> <PaoloC> paolo@Italia:~/git$ sudo ./GIT-VERSION-GEN
> <PaoloC> GIT_VERSION = 1.3.GIT
> <PaoloC> paolo@Italia:~/git$ ./GIT-VERSION-GEN
> <PaoloC> GIT_VERSION = 1.3.3.g2186
>
> I don't know why it's happening...
Ok, thanks to the people living in #git!!

the problem is the following, from GIT-VERSION-GEN: #!/bin/sh

GVF=GIT-VERSION-FILE DEF_VER=v1.3.GIT

# 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
        VN=$(echo "$VN" | sed -e 's/-/./g');
elif test -f version
then
        VN=$(cat version) || VN="$DEF_VER"
else
        VN="$DEF_VER"
fi

paolo@Italia:~/git$ git describe --abbrev=4 HEAD v1.3.3-g2186

but...

paolo@Italia:~/git$ sudo git describe --abbrev=4 HEAD sudo: git: command not found

that's because: paolo@Italia:~/git$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games:/home/paolo/bin but... paolo@Italia:~/git$ sudo sh sh-3.1# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

Don't know whay $PATH are different but at least why I know why git has that strange behaviour.

Ciao,
-- 
Paolo
http://paolociarrocchi.googlepages.com
Linus Torvalds· May 31, 2006, 20:16 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
> 
> Don't know whay $PATH are different
See ENVIRONMENT in the sudo man-page:
        PATH                   Set to a sane value if sudo was configured with
                               the --with-secure-path option
so apparently your distro builds sudo with "--with-secure-path".
		Linus
Paolo Ciarrocchi· May 31, 2006, 20:19 UTC · re: Linus Torvalds · lore

Re: git --version

On 5/31/06, Linus Torvalds <torvalds@osdl.org> wrote:
Show 12 quoted lines
>
>
> On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
> >
> > Don't know whay $PATH are different
>
> See ENVIRONMENT in the sudo man-page:
>
>         PATH                   Set to a sane value if sudo was configured with
>                                the --with-secure-path option
>
> so apparently your distro builds sudo with "--with-secure-path".
Yup, you must be correct. Thanks.
My distro is Ubuntu Dapper.
Ciao,
-- 
Paolo
http://paolociarrocchi.googlepages.com
Linus Torvalds· May 31, 2006, 19:23 UTC · re: Paolo Ciarrocchi · lore

Re: git --version

On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
> [...]
> install git gitk '/home/paolo/bin'

Why are you doing a "sudo" when you install in your own ~/bin (the default for git).

The whole point of installing in ~/bin is to not need any elevated priorities.

I get the feeling that you might have installed something in /usr/bin/ or /usr/local/bin earlier, and that they are before ~/bin in your PATH.

		Linus
Paolo Ciarrocchi· May 31, 2006, 19:26 UTC · re: Linus Torvalds · lore

Re: git --version

On 5/31/06, Linus Torvalds <torvalds@osdl.org> wrote:
Show 8 quoted lines
>
>
> On Wed, 31 May 2006, Paolo Ciarrocchi wrote:
> > [...]
> > install git gitk '/home/paolo/bin'
>
> Why are you doing a "sudo" when you install in your own ~/bin (the default
> for git).

Good question :-) Just because I'm used to do that but you are absolutelly right saying that is wrong.

Show 5 quoted lines
> The whole point of installing in ~/bin is to not need any elevated
> priorities.
>
> I get the feeling that you might have installed something in /usr/bin/ or
> /usr/local/bin earlier, and that they are before ~/bin in your PATH.

I don't think so since: paolo@Italia:~/git$ which git /home/paolo/bin/git

But I'll do a make && make install in a minute.
Thanks!
Ciao,
-- 
Paolo
http://paolociarrocchi.googlepages.com

← back to recent threads