Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5662: Try to open a repository at the mod path to see if there's a V…
…CS repo set up
- Loading branch information
1 parent
b0caa9b
commit 60c4712
Showing
5 changed files
with
88 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include "itextstream.h" | ||
#include "git2.h" | ||
|
||
namespace vcs | ||
{ | ||
|
||
namespace git | ||
{ | ||
|
||
/** | ||
* Represents a Git repository at a certain path | ||
*/ | ||
class Repository | ||
{ | ||
private: | ||
git_repository* _repository; | ||
bool _isOk; | ||
|
||
public: | ||
Repository(const std::string& path) : | ||
_repository(nullptr), | ||
_isOk(false) | ||
{ | ||
if (git_repository_open(&_repository, path.c_str()) == 0) | ||
{ | ||
rMessage() << "Opened repository at " << path << std::endl; | ||
_isOk = true; | ||
} | ||
else | ||
{ | ||
rMessage() << "Failed to open repository at " << path << std::endl; | ||
} | ||
} | ||
|
||
// Status query of this repository object | ||
bool isOk() const | ||
{ | ||
return _isOk; | ||
} | ||
|
||
~Repository() | ||
{ | ||
git_repository_free(_repository); | ||
} | ||
}; | ||
|
||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters