-
Notifications
You must be signed in to change notification settings - Fork 5
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
refactoring v2
- Loading branch information
commit 7eaba8da06c00a98668f05c28bd24d9f542005c5
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
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 |
|---|---|---|
| @@ -1,20 +1,59 @@ | ||
| #pragma once | ||
|
|
||
| #include <string> | ||
| #include <utility> | ||
|
|
||
| class noncopiable_nonmovable | ||
| { | ||
| public: | ||
| noncopiable_nonmovable(const noncopiable_nonmovable&) = delete; | ||
| noncopiable_nonmovable& operator=(const noncopiable_nonmovable&) = delete; | ||
| noncopiable_nonmovable(noncopiable_nonmovable&) = delete; | ||
| noncopiable_nonmovable(noncopiable_nonmovable&&) = delete; | ||
| noncopiable_nonmovable& operator=(noncopiable_nonmovable&&) = delete; | ||
|
|
||
| protected: | ||
| noncopiable_nonmovable() = default; | ||
| ~noncopiable_nonmovable() = default; | ||
| }; | ||
|
|
||
| template <class T> | ||
| class wrapper_base | ||
| { | ||
| public: | ||
| using ressource_type = T; | ||
|
ianthomas23 marked this conversation as resolved.
Outdated
|
||
|
|
||
| wrapper_base(const wrapper_base&) = delete; | ||
| wrapper_base& operator=(const wrapper_base&) = delete; | ||
|
|
||
| wrapper_base(wrapper_base&& rhs) | ||
| : p_ressource(rhs.p_ressource) | ||
| { | ||
| rhs.p_ressource = nullptr; | ||
| } | ||
| wrapper_base& operator=(wrapper_base&& rhs) | ||
| { | ||
| std::swap(p_ressource, rhs.p_ressource); | ||
| return this; | ||
| } | ||
|
|
||
| operator ressource_type*() const noexcept | ||
| { | ||
| return p_ressource; | ||
| } | ||
|
|
||
| protected: | ||
| // Allocation and deletion of p_ressource must be handled by inheriting class. | ||
| wrapper_base() = default; | ||
| ~wrapper_base() = default; | ||
| ressource_type* p_ressource = nullptr; | ||
| }; | ||
|
|
||
| class libgit2_object : private noncopiable_nonmovable | ||
| { | ||
| public: | ||
|
|
||
| libgit2_object(); | ||
| ~libgit2_object(); | ||
| }; | ||
|
|
||
| std::string get_current_git_path(); | ||
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,24 +1,23 @@ | ||
| #include "src/utils/git_exception.hpp" | ||
| #include "../utils/git_exception.hpp" | ||
| #include "repository_wrapper.hpp" | ||
|
|
||
|
|
||
| RepositoryWrapper::RepositoryWrapper() | ||
| : p_repo(nullptr) | ||
| {} | ||
|
|
||
| RepositoryWrapper::~RepositoryWrapper() | ||
| repository_wrapper::~repository_wrapper() | ||
| { | ||
| git_repository_free(p_repo); | ||
| p_repo=nullptr; | ||
| git_repository_free(p_ressource); | ||
| p_ressource=nullptr; | ||
| } | ||
|
|
||
| // RepositoryWrapper::RepositoryWrapper open(const std::string path) | ||
| // { | ||
| // | ||
| // }; | ||
| repository_wrapper repository_wrapper::open(const std::string& directory) | ||
| { | ||
| repository_wrapper rw; | ||
| throwIfError(git_repository_open(&(rw.p_ressource), directory.c_str())); | ||
| return rw; | ||
| } | ||
|
|
||
| void RepositoryWrapper::init(const std::string& directory, bool bare) | ||
| repository_wrapper repository_wrapper::init(const std::string& directory, bool bare) | ||
| { | ||
| RepositoryWrapper rw; | ||
| throwIfError(git_repository_init(&(rw.p_repo), directory.c_str(), bare)); | ||
| repository_wrapper rw; | ||
| throwIfError(git_repository_init(&(rw.p_ressource), directory.c_str(), bare)); | ||
| return rw; | ||
| } |
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,21 +1,24 @@ | ||
| #pragma once | ||
|
|
||
| #include <git2.h> | ||
| #include <string> | ||
|
|
||
| #include <git2.h> | ||
|
|
||
| #include "../utils/common.hpp" | ||
|
|
||
| class RepositoryWrapper : private noncopiable_nonmovable | ||
| class repository_wrapper : public wrapper_base<git_repository> | ||
| { | ||
| public: | ||
|
|
||
| ~RepositoryWrapper(); | ||
| ~repository_wrapper(); | ||
|
|
||
| repository_wrapper(repository_wrapper&&) = default; | ||
| repository_wrapper& operator=(repository_wrapper&&) = default; | ||
|
|
||
| // static RepositoryWrapper open(const std::string path); | ||
| static void init(const std::string& directory, bool bare); | ||
| static repository_wrapper init(const std::string& directory, bool bare); | ||
| static repository_wrapper open(const std::string& directory); | ||
|
|
||
| private: | ||
|
|
||
| RepositoryWrapper(); | ||
| git_repository* p_repo; | ||
| repository_wrapper() = default; | ||
| }; |
Oops, something went wrong.
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.