-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add status subcommand #10
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a7b747d
refactoring
SandrineP 7eaba8d
refactoring v2
SandrineP 9874773
add short flag
SandrineP f4ec301
address review comments
SandrineP 9bb2f93
add test
SandrineP 3a0cc12
switch to enum
SandrineP 7140906
remove headers in short format
SandrineP b0e8296
edit test
SandrineP 80db329
fix typo
SandrineP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
refactoring
- Loading branch information
commit a7b747db787fe7facbb410a7bfc8edd31cd9f3f5
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
subdir('subcommand') | ||
subdir('utils') | ||
subdir('wrapper') | ||
|
||
src_files = files([ | ||
'git_exception.cpp', | ||
'main.cpp' | ||
]) + subcommand_files + wrapper_files | ||
]) + subcommand_files + utils_files + wrapper_files |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,13 @@ | ||
#include <git2.h> | ||
|
||
#include "common.hpp" | ||
|
||
libgit2_object::libgit2_object() | ||
{ | ||
git_libgit2_init(); | ||
} | ||
|
||
libgit2_object::~libgit2_object() | ||
{ | ||
git_libgit2_shutdown(); | ||
} |
This file contains hidden or 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,20 @@ | ||
class noncopiable_nonmovable | ||
{ | ||
public: | ||
noncopiable_nonmovable(const noncopiable_nonmovable&) = delete; | ||
noncopiable_nonmovable& operator=(const noncopiable_nonmovable&) = delete; | ||
noncopiable_nonmovable(noncopiable_nonmovable&) = delete; | ||
noncopiable_nonmovable& operator=(noncopiable_nonmovable&&) = delete; | ||
|
||
protected: | ||
noncopiable_nonmovable() = default; | ||
~noncopiable_nonmovable() = default; | ||
}; | ||
|
||
class libgit2_object : private noncopiable_nonmovable | ||
{ | ||
public: | ||
|
||
libgit2_object(); | ||
~libgit2_object(); | ||
}; |
File renamed without changes.
File renamed without changes.
This file contains hidden or 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,4 @@ | ||
utils_files = files([ | ||
'common.cpp', | ||
'git_exception.cpp', | ||
]) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
wrapper_files = files([ | ||
'base_wrapper.cpp', | ||
'repository_wrapper.cpp', | ||
]) |
This file contains hidden or 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 |
---|---|---|
@@ -1,22 +1,24 @@ | ||
#include <iostream> | ||
#include <string> | ||
|
||
#include "../git_exception.hpp" | ||
#include "src/utils/git_exception.hpp" | ||
#include "repository_wrapper.hpp" | ||
|
||
|
||
RepositoryWrapper::RepositoryWrapper() | ||
: _repo(nullptr) | ||
: p_repo(nullptr) | ||
{} | ||
|
||
RepositoryWrapper::~RepositoryWrapper() | ||
{ | ||
if (_repo != nullptr) { | ||
git_repository_free(_repo); // no return | ||
} | ||
git_repository_free(p_repo); | ||
p_repo=nullptr; | ||
} | ||
|
||
// RepositoryWrapper::RepositoryWrapper open(const std::string path) | ||
// { | ||
// | ||
// }; | ||
|
||
void RepositoryWrapper::init(const std::string& directory, bool bare) | ||
{ | ||
// what if it is already initialised? Throw exception or delete and recreate? | ||
throwIfError(git_repository_init(&_repo, directory.c_str(), bare)); | ||
RepositoryWrapper rw; | ||
throwIfError(git_repository_init(&(rw.p_repo), directory.c_str(), bare)); | ||
} |
This file contains hidden or 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 |
---|---|---|
@@ -1,16 +1,21 @@ | ||
#pragma once | ||
|
||
#include "base_wrapper.hpp" | ||
#include <git2.h> | ||
#include <string> | ||
|
||
class RepositoryWrapper : public BaseWrapper | ||
#include "../utils/common.hpp" | ||
|
||
class RepositoryWrapper : private noncopiable_nonmovable | ||
{ | ||
public: | ||
RepositoryWrapper(); | ||
|
||
virtual ~RepositoryWrapper(); | ||
~RepositoryWrapper(); | ||
|
||
void init(const std::string& directory, bool bare); | ||
// static RepositoryWrapper open(const std::string path); | ||
static void init(const std::string& directory, bool bare); | ||
|
||
private: | ||
git_repository *_repo; | ||
|
||
RepositoryWrapper(); | ||
git_repository* p_repo; | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.