Rebase wrapper #332
Loading…
Reference in New Issue
No description provided.
Delete Branch "rebase-wrapper"
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?
Hello,
I needed
rebase
services to be wrapped ingit2go
so I propose this PR.Should I propose it on
next
branch instead ofmaster
?There's still some work though :
git_rebase_options
and wrapgit_rebase_init_options(...)
git_rebase_open(...)
I'll probably do the test for merge conflicts as I will need it quite soon.
Other services are of no interest for me at the moment, let me know if you'd like them wrapped as I'm into the work. Shouldn't be too long.
Let me know what you think. Cheers.
uh oh, there are probably things I don't understand in the test run.
it runs normally on my side. any clue?
EDIT : My bad, I made a mistake in the Free() service in rebase wrapper, all good now
This describes the structure mechanically, but almost everything is a wrapper, if we're going to have a comment here, it should describe the object itself and/or what you can do with it.
We have prior art of naming
git_repository_init()
asInitRepository()
since the namespacing in C and Go is bit different, so this should be calledInitRebase()
.Like with the init function, this should be called
OpenRebase()
. The documentation shouldn't reference the C functiongit_rebase_init
but our own.This return value does not match how Go reports errors. I would expect a
uint
to return the current operation and anerror
to return any errors.There is no
GIT_REBASE_OPERATION_EXEC
in git2go, it'sRebaseOperationExec
.There is no
git_rebase_next
in git2go, we haveNext()
.Missing space. The pointer isn't public so let's not mention it. "unmanaged resources" covers whatever we decide to put in there.
The other public id fields are named
Id
.@ -0,0 +95,4 @@
return nil
}
return C.CString(ref)
}
This looks like it should have a much more generic name, since what it does is unrelated to note rewriting and it's simply mapping an empty string and
NULL
.This leaks the committer signature.
Don't hard-code 1 here, the point of the version field is to increase it.
Ok, I followed go convention suggested by my IDE plugin
@ -0,0 +95,4 @@
return nil
}
return C.CString(ref)
}
I understand your point. Renamed to mapEmptyStringToNull :p
Done
Done
Done
Done.
I also added
ErrClassRebase
ingit.go
Hope this is correct
Done
@ -0,0 +200,4 @@
committerSig, err := committer.toC()
if err != nil {
return err
}
Oups!
Done
Done
Not sure how to handle this. It's a test that checks the default version returned by DefaultRebaseOptions. After a look into C code, I thought it was a
#define
or a constant that was used as default version number.The test doesn't have great value though
The version it needs to return in the version that is specified by the libgit2 headers in the
#define
. That's what the compiler is building and that's what it will use in order to figure out the size of the struct, which has to match what we're telling libgit2 we have.Note that the test build has flagged one of the calls as having invalid thread locking. We need that in order for the error handling to work.
Thanks for that. However I'm not sure how I should do as the cgo feature seems to be forbidden in tests... I will just drop this very low value test I think.
Any update on this ?
BTW, thanks for taking care of it.
Just waiting for validation.
I'm using this for a while now. Works well. One thing though:
I have a minor suggestion :
79d6f6c18c
Since
Repository.InitRebase
takesopts *RebaseOptions
as argument, I makes more sense thatDefaultRebaseOptions
returnsopts *RebaseOptions
instead ofopts RebaseOptions
I can't get travis running on this patch since aws outage yesterday...
Fair enough, I can take care of it.
But I can't decide to accept the PR.
🎉 🎈