This commit is contained in:
Martin Marmsoler 2022-07-23 13:23:03 +02:00
parent 8e7e6d1917
commit 219688354e
11 changed files with 863 additions and 764 deletions

View File

@ -31,9 +31,9 @@ RebaseConflictDialog::RebaseConflictDialog(QWidget *parent) : QDialog(parent) {
});
QFormLayout *layout = new QFormLayout(this);
layout->addRow(new QLabel(
tr("The rebase caused a merge conflict. \n"
"Would you like to fix the merge conflict and continue?"),
this));
layout->addRow(
new QLabel(tr("The rebase caused a merge conflict. \n"
"Would you like to fix the merge conflict and continue?"),
this));
layout->addRow(buttons);
}

View File

@ -18,7 +18,7 @@
namespace git {
Rebase::Rebase(): d(nullptr) {}
Rebase::Rebase() : d(nullptr) {}
Rebase::Rebase(git_repository *repo, git_rebase *rebase,
const QString &overrideUser, const QString &overrideEmail)
@ -27,13 +27,12 @@ Rebase::Rebase(git_repository *repo, git_rebase *rebase,
int Rebase::count() const { return git_rebase_operation_entrycount(d.data()); }
size_t Rebase::currentIndex() const {
return git_rebase_operation_current(d.data());
return git_rebase_operation_current(d.data());
}
const git_rebase_operation* Rebase::operation(size_t index) {
return git_rebase_operation_byindex(d.data(), index);
const git_rebase_operation *Rebase::operation(size_t index) {
return git_rebase_operation_byindex(d.data(), index);
}
bool Rebase::hasNext() const {
@ -43,13 +42,14 @@ bool Rebase::hasNext() const {
}
Commit Rebase::commitToRebase() const {
git_rebase_operation* op = git_rebase_operation_byindex(d.data(), currentIndex());
if (!op)
return Commit();
git_rebase_operation *op =
git_rebase_operation_byindex(d.data(), currentIndex());
if (!op)
return Commit();
git_commit* commit = nullptr;
git_commit_lookup(&commit, mRepo, &op->id);
return Commit(commit);
git_commit *commit = nullptr;
git_commit_lookup(&commit, mRepo, &op->id);
return Commit(commit);
}
Commit Rebase::next() const {
@ -67,14 +67,15 @@ Commit Rebase::next() const {
* perform commit
* \return
*/
Commit Rebase::commit(const QString& message) {
Commit Rebase::commit(const QString &message) {
git_oid id;
git_rebase *ptr = d.data();
Signature sig = Repository(mRepo).defaultSignature(nullptr, mOverrideUser,
mOverrideEmail);
if (int err = git_rebase_commit(&id, ptr, nullptr, sig, nullptr, message.toUtf8())) {
if (int err = git_rebase_commit(&id, ptr, nullptr, sig, nullptr,
message.toUtf8())) {
if (err != GIT_EAPPLIED)
return Commit();

View File

@ -28,7 +28,7 @@ public:
int count() const;
size_t currentIndex() const;
const git_rebase_operation* operation(size_t index);
const git_rebase_operation *operation(size_t index);
Commit commitToRebase() const;
bool hasNext() const;
Commit next() const;

View File

@ -455,7 +455,9 @@ QList<TagRef> Repository::tags() const {
}
TagRef Repository::lookupTag(const QString &name) const {
return lookupRef(QString("refs/tags/%1").arg(name)); // TODO: check if possible to use GIT_REFS_TAGS_DIR instead of refs/tags
return lookupRef(QString("refs/tags/%1")
.arg(name)); // TODO: check if possible to use
// GIT_REFS_TAGS_DIR instead of refs/tags
}
QStringList Repository::existingTags() const {
@ -836,90 +838,93 @@ bool Repository::merge(const AnnotatedCommit &mergeHead) {
* \return
*/
Rebase Repository::rebaseOpen() {
git_rebase* rebase = nullptr;
git_rebase_options opts = GIT_REBASE_OPTIONS_INIT; // TODO: check quite option
git_rebase_open(&rebase, d->repo, &opts);
return Rebase(d->repo, rebase);
git_rebase *rebase = nullptr;
git_rebase_options opts = GIT_REBASE_OPTIONS_INIT; // TODO: check quite option
git_rebase_open(&rebase, d->repo, &opts);
return Rebase(d->repo, rebase);
}
void Repository::rebaseAbort() {
Rebase r = rebaseOpen();
if (r.isValid())
r.abort();
Rebase r = rebaseOpen();
if (r.isValid())
r.abort();
}
// TODO: check that all arguments passed to the signals are valid when the RepoView gets the notification! (Using sharedpointer?)
// TODO: check that all arguments passed to the signals are valid when the
// RepoView gets the notification! (Using sharedpointer?)
void Repository::rebase(const AnnotatedCommit &mergeHead,
const QString &overrideUser,
const QString &overrideEmail) {
const QString &overrideUser,
const QString &overrideEmail) {
git_rebase *r = nullptr;
git_rebase_options opts = GIT_REBASE_OPTIONS_INIT;
git_rebase_init(&r, d->repo, nullptr, mergeHead, nullptr, &opts);
auto rebase = git::Rebase(d->repo, r, overrideUser, overrideEmail);
if (!rebase.isValid())
emit d->notifier->rebaseInitError();
emit d->notifier->rebaseInitError();
// start rebasing
rebaseContinue(QStringLiteral(""));
// start rebasing
rebaseContinue(QStringLiteral(""));
}
void Repository::rebaseContinue(const QString& commitMessage) {
void Repository::rebaseContinue(const QString &commitMessage) {
Rebase r = rebaseOpen();
if (!r.isValid()) {
// rebase anymore available. maybe rebased externally
return;
Rebase r = rebaseOpen();
if (!r.isValid()) {
// rebase anymore available. maybe rebased externally
return;
}
if (r.currentIndex() != GIT_REBASE_NO_OPERATION) {
// Rebase::next() was already called at leas once
// externally or by a previous call of rebaseContinue
// Check if it can be committed
git::Commit c = r.commit(commitMessage);
if (!c.isValid()) {
emit d->notifier->rebaseConflict(r);
return;
} else {
emit d->notifier->rebaseCommitSuccess(r, c, r.commitToRebase(),
r.currentIndex() + 1);
// Go on with the next rebase operation below
}
}
// Loop over rebase operations.
int count = r.count();
while (r.hasNext()) {
git::Commit before = r.next();
if (!before.isValid()) {
emit d->notifier->rebaseCommitInvalid(r);
rebaseAbort();
return;
}
int currCommit =
r.currentIndex() +
1; // for showing to user it makes more sense starting from 1
emit d->notifier->rebaseAboutToRebase(r, before, currCommit);
QString message = before.message(); // use original message
git::Commit after = r.commit(message);
if (!after.isValid()) {
emit d->notifier->rebaseConflict(r);
return; // before ongoing, the user has to fix the conflicts.
}
if (r.currentIndex() != GIT_REBASE_NO_OPERATION) {
// Rebase::next() was already called at leas once
// externally or by a previous call of rebaseContinue
emit d->notifier->rebaseCommitSuccess(r, after, before, currCommit);
}
// Check if it can be committed
git::Commit c = r.commit(commitMessage);
if (!c.isValid()) {
emit d->notifier->rebaseConflict(r);
return;
} else {
emit d->notifier->rebaseCommitSuccess(r, c, r.commitToRebase(), r.currentIndex() + 1);
// Go on with the next rebase operation below
}
}
// Loop over rebase operations.
int count = r.count();
while (r.hasNext()) {
git::Commit before = r.next();
if (!before.isValid()) {
emit d->notifier->rebaseCommitInvalid(r);
rebaseAbort();
return;
}
int currCommit = r.currentIndex() + 1; // for showing to user it makes more sense starting from 1
emit d->notifier->rebaseAboutToRebase(r, before, currCommit);
QString message = before.message(); // use original message
git::Commit after = r.commit(message);
if (!after.isValid()) {
emit d->notifier->rebaseConflict(r);
return; // before ongoing, the user has to fix the conflicts.
}
emit d->notifier->rebaseCommitSuccess(r, after, before, currCommit);
}
if (r.finish())
emit d->notifier->rebaseFinished(r);
// TODO: implement
//else
// emit error
if (r.finish())
emit d->notifier->rebaseFinished(r);
// TODO: implement
// else
// emit error
}
bool Repository::rebaseOngoing() {
Rebase r = rebaseOpen();
return r.isValid();
Rebase r = rebaseOpen();
return r.isValid();
}
bool Repository::cherryPick(const Commit &commit) {

View File

@ -187,19 +187,19 @@ public:
Commit mergeBase(const Commit &lhs, const Commit &rhs) const;
bool merge(const AnnotatedCommit &mergeHead);
enum class RebaseStatus {
Init,
InitError,
OngoingStatus,
CommitInvalid,
Conflict,
PatchSuccess,
Error, // Error during status
FinishedSuccessfully // successfully finished
Init,
InitError,
OngoingStatus,
CommitInvalid,
Conflict,
PatchSuccess,
Error, // Error during status
FinishedSuccessfully // successfully finished
};
void rebase(const AnnotatedCommit &mergeHead,
const QString &overrideUser = QString(),
const QString &overrideEmail = QString());
const QString &overrideUser = QString(),
const QString &overrideEmail = QString());
Rebase rebaseOpen();
void rebaseAbort();
void rebaseContinue(const QString &commitMessage);
@ -329,7 +329,8 @@ signals:
void rebaseCommitInvalid(const Rebase rebase);
void rebaseAboutToRebase(const Rebase rebase, const Commit before, int count);
void rebaseFinished(const Rebase rebase);
void rebaseCommitSuccess(const Rebase rebase, const Commit before, const Commit after, int counter);
void rebaseCommitSuccess(const Rebase rebase, const Commit before,
const Commit after, int counter);
void rebaseConflict(const Rebase rebase);
void lfsNotFound();

View File

@ -414,10 +414,10 @@ public:
QString msg = commit.message(git::Commit::SubstituteEmoji).trimmed();
mMessage->setPlainText(msg);
auto w = window();
auto w_handler = w->windowHandle();
auto w = window();
auto w_handler = w->windowHandle();
int size = kSize * w_handler->devicePixelRatio();
int size = kSize * w_handler->devicePixelRatio();
QByteArray email = commit.author().email().trimmed().toLower().toUtf8();
QByteArray hash = QCryptographicHash::hash(email, QCryptographicHash::Md5);
@ -938,15 +938,17 @@ public:
connect(mCommit, &QPushButton::clicked, this, &CommitEditor::commit);
mRebaseAbort = new QPushButton(tr("Abort rebasing"), this);
connect(mRebaseAbort, &QPushButton::clicked, this, &CommitEditor::abortRebase);
connect(mRebaseAbort, &QPushButton::clicked, this,
&CommitEditor::abortRebase);
mRebaseContinue = new QPushButton(tr("Continue rebasing"), this);
connect(mRebaseContinue, &QPushButton::clicked, this, &CommitEditor::continueRebase);
connect(mRebaseContinue, &QPushButton::clicked, this,
&CommitEditor::continueRebase);
mMergeAbort = new QPushButton(tr("Abort Merge"), this);
connect(mMergeAbort, &QPushButton::clicked, [this] {
RepoView *view = RepoView::parentView(this);
view->mergeAbort();
RepoView *view = RepoView::parentView(this);
view->mergeAbort();
});
// Update buttons on index change.
@ -975,7 +977,9 @@ public:
// Check for a merge head.
git::AnnotatedCommit upstream;
RepoView *view = RepoView::parentView(this);
if (git::Reference mergeHead = view->repo().lookupRef("MERGE_HEAD")) // TODO: is it possible to use instead of the string GIT_MERGE_HEAD_FILE?
if (git::Reference mergeHead = view->repo().lookupRef(
"MERGE_HEAD")) // TODO: is it possible to use instead of the string
// GIT_MERGE_HEAD_FILE?
upstream = mergeHead.annotatedCommit();
if (view->commit(mMessage->toPlainText(), upstream, nullptr, force))
@ -994,7 +998,7 @@ public:
bool isRebaseAbortVisible() const { return mRebaseAbort->isVisible(); }
bool isRebaseContinueVisible() const { return mRebaseContinue->isVisible(); }
bool isRebaseContinueVisible() const { return mRebaseContinue->isVisible(); }
bool isCommitEnabled() const { return mCommit->isEnabled(); }
@ -1011,9 +1015,7 @@ public:
mMessage->selectAll();
}
QString message() const {
return mMessage->toPlainText();
}
QString message() const { return mMessage->toPlainText(); }
void setDiff(const git::Diff &diff) {
mDiff = diff;
@ -1040,51 +1042,50 @@ public slots:
private:
void updateButtons(bool yieldFocus = true) {
RepoView *view = RepoView::parentView(this);
if (!view || !view->repo().isValid()) {
mRebaseContinue->setVisible(false);
mRebaseAbort->setVisible(false);
} else {
const bool rebaseOngoing = view->repo().rebaseOngoing();
mRebaseContinue->setVisible(rebaseOngoing);
mRebaseAbort->setVisible(rebaseOngoing);
}
RepoView *view = RepoView::parentView(this);
if (!view || !view->repo().isValid()) {
mRebaseContinue->setVisible(false);
mRebaseAbort->setVisible(false);
} else {
const bool rebaseOngoing = view->repo().rebaseOngoing();
mRebaseContinue->setVisible(rebaseOngoing);
mRebaseAbort->setVisible(rebaseOngoing);
}
// TODO: copied from menubar
bool merging = false;
QString text = tr("Merge");
if (view) {
switch (view->repo().state()) {
case GIT_REPOSITORY_STATE_MERGE:
merging = true;
break;
// TODO: copied from menubar
bool merging = false;
QString text = tr("Merge");
if (view) {
switch (view->repo().state()) {
case GIT_REPOSITORY_STATE_MERGE:
merging = true;
break;
case GIT_REPOSITORY_STATE_REVERT:
case GIT_REPOSITORY_STATE_REVERT_SEQUENCE:
merging = true;
text = tr("Revert");
break;
case GIT_REPOSITORY_STATE_REVERT:
case GIT_REPOSITORY_STATE_REVERT_SEQUENCE:
merging = true;
text = tr("Revert");
break;
case GIT_REPOSITORY_STATE_CHERRYPICK:
case GIT_REPOSITORY_STATE_CHERRYPICK_SEQUENCE:
merging = true;
text = tr("Cherry-pick");
break;
case GIT_REPOSITORY_STATE_CHERRYPICK:
case GIT_REPOSITORY_STATE_CHERRYPICK_SEQUENCE:
merging = true;
text = tr("Cherry-pick");
break;
case GIT_REPOSITORY_STATE_REBASE:
case GIT_REPOSITORY_STATE_REBASE_INTERACTIVE:
case GIT_REPOSITORY_STATE_REBASE_MERGE:
text = tr("Rebase");
break;
}
}
case GIT_REPOSITORY_STATE_REBASE:
case GIT_REPOSITORY_STATE_REBASE_INTERACTIVE:
case GIT_REPOSITORY_STATE_REBASE_MERGE:
text = tr("Rebase");
break;
}
}
git::Reference head = view ? view->repo().head() : git::Reference();
git::Branch headBranch = head;
mMergeAbort->setText(tr("Abort %1").arg(text));
mMergeAbort->setVisible(headBranch.isValid() && merging);
git::Reference head = view ? view->repo().head() : git::Reference();
git::Branch headBranch = head;
mMergeAbort->setText(tr("Abort %1").arg(text));
mMergeAbort->setVisible(headBranch.isValid() && merging);
if (!mDiff.isValid()) {
mStage->setEnabled(false);
@ -1191,19 +1192,19 @@ private:
git::Repository repo = RepoView::parentView(this)->repo();
auto state = repo.state();
switch(repo.state()) {
case GIT_REPOSITORY_STATE_MERGE:
switch (repo.state()) {
case GIT_REPOSITORY_STATE_MERGE:
mCommit->setText(tr("Commit Merge"));
mCommit->setEnabled(total && !mMessage->document()->isEmpty());
break;
case GIT_REPOSITORY_STATE_REBASE:
case GIT_REPOSITORY_STATE_REBASE_MERGE:
case GIT_REPOSITORY_STATE_REBASE_INTERACTIVE:
case GIT_REPOSITORY_STATE_REBASE:
case GIT_REPOSITORY_STATE_REBASE_MERGE:
case GIT_REPOSITORY_STATE_REBASE_INTERACTIVE:
mCommit->setText(tr("Commit Rebase"));
mCommit->setEnabled(total && conflicted == 0 && !mMessage->document()->isEmpty());
mCommit->setEnabled(total && conflicted == 0 &&
!mMessage->document()->isEmpty());
break;
default:
default:
mCommit->setText(tr("Commit"));
mCommit->setEnabled(total && !mMessage->document()->isEmpty());
break;
@ -1221,9 +1222,9 @@ private:
QPushButton *mStage;
QPushButton *mUnstage;
QPushButton *mCommit;
QPushButton* mRebaseAbort;
QPushButton* mRebaseContinue;
QPushButton* mMergeAbort;
QPushButton *mRebaseAbort;
QPushButton *mRebaseContinue;
QPushButton *mMergeAbort;
bool mEditorEmpty = true;
bool mPopulate = true;
@ -1341,7 +1342,7 @@ void DetailView::setCommitMessage(const QString &message) {
}
QString DetailView::commitMessage() const {
return static_cast<CommitEditor *>(mDetail->widget(EditorIndex))->message();
return static_cast<CommitEditor *>(mDetail->widget(EditorIndex))->message();
}
void DetailView::setDiff(const git::Diff &diff, const QString &file,

View File

@ -153,12 +153,18 @@ RepoView::RepoView(const git::Repository &repo, MainWindow *parent)
connect(this, &RepoView::statusChanged, menuBar, &MenuBar::updateStash);
connect(notifier, &git::RepositoryNotifier::stateChanged, menuBar,
&MenuBar::updateBranch);
connect(notifier, &git::RepositoryNotifier::rebaseInitError, this, &RepoView::rebaseInitError);
connect(notifier, &git::RepositoryNotifier::rebaseAboutToRebase, this, &RepoView::rebaseAboutToRebase);
connect(notifier, &git::RepositoryNotifier::rebaseCommitInvalid, this, &RepoView::rebaseCommitInvalid);
connect(notifier, &git::RepositoryNotifier::rebaseFinished, this, &RepoView::rebaseFinished);
connect(notifier, &git::RepositoryNotifier::rebaseCommitSuccess, this, &RepoView::rebaseCommitSuccess);
connect(notifier, &git::RepositoryNotifier::rebaseConflict, this, &RepoView::rebaseConflict);
connect(notifier, &git::RepositoryNotifier::rebaseInitError, this,
&RepoView::rebaseInitError);
connect(notifier, &git::RepositoryNotifier::rebaseAboutToRebase, this,
&RepoView::rebaseAboutToRebase);
connect(notifier, &git::RepositoryNotifier::rebaseCommitInvalid, this,
&RepoView::rebaseCommitInvalid);
connect(notifier, &git::RepositoryNotifier::rebaseFinished, this,
&RepoView::rebaseFinished);
connect(notifier, &git::RepositoryNotifier::rebaseCommitSuccess, this,
&RepoView::rebaseCommitSuccess);
connect(notifier, &git::RepositoryNotifier::rebaseConflict, this,
&RepoView::rebaseConflict);
ToolBar *toolBar = parent->toolBar();
connect(this, &RepoView::statusChanged, toolBar, &ToolBar::updateStash);
@ -438,7 +444,7 @@ void RepoView::diffSelected(const git::Diff diff, const QString &file,
bool spontaneous) {
git::Diff diff2 = diff;
mHistory->update(diff.isValid() ? location() : Location(),
spontaneous); // TODO: why this changes diff?
spontaneous); // TODO: why this changes diff?
mDetails->setDiff(diff2, file, mPathspec->pathspec());
}
@ -1390,18 +1396,18 @@ void RepoView::mergeAbort(LogEntry *parent) {
}
void RepoView::abortRebase() {
mRepo.rebaseAbort();
mRebase = nullptr;
refresh();
mRepo.rebaseAbort();
mRebase = nullptr;
refresh();
}
void RepoView::continueRebase() {
if (!mRebase) {
// Rebase operation was started externally so before going on with rebasing,
// create a log entry
mRebase = addLogEntry(tr(""), tr("Continue ongoing rebase"));
}
mRepo.rebaseContinue(mDetails->commitMessage());
if (!mRebase) {
// Rebase operation was started externally so before going on with rebasing,
// create a log entry
mRebase = addLogEntry(tr(""), tr("Continue ongoing rebase"));
}
mRepo.rebaseContinue(mDetails->commitMessage());
}
void RepoView::rebase(const git::AnnotatedCommit &upstream, LogEntry *parent) {
@ -1410,57 +1416,56 @@ void RepoView::rebase(const git::AnnotatedCommit &upstream, LogEntry *parent) {
mRebase = parent;
mRepo.rebase(upstream, mDetails->overrideUser(),
mDetails->overrideEmail());
mRepo.rebase(upstream, mDetails->overrideUser(), mDetails->overrideEmail());
}
void RepoView::rebaseInitError() {
const git::Branch head = mRepo.head();
Q_ASSERT(head.isValid());
LogEntry *err = error(mRebase, tr("rebase"), head.name());
// Add stash hint if the failure was because of uncommitted changes.
QString msg = git::Repository::lastError();
int kind = git::Repository::lastErrorKind();
if (kind == GIT_ERROR_REBASE && msg.contains("changes exist")) {
QString text =
tr("You may be able to rebase by <a href='action:stash'>stashing</a> "
"before trying to <a href='action:rebase'>rebase</a>. Then "
"<a href='action:unstash'>unstash</a> to restore your changes.");
err->addEntry(LogEntry::Hint, text);
}
mRebase = nullptr;
const git::Branch head = mRepo.head();
Q_ASSERT(head.isValid());
LogEntry *err = error(mRebase, tr("rebase"), head.name());
// Add stash hint if the failure was because of uncommitted changes.
QString msg = git::Repository::lastError();
int kind = git::Repository::lastErrorKind();
if (kind == GIT_ERROR_REBASE && msg.contains("changes exist")) {
QString text =
tr("You may be able to rebase by <a href='action:stash'>stashing</a> "
"before trying to <a href='action:rebase'>rebase</a>. Then "
"<a href='action:unstash'>unstash</a> to restore your changes.");
err->addEntry(LogEntry::Hint, text);
}
mRebase = nullptr;
}
void RepoView::rebaseCommitInvalid(const git::Rebase rebase) {
const git::Branch head = mRepo.head();
error(mRebase, tr("rebase"), head.name());
const git::Branch head = mRepo.head();
error(mRebase, tr("rebase"), head.name());
}
void RepoView::rebaseAboutToRebase(const git::Rebase rebase, const git::Commit before, int currIndex) {
QString beforeText = before.link();
QString step = tr("%1/%2").arg(currIndex).arg(rebase.count());
QString text = tr("%1 - %2").arg(step, beforeText);
LogEntry *entry = mRebase->addEntry(text, tr("Apply"));
void RepoView::rebaseAboutToRebase(const git::Rebase rebase,
const git::Commit before, int currIndex) {
QString beforeText = before.link();
QString step = tr("%1/%2").arg(currIndex).arg(rebase.count());
QString text = tr("%1 - %2").arg(step, beforeText);
LogEntry *entry = mRebase->addEntry(text, tr("Apply"));
}
void RepoView::rebaseConflict(const git::Rebase rebase) {
refresh();
}
void RepoView::rebaseConflict(const git::Rebase rebase) { refresh(); }
void RepoView::rebaseCommitSuccess(const git::Rebase rebase, const git::Commit before, const git::Commit after, int currIndex) {
QString beforeText = before.link();
QString step = tr("%1/%2").arg(currIndex).arg(rebase.count());
mRebase->setText(
(after == before)
? tr("%1 - %2 <i>already applied</i>").arg(step, beforeText)
: tr("%1 - %2 as %3").arg(step, beforeText, msg(after)));
void RepoView::rebaseCommitSuccess(const git::Rebase rebase,
const git::Commit before,
const git::Commit after, int currIndex) {
QString beforeText = before.link();
QString step = tr("%1/%2").arg(currIndex).arg(rebase.count());
mRebase->setText(
(after == before)
? tr("%1 - %2 <i>already applied</i>").arg(step, beforeText)
: tr("%1 - %2 as %3").arg(step, beforeText, msg(after)));
}
void RepoView::rebaseFinished(const git::Rebase rebase) {
QString text = tr("Rebase finished");
mRebase->addEntry(text, tr("Rebase"));
mRebase = nullptr;
QString text = tr("Rebase finished");
mRebase->addEntry(text, tr("Rebase"));
mRebase = nullptr;
}
void RepoView::squash(const git::AnnotatedCommit &upstream, LogEntry *parent) {

View File

@ -345,9 +345,11 @@ public slots:
private slots:
void rebaseInitError();
void rebaseCommitInvalid(const git::Rebase rebase);
void rebaseAboutToRebase(const git::Rebase rebase, const git::Commit before, int currIndex);
void rebaseAboutToRebase(const git::Rebase rebase, const git::Commit before,
int currIndex);
void rebaseFinished(const git::Rebase rebase);
void rebaseCommitSuccess(const git::Rebase rebase, const git::Commit before, const git::Commit after, int currIndex);
void rebaseCommitSuccess(const git::Rebase rebase, const git::Commit before,
const git::Commit after, int currIndex);
void rebaseConflict(const git::Rebase rebase);
signals:
@ -408,7 +410,7 @@ private:
QWidget *mSideBar;
LogEntry *mLogRoot;
LogEntry* mRebase{nullptr};
LogEntry *mRebase{nullptr};
LogView *mLogView;
QTimer mLogTimer;
bool mIsLogVisible = false;

View File

@ -74,8 +74,9 @@ add_library(testlib Test.cpp)
target_link_libraries(testlib app git ui Qt5::Test zip)
target_include_directories(testlib PRIVATE ${CMAKE_SOURCE_DIR}/src)
target_compile_definitions(
testlib PRIVATE TESTREPOSITORIES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/testRepos"
PUBLIC GIT_EXECUTABLE="${GIT_EXECUTABLE}")
testlib
PRIVATE TESTREPOSITORIES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/testRepos"
PUBLIC GIT_EXECUTABLE="${GIT_EXECUTABLE}")
# Add tests.
test(NAME bare_repo)

View File

@ -19,15 +19,15 @@
QVERIFY(!path.isEmpty()); \
mRepo = git::Repository::open(path); \
QVERIFY(mRepo.isValid()); \
MainWindow window(mRepo); \
MainWindow window(mRepo); \
window.show(); \
QVERIFY(QTest::qWaitForWindowExposed(&window)); \
QVERIFY(QTest::qWaitForWindowExposed(&window)); \
\
git::Reference head = mRepo.head(); \
git::Commit commit = head.target(); \
git::Diff stagedDiff = mRepo.diffTreeToIndex(commit.tree()); /* correct */ \
\
RepoView *repoView = window.currentView(); \
RepoView *repoView = window.currentView(); \
Test::refresh(repoView); \
DiffView diffView = DiffView(mRepo, repoView); \
auto diff = mRepo.status(mRepo.index(), nullptr, false);

File diff suppressed because it is too large Load Diff