E52A Implement all of the options for `init_repository` from libgit. by atheriel · Pull Request #347 · libgit2/pygit2 · GitHub
[go: up one dir, main page]

Skip to content

Implement all of the options for init_repository from libgit.#347

Closed
atheriel wants to merge 2 commits intolibgit2:masterfrom
atheriel:initoptions
Closed

Implement all of the options for init_repository from libgit.#347
atheriel wants to merge 2 commits intolibgit2:masterfrom
atheriel:initoptions

Conversation

@atheriel
Copy link

This patch should fully implement all of the options currently provided by git_repository_init_options for initializing repositories.

Much of the C code is drawn from libgit's init.c example.

I have made one implementation change: setting the working tree will work like git-init(1) instead of the way it works in libgit, in that it uses an absolute path as opposed to a path relative to the repository. This means that

import pygit2
pygit2.init_repository('.', working_dir = './myproject')

will result in the following directory structure

.
..
.git/
    ...
    config (file with core.worktree = ../myproject/)
    ...
myproject/
    .git (file with content <gitdir: ../.git/>)

as opposed to the default behaviour, which creates

.
..
.git/
    ...
   config (file with core.worktree = ../myproject/)
   ...
   myproject/
        ... files here ... 

A full use of the options might look like the following at the moment:

import pygit2
pygit2.init_repository(
    'dog',
    bare = False,
    template_dir = '/usr/local/git/share/git-core/templates',
    shared = 'umask',
    initial_head = 'master2',
    origin_url = 'http://github.com/atheriel/test',
    working_dir = 'dog2'
)

Let me know if there's anything I else I can do.

Aaron Jacobs
atheriel@gmail.com

@atheriel
Copy link
Author

Is this acceptable?

@jdavid
Copy link
Member
jdavid commented Feb 22, 2014

I made just one comment regarding in-line variable declarations, but there more. Please go through your commit and fix all of them. Thanks.

@jdavid jdavid closed this in 95e6593 Jun 3, 2014
@jdavid
Copy link
Member
jdavid commented Jun 3, 2014

done using cffi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0