Skip to content

Commit

Permalink
Merge pull request #39 from es20490446e/master
Browse files Browse the repository at this point in the history
Compatibility with libgit2 1.8+
  • Loading branch information
codereader authored Jul 23, 2024
2 parents 9519871 + c019674 commit 2365ced
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plugins/vcs/Commit.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Commit final
return std::make_shared<Commit>(commit);
}

const git_commit* _get()
git_commit* _get()
{
return _commit;
}
Expand Down
10 changes: 4 additions & 6 deletions plugins/vcs/Repository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void Repository::fastForwardToTrackedRemote()

error = git_checkout_tree(_repository, target, &checkoutOptions);
GitException::ThrowOnError(error);

// Move the target reference to the target OID
head->setTarget(&targetOid);

Expand Down Expand Up @@ -333,22 +333,20 @@ void Repository::createCommit(const CommitMetadata& metadata, const Reference::P

// Add all working copy changes
index->updateAll();

auto tree = index->writeTree(*this);

std::vector<const git_commit*> parentCommits;
std::vector<git_commit*> parentCommits;

// It's possible that there is no HEAD yet (first commit in the repo)
if (head)
{
git_oid headOid;
auto error = git_reference_name_to_id(&headOid, _repository, head->getName().c_str());
GitException::ThrowOnError(error);

auto parentCommit = Commit::LookupFromOid(_repository, &headOid);
parentCommits.push_back(parentCommit->_get());
}

// Check if we have an additional parent
if (additionalParent)
{
Expand Down

0 comments on commit 2365ced

Please sign in to comment.