You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several methods in git2-rs that return an object with a lifetime that is bound to either the original Repo or Odb, but there's nothing wrong with freeing the corresponding Repo or Odb. For example, this git2go code runs fine:
w, err:=odb.NewWritePack(nil)
odb.Free() // Explicitly free the odb objectrepo.Free() // Explicitly free the repo objectw.Write(response.PackfileData) // works fineerr=w.Commit() // works fine
Having these lifetimes makes git2-rs less ergonomic and they don't provide any extra safety. I guess removing them would be a breaking change to the git2-rs API, but maybe they could be replaced by 'static.
The text was updated successfully, but these errors were encountered:
Both ODB and Repository are ref-counted objects (see https://github.com/libgit2/libgit2/blob/2f20fe8869d7a1df7c9b7a9e2939c1a20533c6dc/src/libgit2/odb.c#L930 for example) so calling
free
doesn't necessarily mean that the underlying object is being freed.There are several methods in git2-rs that return an object with a lifetime that is bound to either the original Repo or Odb, but there's nothing wrong with freeing the corresponding Repo or Odb. For example, this git2go code runs fine:
Having these lifetimes makes git2-rs less ergonomic and they don't provide any extra safety. I guess removing them would be a breaking change to the git2-rs API, but maybe they could be replaced by
'static
.The text was updated successfully, but these errors were encountered: