Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

How to create the tree for creating a commit? #37

Copy link
Copy link
@iamwilhelm

Description

@iamwilhelm
Issue body actions

I'm able to create a Blob, and I see a repository.createCommit call, which requires you to pass in a Tree. However, how do you create the tree for a commit? The createTree() call is not yet implemented.

However, I assume I should be able to do it by hand. And yet, I don't have access to the TreeEntry object to stuff the Blob object into. I also don't seem to have access to Signature for the commit as well. I assume it should look something like (in coffeescript):

repo = gitteh.openRepository('some/path.git')
refHead = repo.getReference('HEAD').resolve()

blob = repo.createBlob({ data: new Buffer("some data") })

// how to access TreeEntry?
treeEntry = new gitteh.TreeEntry({ name: "blob.txt", id: blob.id })

tree = new gitteh.Tree({ entries: [treeEntry] })

// how to get Signature?
commit = repo.createCommit({
  author: new gitteh.Signature({ name: "wil", email: "wil@g.com" })
  parents: [refHead.target]
  message: "some commit message"
  tree: tree
})

And also, this seems like you have to recreate the entire tree in order to commit. That seems like a pain given that usually you just want to commit changed files. How do you commit changed files?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.