Skip to content

Commit

Permalink
use also as variable name mGitPath
Browse files Browse the repository at this point in the history
  • Loading branch information
Murmele committed Nov 12, 2023
1 parent 01f8103 commit 3c65264
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/conf/RecentRepositories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ void RecentRepositories::remove(int index) {
}

/*!
* gitpath: path to the git repository, does not neccesarly need to be the workdir
* gitpath: path to the git repository, does not neccesarly need to be the
* workdir
*/
void RecentRepositories::add(QString gitpath) {
emit repositoryAboutToBeAdded();
Expand Down
12 changes: 7 additions & 5 deletions src/conf/RecentRepository.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
#include "RecentRepository.h"

RecentRepository::RecentRepository(const QString &gitpath, QObject *parent)
: QObject(parent), mPath(gitpath) {}
: QObject(parent), mGitPath(gitpath) {}

QString RecentRepository::gitpath() const { return mPath; }
QString RecentRepository::gitpath() const { return mGitPath; }

QString RecentRepository::name() const {
if (mPath.endsWith("/.git"))
return mPath.section('/', -mSections - 1, -2);
QString name;
if (mGitPath.endsWith("/.git"))
name = mGitPath.section('/', -mSections - 1, -2);
else
return mPath.section('/', -mSections, -1);
name = mGitPath.section('/', -mSections, -1);
return name;
}

void RecentRepository::increment() { ++mSections; }
2 changes: 1 addition & 1 deletion src/conf/RecentRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class RecentRepository : public QObject {
private:
void increment();

QString mPath;
QString mGitPath;
int mSections = 1;

friend class RecentRepositories;
Expand Down

0 comments on commit 3c65264

Please sign in to comment.