← Back to team overview

dulwich-users team mailing list archive

Re: Cloning/Pulling from a Remote Git Repository

 

Alex Morega wrote:
> On 11 Mar 2010, at 16:51, Matthew Richardson wrote:
> 
>> I can't find a
>> way of extracting this pack file to make the repository 'useable', and
>> I'm not sure how to update the refs for the target repository once this
>> has been done (something with repo.refs ?)
> 
> There's no need to extract the pack; Git and Dulwich can read objects straight from a pack file.
>
> You still need to create refs in the local repository; this can be done by setting an entry in git.refs:
>     git.refs['refs/heads/master'] = commit_id
> 
> Where commit_id is the (hex?) id of the remote master. This updates
> the branch ref directly on disk.

Thanks - I'd seen some references to this, but hadn't put 2 and 23
together.  I've now changed the code to:

########

refs = client.fetch_pack(src, determine_wants, graph_walker,
                                   f.write, sys.stdout.write)

commit()

tgt.refs['refs/heads/master'] = pack['refs/heads/master']

########

This seems to fix git such that 'git log' shows all the correct info.

However, I still need to get the files out of the pack and into the
repository root such that non-git processes can access them!  Anyone
know how to achieve this step?

Thanks,

Matthew

Attachment: signature.asc
Description: OpenPGP digital signature


References