Update libgit2 to tip of master

This commit is contained in:
Jason Haslam 2019-08-12 10:19:16 -06:00
parent 55d297c077
commit de628343ee
8 changed files with 26 additions and 31 deletions

@ -1 +1 @@
Subproject commit 9a119ee15416dda3ae7579c5788fe5faa2d42431
Subproject commit 16a2fafa341cbdfece21cec6a15ecd0f7bc43a5f

View File

@ -70,7 +70,7 @@ Signature Blame::signature(int index) const
bool Blame::isCommitted(int index) const
{
const git_blame_hunk *hunk = git_blame_get_hunk_byindex(d.data(), index);
return !git_oid_iszero(&hunk->final_commit_id);
return !git_oid_is_zero(&hunk->final_commit_id);
}
Blame Blame::updated(const QByteArray &buffer) const

View File

@ -50,7 +50,7 @@ Id::operator const git_oid *() const
bool Id::isNull() const
{
return git_oid_iszero(&d);
return git_oid_is_zero(&d);
}
bool Id::isValid() const

View File

@ -316,7 +316,7 @@ void Index::add(const QString &path, const QByteArray &buffer)
if (!entry)
return;
if (git_index_add_frombuffer(d->index, entry, buffer, buffer.size()))
if (git_index_add_from_buffer(d->index, entry, buffer, buffer.size()))
return;
git_index_write(d->index);

View File

@ -344,7 +344,7 @@ int Remote::Callbacks::certificate(
}
int Remote::Callbacks::transfer(
const git_transfer_progress *stats,
const git_indexer_progress *stats,
void *payload)
{
Remote::Callbacks *cbs = reinterpret_cast<Remote::Callbacks *>(payload);
@ -373,27 +373,24 @@ int Remote::Callbacks::update(
int Remote::Callbacks::url(
git_buf *out,
git_remote *remote,
git_direction direction,
const char *url,
int direction,
void *payload)
{
Remote::Callbacks *cbs = reinterpret_cast<Remote::Callbacks *>(payload);
const char *fetch = git_remote_url(remote);
const char *push = git_remote_pushurl(remote);
QString url((direction == GIT_DIRECTION_FETCH || !push) ? fetch : push);
QString before = url;
if (!cbs->url(url))
QString resolved(url);
if (!cbs->url(resolved))
return -1;
// Extract hostname from SSH URL.
QString hostName;
int end = url.indexOf(':');
int begin = url.indexOf('@') + 1;
int end = resolved.indexOf(':');
int begin = resolved.indexOf('@') + 1;
bool sshUrl = (begin >= 0 && end >= 0 && begin < end);
if (sshUrl) {
hostName = url.mid(begin, end - begin);
hostName = resolved.mid(begin, end - begin);
} else {
QUrl tmp(url);
QUrl tmp(resolved);
if (tmp.scheme() == "ssh")
hostName = tmp.host();
}
@ -419,11 +416,11 @@ int Remote::Callbacks::url(
// Replace host name.
if (!replacement.isEmpty()) {
if (sshUrl) {
url.replace(begin, end - begin, replacement);
resolved.replace(begin, end - begin, replacement);
} else {
QUrl tmp(url);
QUrl tmp(resolved);
tmp.setHost(replacement);
url = tmp.toString();
resolved = tmp.toString();
}
break;
@ -432,9 +429,7 @@ int Remote::Callbacks::url(
}
}
if (url != before)
git_buf_set(out, url.toUtf8(), url.length());
git_buf_set(out, resolved.toUtf8(), resolved.length());
return 0;
}
@ -481,7 +476,7 @@ Result Remote::fetch(Callbacks *callbacks, bool tags)
opts.callbacks.certificate_check = &Remote::Callbacks::certificate;
opts.callbacks.transfer_progress = &Remote::Callbacks::transfer;
opts.callbacks.update_tips = &Remote::Callbacks::update;
opts.callbacks.url = &Remote::Callbacks::url;
opts.callbacks.resolve_url = &Remote::Callbacks::url;
opts.callbacks.payload = callbacks;
QByteArray proxy = proxyUrl(url(), opts.proxy_opts.type);
@ -504,7 +499,7 @@ Result Remote::push(Callbacks *callbacks, const QStringList &refspecs)
opts.callbacks.certificate_check = &Remote::Callbacks::certificate;
opts.callbacks.transfer_progress = &Remote::Callbacks::transfer;
opts.callbacks.update_tips = &Remote::Callbacks::update;
opts.callbacks.url = &Remote::Callbacks::url;
opts.callbacks.resolve_url = &Remote::Callbacks::url;
opts.callbacks.pack_progress = &pack_progress;
opts.callbacks.push_transfer_progress = &push_transfer_progress;
opts.callbacks.push_update_reference = &push_update_reference;
@ -574,7 +569,7 @@ Result Remote::clone(
opts.fetch_opts.callbacks.certificate_check = &Remote::Callbacks::certificate;
opts.fetch_opts.callbacks.transfer_progress = &Remote::Callbacks::transfer;
opts.fetch_opts.callbacks.update_tips = &Remote::Callbacks::update;
opts.fetch_opts.callbacks.url = &Remote::Callbacks::url;
opts.fetch_opts.callbacks.resolve_url = &Remote::Callbacks::url;
opts.fetch_opts.callbacks.payload = callbacks;
opts.bare = bare;

View File

@ -20,7 +20,7 @@
struct git_cred;
struct git_oid;
struct git_remote;
struct git_transfer_progress;
struct git_indexer_progress;
namespace git {
@ -139,7 +139,7 @@ public:
void *payload);
static int transfer(
const git_transfer_progress *stats,
const git_indexer_progress *stats,
void *payload);
static int update(
@ -150,8 +150,8 @@ public:
static int url(
git_buf *out,
git_remote *remote,
git_direction direction,
const char *url,
int direction,
void *payload);
protected:

View File

@ -192,7 +192,7 @@ QDir Repository::appDir() const
Id Repository::workdirId(const QString &path) const
{
git_oid id;
if (git_blob_create_fromworkdir(&id, d->repo, path.toUtf8()))
if (git_blob_create_from_workdir(&id, d->repo, path.toUtf8()))
return Id();
return id;

View File

@ -129,7 +129,7 @@ Result Submodule::update(Remote::Callbacks *callbacks, bool init)
opts.fetch_opts.callbacks.certificate_check = &Remote::Callbacks::certificate;
opts.fetch_opts.callbacks.transfer_progress = &Remote::Callbacks::transfer;
opts.fetch_opts.callbacks.update_tips = &Remote::Callbacks::update;
opts.fetch_opts.callbacks.url = &Remote::Callbacks::url;
opts.fetch_opts.callbacks.resolve_url = &Remote::Callbacks::url;
opts.fetch_opts.callbacks.payload = callbacks;
// Use a fake URL. Submodule update doesn't have a way to