Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Murmele committed Jan 4, 2023
1 parent 2ed66dc commit 5472f79
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 32 deletions.
21 changes: 10 additions & 11 deletions src/git/Patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ bool Patch::isLfsPointer() const {
}

Blob Patch::blob(Diff::File file) {
if (file == Diff::File::NewFile) {
if (mNewBlob.isValid())
return mNewBlob;
} else {
if (mOldBlob.isValid())
return mOldBlob;
}
if (file == Diff::File::NewFile) {
if (mNewBlob.isValid())
return mNewBlob;
} else {
if (mOldBlob.isValid())
return mOldBlob;
}

git_repository *repo = git_patch_owner(d.data());
if (!repo)
Expand All @@ -157,9 +157,9 @@ Blob Patch::blob(Diff::File file) {

auto b = Blob(reinterpret_cast<git_blob *>(obj));
if (file == Diff::File::NewFile) {
mNewBlob = b;
mNewBlob = b;
} else {
mOldBlob = b;
mOldBlob = b;
}

return b;
Expand Down Expand Up @@ -351,8 +351,7 @@ QByteArray Patch::generateResult(QList<QList<QByteArray>> &image,
return filtered;
}

QByteArray Patch::apply(const QBitArray &hunks,
const FilterList &filters) {
QByteArray Patch::apply(const QBitArray &hunks, const FilterList &filters) {
QList<QList<QByteArray>> image;
populatePreimage(image);

Expand Down
2 changes: 1 addition & 1 deletion src/git/Patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Patch {
* \return edited file
*/
QByteArray apply(const QBitArray &hunks,
const FilterList &filters = FilterList());
const FilterList &filters = FilterList());
QByteArray apply(int hidx, QByteArray &hunkData, QByteArray fileContent,
const FilterList &filters = FilterList()) const;

Expand Down
4 changes: 2 additions & 2 deletions src/ui/DiffView/EditButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#include "ui/RepoView.h"
#include <QPainterPath>

EditButton::EditButton(git::Patch &patch, int index, bool binary,
bool lfs, QWidget *parent)
EditButton::EditButton(git::Patch &patch, int index, bool binary, bool lfs,
QWidget *parent)
: Button(parent) {
setObjectName("EditButton");

Expand Down
2 changes: 1 addition & 1 deletion src/ui/DiffView/EditButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class EditButton : public Button {

public:
EditButton(git::Patch &patch, int index, bool binary, bool lfs,
QWidget *parent = nullptr);
QWidget *parent = nullptr);

void updatePatch(git::Patch &patch, int index, bool init = false);

Expand Down
8 changes: 4 additions & 4 deletions src/ui/DiffView/FileWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ void _FileWidget::Header::updateCheckState() {
//############### FileWidget ###########################################
//###############################################################################

FileWidget::FileWidget(DiffView *view, const git::Diff &diff,
git::Patch &patch, const git::Patch &staged,
const QModelIndex modelIndex, const QString &name,
const QString &path, bool submodule, QWidget *parent)
FileWidget::FileWidget(DiffView *view, const git::Diff &diff, git::Patch &patch,
const git::Patch &staged, const QModelIndex modelIndex,
const QString &name, const QString &path, bool submodule,
QWidget *parent)
: QWidget(parent), mView(view), mDiff(diff), mPatch(patch),
mModelIndex(modelIndex) {
auto stageState = static_cast<git::Index::StagedState>(
Expand Down
8 changes: 4 additions & 4 deletions src/ui/DiffView/FileWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Header : public QFrame {

public:
Header(const git::Diff &diff, git::Patch &patch, bool binary, bool lfs,
bool submodule, QWidget *parent = nullptr);
bool submodule, QWidget *parent = nullptr);
void updatePatch(git::Patch &patch);
QCheckBox *check() const;

Expand Down Expand Up @@ -92,7 +92,7 @@ class FileWidget : public QWidget {
QWidget *parent = nullptr);
bool isEmpty();
void updatePatch(git::Patch &patch, const git::Patch &staged,
const QString &name, const QString &path, bool submodule);
const QString &name, const QString &path, bool submodule);
/*!
* Update hunks after index change and emits the current stage state of the
* hunks \brief updateHunks
Expand All @@ -106,8 +106,8 @@ class FileWidget : public QWidget {
QWidget *addImage(DisclosureButton *button, const git::Patch patch,
bool lfs = false);
HunkWidget *addHunk(const git::Diff &diff, git::Patch &patch,
const git::Patch &staged, int index, bool lfs,
bool submodule);
const git::Patch &staged, int index, bool lfs,
bool submodule);
void setStageState(git::Index::StagedState state);
QModelIndex modelIndex();

Expand Down
11 changes: 5 additions & 6 deletions src/ui/DiffView/HunkWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ const QString noNewLineAtEndOfFile =
HunkWidget::tr("No newline at end of file");
} // namespace

_HunkWidget::Header::Header(const git::Diff &diff, git::Patch &patch,
int index, bool lfs, bool submodule,
QWidget *parent)
_HunkWidget::Header::Header(const git::Diff &diff, git::Patch &patch, int index,
bool lfs, bool submodule, QWidget *parent)
: QFrame(parent) {
setObjectName("HunkHeader");
mCheck = new QCheckBox(this);
Expand Down Expand Up @@ -178,9 +177,9 @@ void _HunkWidget::Header::mouseDoubleClickEvent(QMouseEvent *event) {
//########## HunkWidget ###############################################
//#############################################################################

HunkWidget::HunkWidget(DiffView *view, const git::Diff &diff,
git::Patch &patch, const git::Patch &staged,
int index, bool lfs, bool submodule, QWidget *parent)
HunkWidget::HunkWidget(DiffView *view, const git::Diff &diff, git::Patch &patch,
const git::Patch &staged, int index, bool lfs,
bool submodule, QWidget *parent)
: QFrame(parent), mView(view), mPatch(patch), mStaged(staged),
mIndex(index), mLfs(lfs) {
setObjectName("HunkWidget");
Expand Down
6 changes: 3 additions & 3 deletions src/ui/DiffView/HunkWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Header : public QFrame {
Q_OBJECT
public:
Header(const git::Diff &diff, git::Patch &patch, int index, bool lfs,
bool submodule, QWidget *parent = nullptr);
bool submodule, QWidget *parent = nullptr);
QCheckBox *check() const;

DisclosureButton *button() const;
Expand Down Expand Up @@ -62,8 +62,8 @@ class HunkWidget : public QFrame {

public:
HunkWidget(DiffView *view, const git::Diff &diff, git::Patch &patch,
const git::Patch &staged, int index, bool lfs, bool submodule,
QWidget *parent = nullptr);
const git::Patch &staged, int index, bool lfs, bool submodule,
QWidget *parent = nullptr);
_HunkWidget::Header *header() const;
TextEditor *editor(bool ensureLoaded = true);
void invalidate();
Expand Down

0 comments on commit 5472f79

Please sign in to comment.