diff --git a/src/CommitExploreWindow.cpp b/src/CommitExploreWindow.cpp index 96339657..4d923cce 100644 --- a/src/CommitExploreWindow.cpp +++ b/src/CommitExploreWindow.cpp @@ -59,15 +59,16 @@ CommitExploreWindow::CommitExploreWindow(QWidget *parent, MainWindow *mainwin, G ui->lineEdit_date->setText(misc::makeDateTimeString(commit->commit_date)); ui->lineEdit_author->setText(commit->author); + GitPtr g = git(); { GitCommit c; - GitCommit::parseCommit(objcache, m->commit->commit_id.toQString(), &c); + GitCommit::parseCommit(g, objcache, m->commit->commit_id.toQString(), &c); m->root_tree_id = c.tree_id; } { GitCommitTree tree(objcache); - tree.parseTree(m->root_tree_id); + tree.parseTree(g, m->root_tree_id); } { @@ -77,7 +78,7 @@ CommitExploreWindow::CommitExploreWindow(QWidget *parent, MainWindow *mainwin, G rootitem->setData(0, ObjectIdRole, m->root_tree_id); ui->treeWidget->addTopLevelItem(rootitem); - loadTree(m->root_tree_id); + loadTree(g, m->root_tree_id); rootitem->setExpanded(true); } @@ -94,12 +95,17 @@ MainWindow *CommitExploreWindow::mainwindow() return global->mainwindow; } +GitPtr CommitExploreWindow::git() +{ + return mainwindow()->git(); +} + void CommitExploreWindow::clearContent() { m->content = ObjectContent(); } -void CommitExploreWindow::expandTreeItem_(QTreeWidgetItem *item) +void CommitExploreWindow::expandTreeItem_(GitPtr g, QTreeWidgetItem *item) { if (item->childCount() == 1) { if (item->child(0)->text(0).isEmpty()) { @@ -114,7 +120,7 @@ void CommitExploreWindow::expandTreeItem_(QTreeWidgetItem *item) QString path = item->data(0, FilePathRole).toString(); QString tree_id = item->data(0, ObjectIdRole).toString(); - loadTree(tree_id); + loadTree(g, tree_id); for (GitTreeItem const &ti : m->tree_item_list) { if (ti.type == GitTreeItem::TREE) { @@ -134,13 +140,13 @@ void CommitExploreWindow::expandTreeItem_(QTreeWidgetItem *item) void CommitExploreWindow::on_treeWidget_itemExpanded(QTreeWidgetItem *item) { - expandTreeItem_(item); + expandTreeItem_(git(), item); } -void CommitExploreWindow::loadTree(QString const &tree_id) +void CommitExploreWindow::loadTree(GitPtr g, QString const &tree_id) { GitCommitTree tree(m->objcache); - tree.parseTree(tree_id); + tree.parseTree(g, tree_id); m->tree_item_list = *tree.treelist(); @@ -152,7 +158,7 @@ void CommitExploreWindow::loadTree(QString const &tree_id) }); } -void CommitExploreWindow::doTreeItemChanged_(QTreeWidgetItem *current) +void CommitExploreWindow::doTreeItemChanged_(GitPtr g, QTreeWidgetItem *current) { ui->listWidget->clear(); @@ -160,7 +166,7 @@ void CommitExploreWindow::doTreeItemChanged_(QTreeWidgetItem *current) QString tree_id = current->data(0, ObjectIdRole).toString(); - loadTree(tree_id); + loadTree(g, tree_id); QFileIconProvider icons; @@ -195,7 +201,8 @@ void CommitExploreWindow::doTreeItemChanged_(QTreeWidgetItem *current) void CommitExploreWindow::on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem * /*previous*/) { clearContent(); - doTreeItemChanged_(current); + GitPtr g = git(); + doTreeItemChanged_(g, current); } void CommitExploreWindow::on_listWidget_itemDoubleClicked(QListWidgetItem *item) @@ -207,7 +214,8 @@ void CommitExploreWindow::on_listWidget_itemDoubleClicked(QListWidgetItem *item) QString tree_id = item->data(ObjectIdRole).toString(); clearContent(); QTreeWidgetItem *parent = ui->treeWidget->currentItem(); - expandTreeItem_(parent); + GitPtr g = git(); + expandTreeItem_(g, parent); parent->setExpanded(true); int n = parent->childCount(); for (int i = 0; i < n; i++) { @@ -231,7 +239,8 @@ void CommitExploreWindow::on_listWidget_currentItemChanged(QListWidgetItem *curr GitTreeItem::Type type = (GitTreeItem::Type)current->data(ItemTypeRole).toInt(); if (type == GitTreeItem::BLOB) { QString id = current->data(ObjectIdRole).toString(); - m->content_object = m->objcache->catFile(id); + GitPtr g = git(); + m->content_object = m->objcache->catFile(g, id); QString path = current->data(FilePathRole).toString(); clearContent(); QString mimetype = mainwindow()->determinFileType(m->content_object.content); diff --git a/src/CommitExploreWindow.h b/src/CommitExploreWindow.h index 5b05f9d0..fa343039 100644 --- a/src/CommitExploreWindow.h +++ b/src/CommitExploreWindow.h @@ -20,10 +20,11 @@ class CommitExploreWindow : public QDialog { struct Private; Private *m; - void loadTree(QString const &tree_id); - void doTreeItemChanged_(QTreeWidgetItem *current); - void expandTreeItem_(QTreeWidgetItem *item); + void loadTree(GitPtr g, QString const &tree_id); + void doTreeItemChanged_(GitPtr g, QTreeWidgetItem *current); + void expandTreeItem_(GitPtr g, QTreeWidgetItem *item); MainWindow *mainwindow(); + GitPtr git(); public: explicit CommitExploreWindow(QWidget *parent, MainWindow *mainwin, GitObjectCache *objcache, Git::CommitItem const *commit); ~CommitExploreWindow() override; diff --git a/src/GitDiff.cpp b/src/GitDiff.cpp index 8903c336..2ed5a8fd 100644 --- a/src/GitDiff.cpp +++ b/src/GitDiff.cpp @@ -3,6 +3,7 @@ #include #include #include "ApplicationGlobal.h" +#include "MainWindow.h" // PathToIdMap @@ -41,14 +42,14 @@ class GitDiff::LookupTable { // GitDiff -GitPtr GitDiff::git() -{ - return objcache->git(); -} +// GitPtr GitDiff::git() +// { +// return objcache->git(); +// } GitPtr GitDiff::git(Git::SubmoduleItem const &submod) { - return objcache->git(submod); + return global->mainwindow->git(submod); } QString GitDiff::makeKey(QString const &a_id, QString const &b_id) @@ -130,7 +131,7 @@ void GitDiff::parseDiff(std::string const &s, Git::Diff const *info, Git::Diff * } } -void GitDiff::retrieveCompleteTree(QString const &dir, GitTreeItemList const *files, std::map *out) +void GitDiff::retrieveCompleteTree(GitPtr g, QString const &dir, GitTreeItemList const *files, std::map *out) { for (GitTreeItem const &d : *files) { QString path = misc::joinWithSlash(dir, d.name); @@ -138,13 +139,13 @@ void GitDiff::retrieveCompleteTree(QString const &dir, GitTreeItemList const *fi (*out)[path] = d; } else if (d.type == GitTreeItem::TREE) { GitTreeItemList files2; - parseGitTreeObject(objcache, d.id, QString(), &files2); - retrieveCompleteTree(path, &files2, out); + parseGitTreeObject(g, objcache, d.id, QString(), &files2); + retrieveCompleteTree(g, path, &files2, out); } } } -void GitDiff::retrieveCompleteTree(QString const &dir, GitTreeItemList const *files) +void GitDiff::retrieveCompleteTree(GitPtr g, QString const &dir, GitTreeItemList const *files) { for (GitTreeItem const &d : *files) { QString path = misc::joinWithSlash(dir, d.name); @@ -153,8 +154,8 @@ void GitDiff::retrieveCompleteTree(QString const &dir, GitTreeItemList const *fi diffs.push_back(diff); } else if (d.type == GitTreeItem::TREE) { GitTreeItemList files2; - parseGitTreeObject(objcache, d.id, QString(), &files2); - retrieveCompleteTree(path, &files2); + parseGitTreeObject(g, objcache, d.id, QString(), &files2); + retrieveCompleteTree(g, path, &files2); } } } @@ -176,11 +177,11 @@ bool GitDiff::diff(GitPtr g, Git::CommitID const &id, const QList diffmap; @@ -189,7 +190,7 @@ bool GitDiff::diff(GitPtr g, Git::CommitID const &id, const QList list; for (QString const &parent : newer_commit.parents) { - QList l = git()->diff_raw(parent, id); + QList l = g->diff_raw(parent, id); for (Git::DiffRaw const &item : l) { if (item.state.startsWith('D')) { deleted_set.insert(item.a.id); @@ -276,7 +277,7 @@ bool GitDiff::diff(GitPtr g, Git::CommitID const &id, const QListstatus_s(); // git status GitCommitTree head_tree(objcache); - head_tree.parseCommit(head_id); // HEADが親 + head_tree.parseCommit(g, head_id); // HEADが親 QString zeros(GIT_ID_LENGTH, '0'); @@ -285,7 +286,7 @@ bool GitDiff::diff(GitPtr g, Git::CommitID const &id, const QListgit(); -} +// GitPtr GitCommitTree::git() +// { +// return objcache->git(); +// } -QString GitCommitTree::lookup_(QString const &file, GitTreeItem *out) +QString GitCommitTree::lookup_(GitPtr g, QString const &file, GitTreeItem *out) { int i = file.lastIndexOf('/'); if (i >= 0) { @@ -381,11 +382,11 @@ QString GitCommitTree::lookup_(QString const &file, GitTreeItem *out) if (it != tree_id_map.end()) { tree_id = it->second; } else { - tree_id = lookup_(subdir, out); + tree_id = lookup_(g, subdir, out); } } GitTreeItemList list; - if (parseGitTreeObject(objcache, tree_id, QString(), &list)) { + if (parseGitTreeObject(g, objcache, tree_id, QString(), &list)) { QString return_id; for (GitTreeItem const &d : list) { if (d.name == name) { @@ -423,16 +424,16 @@ QString GitCommitTree::lookup_(QString const &file, GitTreeItem *out) return QString(); } -QString GitCommitTree::lookup(QString const &file) +QString GitCommitTree::lookup(GitPtr g, QString const &file) { auto it = blob_map.find(file); if (it != blob_map.end()) { return it->second.id; } - return lookup_(file, nullptr); + return lookup_(g, file, nullptr); } -bool GitCommitTree::lookup(QString const &file, GitTreeItem *out) +bool GitCommitTree::lookup(GitPtr g, QString const &file, GitTreeItem *out) { *out = GitTreeItem(); auto it = blob_map.find(file); @@ -440,19 +441,19 @@ bool GitCommitTree::lookup(QString const &file, GitTreeItem *out) *out = it->second; return true; } - return !lookup_(file, out).isEmpty(); + return !lookup_(g, file, out).isEmpty(); } -void GitCommitTree::parseTree(QString const &tree_id) +void GitCommitTree::parseTree(GitPtr g, QString const &tree_id) { - parseGitTreeObject(objcache, tree_id, QString(), &root_item_list); + parseGitTreeObject(g, objcache, tree_id, QString(), &root_item_list); } -QString GitCommitTree::parseCommit(QString const &commit_id) +QString GitCommitTree::parseCommit(GitPtr g, QString const &commit_id) { GitCommit commit; - GitCommit::parseCommit(objcache, commit_id, &commit); - parseTree(commit.tree_id); + GitCommit::parseCommit(g, objcache, commit_id, &commit); + parseTree(g, commit.tree_id); return commit.tree_id; } @@ -465,10 +466,10 @@ QString GitCommitTree::parseCommit(QString const &commit_id) * @param file * @return */ -QString lookupFileID(GitObjectCache *objcache, QString const &commit_id, QString const &file) +QString lookupFileID(GitPtr g, GitObjectCache *objcache, QString const &commit_id, QString const &file) { GitCommitTree commit_tree(objcache); - commit_tree.parseCommit(commit_id); - QString id = commit_tree.lookup(file); + commit_tree.parseCommit(g, commit_id); + QString id = commit_tree.lookup(g, file); return id; } diff --git a/src/GitDiff.h b/src/GitDiff.h index c370da22..5d76ecad 100644 --- a/src/GitDiff.h +++ b/src/GitDiff.h @@ -29,13 +29,13 @@ class GitDiff { using MapList = std::list; - GitPtr git(); + // GitPtr git(); GitPtr git(const Git::SubmoduleItem &submod); static void AddItem(Git::Diff *item, QList *diffs); - void retrieveCompleteTree(QString const &dir, GitTreeItemList const *files, std::map *out); - void retrieveCompleteTree(QString const &dir, GitTreeItemList const *files); + void retrieveCompleteTree(GitPtr g, QString const &dir, GitTreeItemList const *files, std::map *out); + void retrieveCompleteTree(GitPtr g, QString const &dir, GitTreeItemList const *files); public: GitDiff(GitObjectCache *objcache) { @@ -57,8 +57,8 @@ class GitDiff { static QString makeKey(const QString &a_id, const QString &b_id); static QString makeKey(const Git::Diff &diff); static QString prependPathPrefix(QString const &path); - - }; +QString lookupFileID(GitPtr g, GitObjectCache *objcache, QString const &commit_id, QString const &file); + #endif // GITDIFF_H diff --git a/src/GitObjectManager.cpp b/src/GitObjectManager.cpp index 1ade7b1b..555a8416 100644 --- a/src/GitObjectManager.cpp +++ b/src/GitObjectManager.cpp @@ -29,20 +29,20 @@ void GitObjectManager::init() void GitObjectManager::setup(GitPtr g) { - this->g = g; + // this->g = g; clearIndexes(); } -QString GitObjectManager::workingDir() +QString GitObjectManager::workingDir(GitPtr g) { return g->workingDir(); } -void GitObjectManager::loadIndexes() +void GitObjectManager::loadIndexes(GitPtr g) { QMutexLocker lock(&mutex); if (git_idx_list.empty()) { - QString path = workingDir() / subdir_git_objects_pack; + QString path = workingDir(g) / subdir_git_objects_pack; QDirIterator it(path, { "pack-*.idx" }, QDir::Files | QDir::Readable); while (it.hasNext()) { it.next(); @@ -166,9 +166,9 @@ bool GitObjectManager::extractObjectFromPackFile(GitPackIdxPtr const &idx, GitPa return false; } -bool GitObjectManager::extractObjectFromPackFile(Git::CommitID const &id, QByteArray *out, Git::Object::Type *type) +bool GitObjectManager::extractObjectFromPackFile(GitPtr g, Git::CommitID const &id, QByteArray *out, Git::Object::Type *type) { - loadIndexes(); + loadIndexes(g); for (GitPackIdxPtr const &idx : git_idx_list) { GitPackIdxItem const *item = idx->item(id); @@ -186,7 +186,7 @@ bool GitObjectManager::extractObjectFromPackFile(Git::CommitID const &id, QByteA return false; } -QString GitObjectManager::findObjectPath(Git::CommitID const &id) +QString GitObjectManager::findObjectPath(GitPtr g, Git::CommitID const &id) { if (Git::isValidID(id)) { int count = 0; @@ -194,7 +194,7 @@ QString GitObjectManager::findObjectPath(Git::CommitID const &id) QString name = id.toQString(); QString xx = name.mid(0, 2); // leading two xdigits name = name.mid(2); // remaining xdigits - QString dir = workingDir() / subdir_git_objects / xx; // e.g. /home/user/myproject/.git/objects/5a + QString dir = workingDir(g) / subdir_git_objects / xx; // e.g. /home/user/myproject/.git/objects/5a QDirIterator it(dir, QDir::Files); while (it.hasNext()) { it.next(); @@ -212,9 +212,9 @@ QString GitObjectManager::findObjectPath(Git::CommitID const &id) return {}; } -bool GitObjectManager::loadObject(Git::CommitID const &id, QByteArray *out, Git::Object::Type *type) +bool GitObjectManager::loadObject(GitPtr g, Git::CommitID const &id, QByteArray *out, Git::Object::Type *type) { - QString path = findObjectPath(id); + QString path = findObjectPath(g, id); if (!path.isEmpty()) { QFile file(path); if (file.open(QFile::ReadOnly)) { @@ -230,11 +230,11 @@ bool GitObjectManager::loadObject(Git::CommitID const &id, QByteArray *out, Git: return false; } -bool GitObjectManager::catFile(Git::CommitID const &id, QByteArray *out, Git::Object::Type *type) +bool GitObjectManager::catFile(GitPtr g, Git::CommitID const &id, QByteArray *out, Git::Object::Type *type) { *type = Git::Object::Type::UNKNOWN; - if (loadObject(id, out, type)) return true; - if (extractObjectFromPackFile(id, out, type)) return true; + if (loadObject(g, id, out, type)) return true; + if (extractObjectFromPackFile(g, id, out, type)) return true; return false; } @@ -279,7 +279,7 @@ Git::CommitID GitObjectCache::revParse(GitPtr g, QString const &name) } } -Git::Object GitObjectCache::catFile(Git::CommitID const &id) +Git::Object GitObjectCache::catFile(GitPtr g, Git::CommitID const &id) { { QMutexLocker lock(&object_manager.mutex); @@ -321,12 +321,12 @@ Git::Object GitObjectCache::catFile(Git::CommitID const &id) return obj; }; - if (object_manager.catFile(id, &ba, &type)) { // 独自実装のファイル取得 + if (object_manager.catFile(g, id, &ba, &type)) { // 独自実装のファイル取得 return Store(); } if (true) { - auto ba = git()->cat_file(id); + auto ba = g->cat_file(id); if (ba) { // 外部コマンド起動の git cat-file -p を試してみる // 上の独自実装のファイル取得が正しく動作していれば、ここには来ないはず qDebug() << __FILE__ << __LINE__ << Q_FUNC_INFO << id.toQString(); @@ -339,13 +339,12 @@ Git::Object GitObjectCache::catFile(Git::CommitID const &id) return Git::Object(); } -Git::CommitID GitObjectCache::getCommitIdFromTag(QString const &tag) +Git::CommitID GitObjectCache::getCommitIdFromTag(GitPtr g, QString const &tag) { Git::CommitID commit_id; - GitPtr g = git(); if (g && g->isValidWorkingCopy()) { Git::CommitID id(g->rev_parse(tag)); - Git::Object obj = catFile(id); + Git::Object obj = catFile(g, id); switch (obj.type) { case Git::Object::Type::COMMIT: commit_id = id; @@ -366,6 +365,8 @@ Git::CommitID GitObjectCache::getCommitIdFromTag(QString const &tag) } break; } + } else { + qDebug() << Q_FUNC_INFO << "invalid working copy"; } return commit_id; } @@ -373,13 +374,13 @@ Git::CommitID GitObjectCache::getCommitIdFromTag(QString const &tag) -bool GitCommit::parseCommit(GitObjectCache *objcache, Git::CommitID const &id, GitCommit *out) +bool GitCommit::parseCommit(GitPtr g, GitObjectCache *objcache, Git::CommitID const &id, GitCommit *out) { *out = {}; if (id.isValid()) { QStringList parents; { - Git::Object obj = objcache->catFile(id.toQString()); + Git::Object obj = objcache->catFile(g, id.toQString()); if (!obj.content.isEmpty()) { QStringList lines = misc::splitLines(QString::fromUtf8(obj.content)); for (QString const &line : lines) { @@ -436,11 +437,11 @@ void parseGitTreeObject(QByteArray const &ba, const QString &path_prefix, GitTre } } -bool parseGitTreeObject(GitObjectCache *objcache, const QString &commit_id, const QString &path_prefix, GitTreeItemList *out) +bool parseGitTreeObject(GitPtr g, GitObjectCache *objcache, const QString &commit_id, const QString &path_prefix, GitTreeItemList *out) { out->clear(); if (!commit_id.isEmpty()) { - Git::Object obj = objcache->catFile(commit_id); + Git::Object obj = objcache->catFile(g, commit_id); if (!obj.content.isEmpty()) { // 内容を取得 parseGitTreeObject(obj.content, path_prefix, out); return true; diff --git a/src/GitObjectManager.h b/src/GitObjectManager.h index 228fd058..7f92c57e 100644 --- a/src/GitObjectManager.h +++ b/src/GitObjectManager.h @@ -16,37 +16,37 @@ using GitPtr = std::shared_ptr; class GitObjectManager { friend class GitObjectCache; private: - GitPtr g; + // GitPtr g; QMutex mutex; QString subdir_git_objects; QString subdir_git_objects_pack; std::vector git_idx_list; - QString workingDir(); + QString workingDir(GitPtr g); static void applyDelta(QByteArray const *base, QByteArray const *delta, QByteArray *out); static bool loadPackedObject(GitPackIdxPtr const &idx, QIODevice *packfile, GitPackIdxItem const *item, GitPack::Object *out); bool extractObjectFromPackFile(GitPackIdxPtr const &idx, GitPackIdxItem const *item, GitPack::Object *out); - bool extractObjectFromPackFile(const Git::CommitID &id, QByteArray *out, Git::Object::Type *type); - void loadIndexes(); - QString findObjectPath(const Git::CommitID &id); - bool loadObject(const Git::CommitID &id, QByteArray *out, Git::Object::Type *type); - GitPtr git() - { - return g->dup(); - } - GitPtr git(Git::SubmoduleItem const &submod) - { - GitPtr g2 = g->dup(); - g2->setWorkingRepositoryDir(g->workingDir(), submod.path, g->sshKey()); - return g2; - } + bool extractObjectFromPackFile(GitPtr g, const Git::CommitID &id, QByteArray *out, Git::Object::Type *type); + void loadIndexes(GitPtr g); + QString findObjectPath(GitPtr g, const Git::CommitID &id); + bool loadObject(GitPtr g, const Git::CommitID &id, QByteArray *out, Git::Object::Type *type); + // GitPtr git() + // { + // return g->dup(); + // } + // GitPtr git(Git::SubmoduleItem const &submod) + // { + // GitPtr g2 = g->dup(); + // g2->setWorkingRepositoryDir(g->workingDir(), submod.path, g->sshKey()); + // return g2; + // } void init(); public: GitObjectManager(); GitObjectManager(GitPtr g); void setup(GitPtr g); - bool catFile(const Git::CommitID &id, QByteArray *out, Git::Object::Type *type); + bool catFile(GitPtr g, const Git::CommitID &id, QByteArray *out, Git::Object::Type *type); void clearIndexes(); static QStringList findObject(const QString &id, const QString &repo_local_dir); @@ -66,19 +66,19 @@ class GitObjectCache { std::map revparsemap; size_t size() const; public: - GitPtr git() - { - return object_manager.git(); - } - GitPtr git(Git::SubmoduleItem const &submod) - { - return object_manager.git(submod); - } + // GitPtr git() + // { + // return object_manager.git(); + // } + // GitPtr git(Git::SubmoduleItem const &submod) + // { + // return object_manager.git(submod); + // } void setup(GitPtr g); Git::CommitID revParse(GitPtr g, QString const &name); - Git::Object catFile(const Git::CommitID &id); - Git::CommitID getCommitIdFromTag(const QString &tag); + Git::Object catFile(GitPtr g, const Git::CommitID &id); + Git::CommitID getCommitIdFromTag(GitPtr g, const QString &tag); Git::CommitID const &item_id(int i) const { @@ -91,7 +91,7 @@ class GitCommit { QString tree_id; QStringList parents; - static bool parseCommit(GitObjectCache *objcache, Git::CommitID const &id, GitCommit *out); + static bool parseCommit(GitPtr g, GitObjectCache *objcache, Git::CommitID const &id, GitCommit *out); }; struct GitTreeItem { @@ -129,15 +129,15 @@ class GitCommitTree { GitPtr git(); - QString lookup_(QString const &file, GitTreeItem *out); + QString lookup_(GitPtr g, QString const &file, GitTreeItem *out); public: GitCommitTree(GitObjectCache *objcache); - QString lookup(QString const &file); - bool lookup(QString const &file, GitTreeItem *out); + QString lookup(GitPtr g, QString const &file); + bool lookup(GitPtr g, QString const &file, GitTreeItem *out); - void parseTree(QString const &tree_id); - QString parseCommit(QString const &commit_id); + void parseTree(GitPtr g, QString const &tree_id); + QString parseCommit(GitPtr g, QString const &commit_id); GitTreeItemList const *treelist() const { @@ -145,10 +145,7 @@ class GitCommitTree { } }; -QString lookupFileID(GitObjectCache *objcache, QString const &commit_id, QString const &file); - void parseGitTreeObject(QByteArray const &ba, const QString &path_prefix, GitTreeItemList *out); -bool parseGitTreeObject(GitObjectCache *objcache, QString const &commit_id, QString const &path_prefix, GitTreeItemList *out); - +bool parseGitTreeObject(GitPtr g, GitObjectCache *objcache, QString const &commit_id, QString const &path_prefix, GitTreeItemList *out); #endif // GITOBJECTMANAGER_H diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 228d13a7..9b7a6f19 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -2538,7 +2538,7 @@ void MainWindow::deleteTempFiles() */ Git::CommitID MainWindow::idFromTag(RepositoryWrapperFrame *frame, const QString &tag) { - return getObjCache(frame)->getCommitIdFromTag(tag); + return getObjCache(frame)->getCommitIdFromTag(git(), tag); } QString MainWindow::newTempFilePath() @@ -2767,11 +2767,11 @@ void MainWindow::updateSubmodules(GitPtr g, QString const &id, QListcatFile(id);; + return getObjCache(frame)->catFile(g, id); } } return {}; @@ -5623,7 +5623,7 @@ void MainWindow::emitWriteLog(const QByteArray &ba, bool receive) QString MainWindow::findFileID(RepositoryWrapperFrame *frame, const QString &commit_id, const QString &file) { - return lookupFileID(getObjCache(frame), commit_id, file); + return lookupFileID(git(), getObjCache(frame), commit_id, file); } const Git::CommitItem *MainWindow::commitItem(RepositoryWrapperFrame const *frame, int row) const @@ -6442,7 +6442,7 @@ void MainWindow::on_action_repo_jump_triggered() } } if (g->objectType(id) == "tag") { - id = getObjCache(frame())->getCommitIdFromTag(id.toQString()); + id = getObjCache(frame())->getCommitIdFromTag(g, id.toQString()); } int row = rowFromCommitId(frame(), id); if (row < 0) {