Commit ebeaa957 authored by David nolden's avatar David nolden
Browse files

- Fix a bug that made the state of added items appear as "Deleted" in the commit dialog.

- When committing, use the real repository root as working-directory. Else, committing of pure deletions fails, because the framework does not correctly recognize that the argument is a deleted file, and interprets it as a directory.
parent 1928a66b
......@@ -99,6 +99,13 @@ QString GitPlugin::name() const
return QLatin1String("Git");
}
KUrl GitPlugin::repositoryRoot(const KUrl& path)
{
// Ugly but true: This is how it works.
isValidDirectory(path);
return m_lastRepoRoot;
}
bool GitPlugin::isValidDirectory(const KUrl & dirPath)
{
KUrl possibleRepoRoot = m_lastRepoRoot;
......@@ -341,7 +348,8 @@ VcsJob* GitPlugin::commit(const QString& message,
return 0;
DVcsJob* job = new DVcsJob(this);
if (prepareJob(job, localLocations.front().toLocalFile()) ) {
if (prepareJob(job, repositoryRoot(localLocations.front()).path()) ) {
*job << "git";
*job << "commit";
*job << "-m";
......@@ -655,8 +663,7 @@ QList<QVariant> GitPlugin::getCachedFiles(const QString &directory, KDevelop::Ou
VcsStatusInfo status;
status.setUrl(file);
status.setState(VcsStatusInfo::State(charToState(line.section(' ', 4, 4)[0].toAscii() ) +
VcsStatusInfo::ItemAdded) );
status.setState(VcsStatusInfo::State(charToState(line.section(' ', 4, 4)[0].toAscii() ) ));
kDebug() << line[97] << " " << file.toLocalFile();
......
......@@ -146,6 +146,9 @@ public:
QList<DVcsEvent>& commits) const;
protected:
KUrl repositoryRoot(const KUrl& path);
bool isValidDirectory(const KUrl &dirPath);
DVcsJob* lsFiles(const QString &repository,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment