Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove path to password store in commit message and a leading space. #169

Merged
merged 2 commits into from
Mar 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,11 +614,11 @@ QString MainWindow::getDir(const QModelIndex &index, bool forPass) {
return forPass ? "" : abspath;
QFileInfo info = model.fileInfo(proxyModel.mapToSource(index));
QString filePath =
(info.isFile() ? info.absolutePath() : info.absoluteFilePath()) + '/';
(info.isFile() ? info.absolutePath() : info.absoluteFilePath());
if (forPass) {
filePath.replace(QRegExp("^" + passStore), "");
filePath.replace(QRegExp("^" + abspath), "");
filePath = QDir(abspath).relativeFilePath(filePath);
}
filePath += '/';
return filePath;
}

Expand All @@ -628,8 +628,8 @@ QString MainWindow::getFile(const QModelIndex &index, bool forPass) {
return QString();
QString filePath = model.filePath(proxyModel.mapToSource(index));
if (forPass) {
filePath = QDir(passStore).relativeFilePath(filePath);
filePath.replace(QRegExp("\\.gpg$"), "");
filePath.replace(QRegExp("^" + passStore), "");
}
return filePath;
}
Expand Down Expand Up @@ -1131,9 +1131,8 @@ void MainWindow::setPassword(QString file, bool overwrite, bool isNew = false) {
if (!useWebDav && useGit) {
if (!overwrite)
executeWrapper(gitExecutable, "add \"" + file + '"');
QString path = file;
QString path = QDir(passStore).relativeFilePath(file);
path.replace(QRegExp("\\.gpg$"), "");
path.replace(QRegExp("^" + passStore), "");
executeWrapper(gitExecutable, "commit \"" + file + "\" -m \"" +
(overwrite ? "Edit" : "Add") + " for " +
path + " using QtPass.\"");
Expand Down Expand Up @@ -1205,7 +1204,7 @@ void MainWindow::on_deleteButton_clicked() {
if (useGit) {
executeWrapper(gitExecutable, "rm -f \"" + file + '"');
executeWrapper(gitExecutable,
"commit \"" + file + "\" -m \" Remove for " +
"commit \"" + file + "\" -m \"Remove for " +
getFile(ui->treeView->currentIndex(), true) +
" using QtPass.\"");
if (autoPush)
Expand All @@ -1228,7 +1227,7 @@ void MainWindow::on_deleteButton_clicked() {
if (useGit) {
executeWrapper(gitExecutable, "rm -rf \"" + file + '"');
executeWrapper(gitExecutable,
"commit \"" + file + "\" -m \" Remove for " +
"commit \"" + file + "\" -m \"Remove for " +
getFile(ui->treeView->currentIndex(), true) +
" using QtPass.\"");
if (autoPush)
Expand Down
2 changes: 1 addition & 1 deletion storemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ bool StoreModel::ShowThis(const QModelIndex index) const {
} else {
QModelIndex useIndex = sourceModel()->index(index.row(), 0, index.parent());
QString path = fs->filePath(useIndex);
path = QDir(store).relativeFilePath(path);
path.replace(QRegExp("\\.gpg$"), "");
path.replace(QRegExp("^" + store), "");
retVal = path.contains(filterRegExp());
}
return retVal;
Expand Down