IndexTime fields are private, how to I create IndexTime{}? #304
Labels
No Label
bug
duplicate
enhancement
invalid
question
up for grabs
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: jcarr/git2go#304
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm trying to add an Entry to an Index:
Unfortunately, since git2go v23, I cannot set
Ctime
andMtime
, ad they are requiring an IndexTime element, which I cannot fill with e.g. the current time, as the fields ofIndexTime
are private.Is this an bug, or am I supposed to create the
IndexEntry
in another way? I couldn't find aNewIndexEntry()
function or any of the sort.I'd apprechiate a hint!
That looks like an oversight, they should be public members. However since you're creating a blob from memory rather than from a file on the filesystem, those fields should be left to zero to avoid confusing the status/diff checks.
I don't see that these fields were ever private, but either way they are public so this was fixed quite some time ago.
It looks like I misread and the issue is the fields of
IndexTime
itself so it's actually not resolved.I've run into this issue as well, if I make a PR to fix this should I just add a method to read the index time and a function to create a new index time? Changing the fields to be public would be a breaking API change and might be a bit annoying for other users.
per the Go module compatibility doc , adding fields and removing unexported fields is safe. since we're also only adding comparable fields, we should be okay for making 'em all public with no need for methods!
you can try using https://pkg.go.dev/golang.org/x/exp/cmd/gorelease to double check that this is the case.