-
Notifications
You must be signed in to change notification settings - Fork 326
Closed
Description
I'm trying to add an Entry to an Index:
// Create git blob from file
blobOid, err := repo.CreateBlobFromBuffer(file.Content)
if err != nil {
return err
}
// Create git index entry
indexEntry := &git.IndexEntry{
// Since v23 IndexTime{} is required. Which is not possible to create from here, as all
// fields are private. See https://github.com/libgit2/git2go/blob/master/index.go
//
// Ctime: git.IndexTime{}.
// Mtime: git.IndexTime{},
Mode: git.FilemodeBlob,
Uid: uint32(os.Getuid()),
Gid: uint32(os.Getgid()),
Size: uint32(len(file.Content)),
Id: blobOid,
Path: file.Name,
}
// Add index to git tree
if err := index.Add(indexEntry); err != nil {
return err
}Unfortunately, since git2go v23, I cannot set Ctime and Mtime, ad they are requiring an IndexTime element, which I cannot fill with e.g. the current time, as the fields of IndexTime are private.
Is this an bug, or am I supposed to create the IndexEntry in another way? I couldn't find a NewIndexEntry() function or any of the sort.
I'd apprechiate a hint!
Metadata
Metadata
Assignees
Labels
No labels