Skip to content

Commit a61ab26

Browse files
Add diff subcommand (#87)
* Add diff subcommand * edit error codes * address review comments * Update src/subcommand/diff_subcommand.cpp Co-authored-by: Johan Mabille <johan.mabille@gmail.com> --------- Co-authored-by: Johan Mabille <johan.mabille@gmail.com>
1 parent e5586eb commit a61ab26

20 files changed

+1394
-8
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ set(GIT2CPP_SRC
4848
${GIT2CPP_SOURCE_DIR}/subcommand/checkout_subcommand.hpp
4949
${GIT2CPP_SOURCE_DIR}/subcommand/clone_subcommand.cpp
5050
${GIT2CPP_SOURCE_DIR}/subcommand/clone_subcommand.hpp
51+
${GIT2CPP_SOURCE_DIR}/subcommand/diff_subcommand.cpp
52+
${GIT2CPP_SOURCE_DIR}/subcommand/diff_subcommand.hpp
5153
${GIT2CPP_SOURCE_DIR}/subcommand/commit_subcommand.cpp
5254
${GIT2CPP_SOURCE_DIR}/subcommand/commit_subcommand.hpp
5355
${GIT2CPP_SOURCE_DIR}/subcommand/config_subcommand.cpp
@@ -98,10 +100,16 @@ set(GIT2CPP_SRC
98100
${GIT2CPP_SOURCE_DIR}/wrapper/commit_wrapper.hpp
99101
${GIT2CPP_SOURCE_DIR}/wrapper/config_wrapper.cpp
100102
${GIT2CPP_SOURCE_DIR}/wrapper/config_wrapper.hpp
103+
${GIT2CPP_SOURCE_DIR}/wrapper/diff_wrapper.cpp
104+
${GIT2CPP_SOURCE_DIR}/wrapper/diff_wrapper.hpp
105+
${GIT2CPP_SOURCE_DIR}/wrapper/diffstats_wrapper.cpp
106+
${GIT2CPP_SOURCE_DIR}/wrapper/diffstats_wrapper.hpp
101107
${GIT2CPP_SOURCE_DIR}/wrapper/index_wrapper.cpp
102108
${GIT2CPP_SOURCE_DIR}/wrapper/index_wrapper.hpp
103109
${GIT2CPP_SOURCE_DIR}/wrapper/object_wrapper.cpp
104110
${GIT2CPP_SOURCE_DIR}/wrapper/object_wrapper.hpp
111+
${GIT2CPP_SOURCE_DIR}/wrapper/patch_wrapper.cpp
112+
${GIT2CPP_SOURCE_DIR}/wrapper/patch_wrapper.hpp
105113
${GIT2CPP_SOURCE_DIR}/wrapper/rebase_wrapper.cpp
106114
${GIT2CPP_SOURCE_DIR}/wrapper/rebase_wrapper.hpp
107115
${GIT2CPP_SOURCE_DIR}/wrapper/refs_wrapper.cpp
@@ -116,6 +124,8 @@ set(GIT2CPP_SRC
116124
${GIT2CPP_SOURCE_DIR}/wrapper/signature_wrapper.hpp
117125
${GIT2CPP_SOURCE_DIR}/wrapper/status_wrapper.cpp
118126
${GIT2CPP_SOURCE_DIR}/wrapper/status_wrapper.hpp
127+
${GIT2CPP_SOURCE_DIR}/wrapper/tree_wrapper.cpp
128+
${GIT2CPP_SOURCE_DIR}/wrapper/tree_wrapper.hpp
119129
${GIT2CPP_SOURCE_DIR}/wrapper/wrapper_base.hpp
120130
${GIT2CPP_SOURCE_DIR}/main.cpp
121131
${GIT2CPP_SOURCE_DIR}/version.hpp

src/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "subcommand/clone_subcommand.hpp"
1212
#include "subcommand/commit_subcommand.hpp"
1313
#include "subcommand/config_subcommand.hpp"
14+
#include "subcommand/diff_subcommand.hpp"
1415
#include "subcommand/fetch_subcommand.hpp"
1516
#include "subcommand/init_subcommand.hpp"
1617
#include "subcommand/log_subcommand.hpp"
@@ -45,6 +46,7 @@ int main(int argc, char** argv)
4546
clone_subcommand clone(lg2_obj, app);
4647
commit_subcommand commit(lg2_obj, app);
4748
config_subcommand config(lg2_obj, app);
49+
diff_subcommand diff(lg2_obj, app);
4850
fetch_subcommand fetch(lg2_obj, app);
4951
reset_subcommand reset(lg2_obj, app);
5052
log_subcommand log(lg2_obj, app);

src/subcommand/checkout_subcommand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void checkout_subcommand::run()
2424

2525
if (repo.state() != GIT_REPOSITORY_STATE_NONE)
2626
{
27-
throw std::runtime_error("Cannot checkout, repository is in unexpected state");
27+
throw std::runtime_error("Cannot checkout, repository is in unexpected state");
2828
}
2929

3030
git_checkout_options options;

0 commit comments

Comments
 (0)