threads / discuss / 9441

Git'ing a non-labeled set of sources

Subject: Git'ing a non-labeled set of sources

## tl;dr

8 messages between Aug 8, 2007 and Aug 9, 2007.

replies: 7people: 4as markdown or json

Sparks, Sam· Aug 8, 2007, 18:59 UTC · lore
Hello All,

Please excuse me if this is an ignorant question; I'm new to git and my have overlooked something in the documentation.

I'm attempting to obtain a snapshot of source code from an unlabeled git branch in a public repository. I've found in the documentation that a timestamp cannot be used to specify a particular version of source code, but I believe I can work with the commit value as returned by 'git show'.

However, I have been unsuccessful in my attempts to use this identifier to clone or checkout the associated source tree. Has anyone been successful in using git to successfully replicate an unlabeled version of sources in a repository?

Here is my latest attempt:
/dir_i_want_to_replicate $ git show --pretty=short
commit 5b1313fb2758ffce8b624457f777d8cc6709608d
Author: ....
/replication_dir $ git clone git://www.denx.de/git/u-boot.git
u-boot-mpc83xx
Blah blah blah..
 100% (4378/4378) done
/replication_dir/u-boot-mpc83xx/ $ git checkout
5b1313fb2758ffce8b624457f777d8cc6709608d
error: pathspec '5b1313fb2758ffce8b624457f777d8cc6709608d' did not match
any. 

Any suggestions would be greatly appreciated. Thanks in advance, Sam Sparks

Peter Baumann· Aug 8, 2007, 19:37 UTC · re: Sparks, Sam · lore

Re: Git'ing a non-labeled set of sources

On Wed, Aug 08, 2007 at 01:59:38PM -0500, Sparks, Sam wrote:
Show 30 quoted lines
> Hello All,
> 
> Please excuse me if this is an ignorant question; I'm new to git and my
> have overlooked something in the documentation.
> 
> I'm attempting to obtain a snapshot of source code from an unlabeled git
> branch in a public repository. I've found in the documentation that a
> timestamp cannot be used to specify a particular version of source code,
> but I believe I can work with the commit value as returned by 'git
> show'.
> 
> However, I have been unsuccessful in my attempts to use this identifier
> to clone or checkout the associated source tree. Has anyone been
> successful in using git to successfully replicate an unlabeled version
> of sources in a repository?
> 
> Here is my latest attempt:
> /dir_i_want_to_replicate $ git show --pretty=short
> commit 5b1313fb2758ffce8b624457f777d8cc6709608d
> Author: ....
> 
> /replication_dir $ git clone git://www.denx.de/git/u-boot.git
> u-boot-mpc83xx
> Blah blah blah..
>  100% (4378/4378) done
> /replication_dir/u-boot-mpc83xx/ $ git checkout
> 5b1313fb2758ffce8b624457f777d8cc6709608d
> error: pathspec '5b1313fb2758ffce8b624457f777d8cc6709608d' did not match
> any. 
> 

Because there is no 5b1313fb2758ffce8b624457f777d8cc6709608d in the repo.

  $ git clone git://www.denx.de/git/u-boot.git
  Initialized empty Git repository in /tmp/u-boot/.git/
  remote: Generating pack...
  remote: Done counting 40938 objects.
  remote: Deltifying 40938 objects.
  remote:  100% (40938/40938) done
  Indexing 40938 objects...
  remote: Total 40938 (delta 32545), reused 39302 (delta 31040)
  100% (40938/40938) done
  Resolving 32545 deltas...
  100% (32545/32545) done
  $ cd u-boot; git-rev-list --all|grep ^5b1
  5b1d713721c3ea02549940133f09236783dda1f9
-Peter
Sparks, Sam· Aug 8, 2007, 19:52 UTC · re: Peter Baumann · lore

RE: Git'ing a non-labeled set of sources

Show 64 quoted lines
>-----Original Message-----
>From: Peter Baumann [mailto:waste.manager@gmx.de] 
>Sent: Wednesday, August 08, 2007 2:37 PM
>To: Sparks, Sam
>Cc: git@vger.kernel.org
>Subject: Re: Git'ing a non-labeled set of sources
>
>On Wed, Aug 08, 2007 at 01:59:38PM -0500, Sparks, Sam wrote:
>> Hello All,
>> 
>> Please excuse me if this is an ignorant question; I'm new to 
>git and my
>> have overlooked something in the documentation.
>> 
>> I'm attempting to obtain a snapshot of source code from an 
>unlabeled git
>> branch in a public repository. I've found in the documentation that a
>> timestamp cannot be used to specify a particular version of 
>source code,
>> but I believe I can work with the commit value as returned by 'git
>> show'.
>> 
>> However, I have been unsuccessful in my attempts to use this 
>identifier
>> to clone or checkout the associated source tree. Has anyone been
>> successful in using git to successfully replicate an 
>unlabeled version
>> of sources in a repository?
>> 
>> Here is my latest attempt:
>> /dir_i_want_to_replicate $ git show --pretty=short
>> commit 5b1313fb2758ffce8b624457f777d8cc6709608d
>> Author: ....
>> 
>> /replication_dir $ git clone git://www.denx.de/git/u-boot.git
>> u-boot-mpc83xx
>> Blah blah blah..
>>  100% (4378/4378) done
>> /replication_dir/u-boot-mpc83xx/ $ git checkout
>> 5b1313fb2758ffce8b624457f777d8cc6709608d
>> error: pathspec '5b1313fb2758ffce8b624457f777d8cc6709608d' 
>did not match
>> any. 
>> 
>
>Because there is no 5b1313fb2758ffce8b624457f777d8cc6709608d in the
>repo.
>
>  $ git clone git://www.denx.de/git/u-boot.git
>  Initialized empty Git repository in /tmp/u-boot/.git/
>  remote: Generating pack...
>  remote: Done counting 40938 objects.
>  remote: Deltifying 40938 objects.
>  remote:  100% (40938/40938) done
>  Indexing 40938 objects...
>  remote: Total 40938 (delta 32545), reused 39302 (delta 31040)
>  100% (40938/40938) done
>  Resolving 32545 deltas...
>  100% (32545/32545) done
>
>  $ cd u-boot; git-rev-list --all|grep ^5b1
>  5b1d713721c3ea02549940133f09236783dda1f9
>
>-Peter

Hmmm. There must be something I am not understanding about git. When I run the same command on my existing git repository, I get the following: $ git-rev-list --all | grep ^5b1 5b1313fb2758ffce8b624457f777d8cc6709608d 5b1d713721c3ea02549940133f09236783dda1f9

Does git allow the removal of commits? I don't understand how I was able to download it a couple of months ago, but it is no longer accessible.

Thanks for the quick reply, Sam

Peter Baumann· Aug 8, 2007, 20:17 UTC · re: Sparks, Sam · lore

Re: Git'ing a non-labeled set of sources

On Wed, Aug 08, 2007 at 02:52:14PM -0500, Sparks, Sam wrote:
Show 79 quoted lines
>  
> 
> >-----Original Message-----
> >From: Peter Baumann [mailto:waste.manager@gmx.de] 
> >Sent: Wednesday, August 08, 2007 2:37 PM
> >To: Sparks, Sam
> >Cc: git@vger.kernel.org
> >Subject: Re: Git'ing a non-labeled set of sources
> >
> >On Wed, Aug 08, 2007 at 01:59:38PM -0500, Sparks, Sam wrote:
> >> Hello All,
> >> 
> >> Please excuse me if this is an ignorant question; I'm new to 
> >git and my
> >> have overlooked something in the documentation.
> >> 
> >> I'm attempting to obtain a snapshot of source code from an 
> >unlabeled git
> >> branch in a public repository. I've found in the documentation that a
> >> timestamp cannot be used to specify a particular version of 
> >source code,
> >> but I believe I can work with the commit value as returned by 'git
> >> show'.
> >> 
> >> However, I have been unsuccessful in my attempts to use this 
> >identifier
> >> to clone or checkout the associated source tree. Has anyone been
> >> successful in using git to successfully replicate an 
> >unlabeled version
> >> of sources in a repository?
> >> 
> >> Here is my latest attempt:
> >> /dir_i_want_to_replicate $ git show --pretty=short
> >> commit 5b1313fb2758ffce8b624457f777d8cc6709608d
> >> Author: ....
> >> 
> >> /replication_dir $ git clone git://www.denx.de/git/u-boot.git
> >> u-boot-mpc83xx
> >> Blah blah blah..
> >>  100% (4378/4378) done
> >> /replication_dir/u-boot-mpc83xx/ $ git checkout
> >> 5b1313fb2758ffce8b624457f777d8cc6709608d
> >> error: pathspec '5b1313fb2758ffce8b624457f777d8cc6709608d' 
> >did not match
> >> any. 
> >> 
> >
> >Because there is no 5b1313fb2758ffce8b624457f777d8cc6709608d in the
> >repo.
> >
> >  $ git clone git://www.denx.de/git/u-boot.git
> >  Initialized empty Git repository in /tmp/u-boot/.git/
> >  remote: Generating pack...
> >  remote: Done counting 40938 objects.
> >  remote: Deltifying 40938 objects.
> >  remote:  100% (40938/40938) done
> >  Indexing 40938 objects...
> >  remote: Total 40938 (delta 32545), reused 39302 (delta 31040)
> >  100% (40938/40938) done
> >  Resolving 32545 deltas...
> >  100% (32545/32545) done
> >
> >  $ cd u-boot; git-rev-list --all|grep ^5b1
> >  5b1d713721c3ea02549940133f09236783dda1f9
> >
> >-Peter
> 
> Hmmm. There must be something I am not understanding about git.
> When I run the same command on my existing git repository, I get the
> following:
> $ git-rev-list --all | grep ^5b1
> 5b1313fb2758ffce8b624457f777d8cc6709608d
> 5b1d713721c3ea02549940133f09236783dda1f9
> 
> Does git allow the removal of commits? I don't understand how I was able
> to download it a couple of months ago, but it is no longer accessible.
> 
> Thanks for the quick reply,
> Sam

If the branch was rebased, then yes. But this is not nice for contributers, so it is normally the rule to not rebase a published branch. But e.g. the branch 'pu' on git.git is a branch which will be rebased. This is mentioned by Junio in his notes from the maintainer.

What made me wonder is, if you have the commit localy, why can't you check it out? Please try a git-fsck --full run, to see if you have a corrupt repo.

-Peter
Sparks, Sam· Aug 8, 2007, 20:45 UTC · re: Peter Baumann · lore

RE: Git'ing a non-labeled set of sources

Show 103 quoted lines
>-----Original Message-----
>From: Peter Baumann [mailto:waste.manager@gmx.de] 
>Sent: Wednesday, August 08, 2007 3:17 PM
>To: Sparks, Sam
>Cc: git@vger.kernel.org
>Subject: Re: Git'ing a non-labeled set of sources
>
>On Wed, Aug 08, 2007 at 02:52:14PM -0500, Sparks, Sam wrote:
>>  
>> 
>> >-----Original Message-----
>> >From: Peter Baumann [mailto:waste.manager@gmx.de] 
>> >Sent: Wednesday, August 08, 2007 2:37 PM
>> >To: Sparks, Sam
>> >Cc: git@vger.kernel.org
>> >Subject: Re: Git'ing a non-labeled set of sources
>> >
>> >On Wed, Aug 08, 2007 at 01:59:38PM -0500, Sparks, Sam wrote:
>> >> Hello All,
>> >> 
>> >> Please excuse me if this is an ignorant question; I'm new to 
>> >git and my
>> >> have overlooked something in the documentation.
>> >> 
>> >> I'm attempting to obtain a snapshot of source code from an 
>> >unlabeled git
>> >> branch in a public repository. I've found in the 
>documentation that a
>> >> timestamp cannot be used to specify a particular version of 
>> >source code,
>> >> but I believe I can work with the commit value as returned by 'git
>> >> show'.
>> >> 
>> >> However, I have been unsuccessful in my attempts to use this 
>> >identifier
>> >> to clone or checkout the associated source tree. Has anyone been
>> >> successful in using git to successfully replicate an 
>> >unlabeled version
>> >> of sources in a repository?
>> >> 
>> >> Here is my latest attempt:
>> >> /dir_i_want_to_replicate $ git show --pretty=short
>> >> commit 5b1313fb2758ffce8b624457f777d8cc6709608d
>> >> Author: ....
>> >> 
>> >> /replication_dir $ git clone git://www.denx.de/git/u-boot.git
>> >> u-boot-mpc83xx
>> >> Blah blah blah..
>> >>  100% (4378/4378) done
>> >> /replication_dir/u-boot-mpc83xx/ $ git checkout
>> >> 5b1313fb2758ffce8b624457f777d8cc6709608d
>> >> error: pathspec '5b1313fb2758ffce8b624457f777d8cc6709608d' 
>> >did not match
>> >> any. 
>> >> 
>> >
>> >Because there is no 5b1313fb2758ffce8b624457f777d8cc6709608d in the
>> >repo.
>> >
>> >  $ git clone git://www.denx.de/git/u-boot.git
>> >  Initialized empty Git repository in /tmp/u-boot/.git/
>> >  remote: Generating pack...
>> >  remote: Done counting 40938 objects.
>> >  remote: Deltifying 40938 objects.
>> >  remote:  100% (40938/40938) done
>> >  Indexing 40938 objects...
>> >  remote: Total 40938 (delta 32545), reused 39302 (delta 31040)
>> >  100% (40938/40938) done
>> >  Resolving 32545 deltas...
>> >  100% (32545/32545) done
>> >
>> >  $ cd u-boot; git-rev-list --all|grep ^5b1
>> >  5b1d713721c3ea02549940133f09236783dda1f9
>> >
>> >-Peter
>> 
>> Hmmm. There must be something I am not understanding about git.
>> When I run the same command on my existing git repository, I get the
>> following:
>> $ git-rev-list --all | grep ^5b1
>> 5b1313fb2758ffce8b624457f777d8cc6709608d
>> 5b1d713721c3ea02549940133f09236783dda1f9
>> 
>> Does git allow the removal of commits? I don't understand 
>how I was able
>> to download it a couple of months ago, but it is no longer 
>accessible.
>> 
>> Thanks for the quick reply,
>> Sam
>
>If the branch was rebased, then yes. But this is not nice for
>contributers, so it is normally the rule to not rebase a published
>branch. But e.g. the branch 'pu' on git.git is a branch which will be
>rebased. This is mentioned by Junio in his notes from the maintainer.
>
>What made me wonder is, if you have the commit localy, why can't you
>check it out? Please try a git-fsck --full run, to see if you have a
>corrupt repo.
>
>-Peter
>
>

I had to upgrade from git v1.4.4.4 to v1.5.0.7 to have access to the git-fsck command. 'git-fsck --full' printed out nothing, and 'git-fsck --full run' printed out an error message (error: invalid parameter: expected sha1, got 'run'). Was I doing something wrong?

--Sam
Sparks, Sam· Aug 8, 2007, 20:59 UTC · re: Sparks, Sam · lore

RE: Git'ing a non-labeled set of sources

Show 120 quoted lines
>-----Original Message-----
>From: Sparks, Sam 
>Sent: Wednesday, August 08, 2007 3:46 PM
>To: Peter Baumann
>Cc: git@vger.kernel.org
>Subject: RE: Git'ing a non-labeled set of sources
>
> 
>
>>-----Original Message-----
>>From: Peter Baumann [mailto:waste.manager@gmx.de] 
>>Sent: Wednesday, August 08, 2007 3:17 PM
>>To: Sparks, Sam
>>Cc: git@vger.kernel.org
>>Subject: Re: Git'ing a non-labeled set of sources
>>
>>On Wed, Aug 08, 2007 at 02:52:14PM -0500, Sparks, Sam wrote:
>>>  
>>> 
>>> >-----Original Message-----
>>> >From: Peter Baumann [mailto:waste.manager@gmx.de] 
>>> >Sent: Wednesday, August 08, 2007 2:37 PM
>>> >To: Sparks, Sam
>>> >Cc: git@vger.kernel.org
>>> >Subject: Re: Git'ing a non-labeled set of sources
>>> >
>>> >On Wed, Aug 08, 2007 at 01:59:38PM -0500, Sparks, Sam wrote:
>>> >> Hello All,
>>> >> 
>>> >> Please excuse me if this is an ignorant question; I'm new to 
>>> >git and my
>>> >> have overlooked something in the documentation.
>>> >> 
>>> >> I'm attempting to obtain a snapshot of source code from an 
>>> >unlabeled git
>>> >> branch in a public repository. I've found in the 
>>documentation that a
>>> >> timestamp cannot be used to specify a particular version of 
>>> >source code,
>>> >> but I believe I can work with the commit value as 
>returned by 'git
>>> >> show'.
>>> >> 
>>> >> However, I have been unsuccessful in my attempts to use this 
>>> >identifier
>>> >> to clone or checkout the associated source tree. Has anyone been
>>> >> successful in using git to successfully replicate an 
>>> >unlabeled version
>>> >> of sources in a repository?
>>> >> 
>>> >> Here is my latest attempt:
>>> >> /dir_i_want_to_replicate $ git show --pretty=short
>>> >> commit 5b1313fb2758ffce8b624457f777d8cc6709608d
>>> >> Author: ....
>>> >> 
>>> >> /replication_dir $ git clone git://www.denx.de/git/u-boot.git
>>> >> u-boot-mpc83xx
>>> >> Blah blah blah..
>>> >>  100% (4378/4378) done
>>> >> /replication_dir/u-boot-mpc83xx/ $ git checkout
>>> >> 5b1313fb2758ffce8b624457f777d8cc6709608d
>>> >> error: pathspec '5b1313fb2758ffce8b624457f777d8cc6709608d' 
>>> >did not match
>>> >> any. 
>>> >> 
>>> >
>>> >Because there is no 5b1313fb2758ffce8b624457f777d8cc6709608d in the
>>> >repo.
>>> >
>>> >  $ git clone git://www.denx.de/git/u-boot.git
>>> >  Initialized empty Git repository in /tmp/u-boot/.git/
>>> >  remote: Generating pack...
>>> >  remote: Done counting 40938 objects.
>>> >  remote: Deltifying 40938 objects.
>>> >  remote:  100% (40938/40938) done
>>> >  Indexing 40938 objects...
>>> >  remote: Total 40938 (delta 32545), reused 39302 (delta 31040)
>>> >  100% (40938/40938) done
>>> >  Resolving 32545 deltas...
>>> >  100% (32545/32545) done
>>> >
>>> >  $ cd u-boot; git-rev-list --all|grep ^5b1
>>> >  5b1d713721c3ea02549940133f09236783dda1f9
>>> >
>>> >-Peter
>>> 
>>> Hmmm. There must be something I am not understanding about git.
>>> When I run the same command on my existing git repository, I get the
>>> following:
>>> $ git-rev-list --all | grep ^5b1
>>> 5b1313fb2758ffce8b624457f777d8cc6709608d
>>> 5b1d713721c3ea02549940133f09236783dda1f9
>>> 
>>> Does git allow the removal of commits? I don't understand 
>>how I was able
>>> to download it a couple of months ago, but it is no longer 
>>accessible.
>>> 
>>> Thanks for the quick reply,
>>> Sam
>>
>>If the branch was rebased, then yes. But this is not nice for
>>contributers, so it is normally the rule to not rebase a published
>>branch. But e.g. the branch 'pu' on git.git is a branch which will be
>>rebased. This is mentioned by Junio in his notes from the maintainer.
>>
>>What made me wonder is, if you have the commit localy, why can't you
>>check it out? Please try a git-fsck --full run, to see if you have a
>>corrupt repo.
>>
>>-Peter
>>
>>
>I had to upgrade from git v1.4.4.4 to v1.5.0.7 to have access 
>to the git-fsck command. 'git-fsck --full' printed out 
>nothing, and 'git-fsck --full run' printed out an error 
>message (error: invalid parameter: expected sha1, got 'run'). 
>Was I doing something wrong?
>
>--Sam
Peter,

I had an epiphany and discovered the problem: When I created the repository I was trying to replicate, I didn't download it using git; I simply copied it from another u-boot repository on the same server.

When trying to use the commit number on a known good build, I didn't have any problem replicating that branch.

Thanks for the help, and sorry it was a dumb error on my part. --Sam

Alex Riesen· Aug 8, 2007, 21:20 UTC · re: Sparks, Sam · lore

Re: Git'ing a non-labeled set of sources

Sparks, Sam, Wed, Aug 08, 2007 21:52:14 +0200:
Show 7 quoted lines
> >From: Peter Baumann [mailto:waste.manager@gmx.de] 
> >
> >Because there is no 5b1313fb2758ffce8b624457f777d8cc6709608d in the
> >repo.
> 
> Does git allow the removal of commits? I don't understand how I was able
> to download it a couple of months ago, but it is no longer accessible.

They cleaned up. Rebased or discarded the branch which had the commit and cleaned up. That's what "git gc" and "git prune" do.

Jan Hudec· Aug 9, 2007, 20:02 UTC · re: Sparks, Sam · lore

Re: Git'ing a non-labeled set of sources

On Wed, Aug 08, 2007 at 13:59:38 -0500, Sparks, Sam wrote:
Show 10 quoted lines
> Hello All,
> 
> Please excuse me if this is an ignorant question; I'm new to git and my
> have overlooked something in the documentation.
> 
> I'm attempting to obtain a snapshot of source code from an unlabeled git
> branch in a public repository. I've found in the documentation that a
> timestamp cannot be used to specify a particular version of source code,
> but I believe I can work with the commit value as returned by 'git
> show'.

Clone and pull, over git protocol, only ask the server for objects referenced by any refs -- plus all objects those depend on. Which does not necessarily mean all commits, because references may be removed.

If a branch (ie. ref in refs/heads) is removed or rewound (moved to point to commit that is not descendant of what it pointed to before), some commits may become dangling. Clone and pull won't know such commits exist and therefore won't be able to ask server to provide them.

Show 9 quoted lines
> However, I have been unsuccessful in my attempts to use this identifier
> to clone or checkout the associated source tree. Has anyone been
> successful in using git to successfully replicate an unlabeled version
> of sources in a repository?
> 
> Here is my latest attempt:
> /dir_i_want_to_replicate $ git show --pretty=short
> commit 5b1313fb2758ffce8b624457f777d8cc6709608d
> Author: ....

I bet that if you do 'git lost-found' here, it will find something and this commit will be among the finds, or predecessor of one of them.

Show 8 quoted lines
> /replication_dir $ git clone git://www.denx.de/git/u-boot.git
> u-boot-mpc83xx
> Blah blah blah..
>  100% (4378/4378) done
> /replication_dir/u-boot-mpc83xx/ $ git checkout
> 5b1313fb2758ffce8b624457f777d8cc6709608d
> error: pathspec '5b1313fb2758ffce8b624457f777d8cc6709608d' did not match
> any. 

It seems that git pull only accepts refs as arguments. So you'll have to create a branch at that commit in the origin to get it over to destination.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

← back to recent threads