Commit Graph

191 Commits

Author SHA1 Message Date
Matthias Beyer bdbf136fef Add debug output for DeleteHook 2016-09-18 15:03:07 +02:00
Matthias Beyer c5f95e3538 Add debug output for UpdateHook 2016-09-18 15:00:36 +02:00
Matthias Beyer 15dcb26fd2 Minify Runtime::new() by refactoring error tracing 2016-09-18 14:54:38 +02:00
Matthias Beyer cb3a536adb Fix warn!() output to be action sensitive 2016-09-18 14:50:55 +02:00
Matthias Beyer 9a4cdad9a1 Add StoreAction::as_commit_message() utility fn 2016-09-18 14:50:41 +02:00
Matthias Beyer 9b332815b9 Merge pull request #739 from matthiasbeyer/libimagstorestdhook/git-delete-hook
libimagstorestdhook/git delete hook
2016-09-18 09:49:46 +02:00
Matthias Beyer b2a0758b1a Abort the execution of the UpdateHook if repo isnt dirty 2016-09-17 19:10:13 +02:00
Matthias Beyer eb378d47c2 Add helper fn to check whether the repository WD is dirty 2016-09-17 19:10:13 +02:00
Matthias Beyer d90e745185 Add implementation for delete hook 2016-09-17 18:41:03 +02:00
Matthias Beyer 47646d608b Impl Debug for DeleteHook 2016-09-17 17:51:08 +02:00
Matthias Beyer 994d88e65d DeleteHook: Use Runtime object internally for storing config 2016-09-17 17:23:23 +02:00
Matthias Beyer db218cb3ee Merge pull request #736 from matthiasbeyer/libimagstorestdhook/git-docu
libimagstorestdhook/git docu
2016-09-17 17:15:10 +02:00
Matthias Beyer 610a59a8d6 Add documentation for the UpdateHook implementation 2016-09-17 15:22:33 +02:00
Matthias Beyer ffcdd46fe7 Add documentation for the Runtime utility 2016-09-17 15:22:23 +02:00
Matthias Beyer 9d47664cc2 Add documentation for the configuration utilities 2016-09-17 15:22:13 +02:00
Matthias Beyer 62ad1d8071 Add documentation for the StoreAction util type 2016-09-17 15:22:04 +02:00
Matthias Beyer 32c6ab0aaa Remove dead code: {Create,Retrieve}Hook implementation 2016-09-17 15:06:30 +02:00
Matthias Beyer b1af5dc1d5 Remove unused imports: util module 2016-09-10 17:13:54 +02:00
Matthias Beyer 3cf6cc4506 Remove unused imports: Update hook 2016-09-10 17:13:35 +02:00
Matthias Beyer 412c4b5a30 Remove unused import: config module 2016-09-10 17:12:26 +02:00
Matthias Beyer 7f4108ad85 Remove unused imports: create hook 2016-09-10 17:11:45 +02:00
Matthias Beyer 931845105b runtime: Remove unused import Signature 2016-09-10 17:08:56 +02:00
Matthias Beyer 4b281dddc9 Implement editor calling 2016-09-09 16:34:19 +02:00
Matthias Beyer cc035525ec Add error kinds for editor calling 2016-09-09 16:34:19 +02:00
Matthias Beyer 995593a3b7 Add string input 2016-09-09 16:34:19 +02:00
Matthias Beyer 66d8b71bdf Add dep: libimaginteraction 2016-09-09 16:34:19 +02:00
Matthias Beyer 47c3d0e483 Implement commit_message() 2016-09-09 16:34:19 +02:00
Matthias Beyer 636674b059 All StoreIds point to files, so this check does not make sense here 2016-09-09 12:56:29 +02:00
Matthias Beyer e49050932a Fix missing parentheses in impl Debug for UpdateHook 2016-09-08 16:53:12 +02:00
Matthias Beyer 0dc2baaee2 Write index after committing 2016-09-08 14:23:10 +02:00
Matthias Beyer bee4c2002d Write the tree before finding the parent commits 2016-09-08 14:23:10 +02:00
Matthias Beyer 0366d0f8cb Add some debug output if commit worked 2016-09-08 14:23:10 +02:00
Matthias Beyer 0cfeda8652 We only need to pass the local part to git2 here 2016-09-08 14:23:10 +02:00
Matthias Beyer a4231ac5d8 Add debug output in UpdateHook::access() 2016-09-08 14:23:10 +02:00
Matthias Beyer 8f01cf15e4 Move hook impl to update hook as Store::create() is lazy
As Store::create() is lazy and does not write to disk, we do not have a
file on disk when the post-create-hook runs.

Therefor, the implementation of the git logic has to be in the update
hook.
2016-09-08 14:23:10 +02:00
Matthias Beyer c19f269f59 Adapt ensure_cfg_branch_is_checked_out() for new Runtime::repository() interface 2016-09-07 22:06:07 +02:00
Matthias Beyer b50aacbf55 Move error output to Runtime::repository() getter 2016-09-07 22:06:07 +02:00
Matthias Beyer f86b450cfa Simplify error printing if config value fetching failed 2016-09-07 22:06:07 +02:00
Matthias Beyer 4e2a980599 Refactor Index fetching into helper function 2016-09-07 22:06:07 +02:00
Matthias Beyer 032110e6d8 Rewrite fetch_repo() so we have less overhead in calling this helper 2016-09-07 22:06:07 +02:00
Matthias Beyer ca47744108 Add StoreAction::uppercase() utility function
For debugging output convenience
2016-09-07 22:06:07 +02:00
Matthias Beyer 741ebff2da Outsource repository fetching into helper fn 2016-09-07 22:06:07 +02:00
Matthias Beyer fddd6ec4cb Remove unused fn: mkrepo() 2016-09-07 22:06:07 +02:00
Matthias Beyer 9c2f4db03d Remove unused fn: hasrepo() 2016-09-07 22:06:07 +02:00
Matthias Beyer 513a99fca7 Add initial implementation for UpdateHook 2016-09-07 22:05:50 +02:00
Matthias Beyer 6ef6262e54 Add error kind for parent fetching error 2016-09-07 22:05:50 +02:00
Matthias Beyer 242fa863b2 The helper commit_message() really should return an Result<String> 2016-09-07 22:05:50 +02:00
Matthias Beyer 6444f95b58 Reimplement Hook::set_config() for UpdateHook 2016-09-07 22:05:50 +02:00
Matthias Beyer bcf91780aa impl Debug for UpdateHook 2016-09-07 22:05:50 +02:00
Matthias Beyer c9c535f46c Add Runtime for UpdateHook 2016-09-07 22:05:50 +02:00
Matthias Beyer ced6342d01 Use MapIntoHookError for mapping into hook error 2016-09-07 22:05:31 +02:00
Matthias Beyer ec1b5f7e8b Add IntoHookError for convenience function map_into_hook_error() 2016-09-07 22:05:31 +02:00
Matthias Beyer ca94a6cb7c Add error kind for index writing error 2016-09-07 22:05:31 +02:00
Matthias Beyer 132d0d2698 Rewrite hook implementation 2016-09-07 22:05:31 +02:00
Matthias Beyer 2929b77248 Add more error kinds 2016-09-07 22:05:31 +02:00
Matthias Beyer a24981b6b6 use Runtime as GRuntime, for clearness 2016-09-07 22:05:31 +02:00
Matthias Beyer 0e7d1730fc Fix get_bool_cfg() 2016-09-07 22:05:30 +02:00
Matthias Beyer 9e5932f57c Commit with "Initial commit" if there is no parent 2016-09-07 22:05:30 +02:00
Matthias Beyer ffd71b0907 Add errors for HEAD fetching HEAD-target fetching errors 2016-09-07 22:05:30 +02:00
Matthias Beyer 3f43fa1172 [TMP] 2016-09-07 22:05:30 +02:00
Matthias Beyer 3a6f469b7d Refactor to use Result::map_dbg_err_str() 2016-09-07 22:05:30 +02:00
Matthias Beyer 3ea3e03cab Add dependency: libimagutil 2016-09-07 22:05:30 +02:00
Matthias Beyer 39c3e3f7e0 Insert dummy commit message 2016-09-07 22:05:30 +02:00
Matthias Beyer be34dddf87 Add StoreId prefix removal 2016-09-07 22:05:30 +02:00
Matthias Beyer c1e430e1ff Add error kind for error when stripping store id path prefix 2016-09-07 22:05:30 +02:00
Matthias Beyer 79b0693fe8 Add debugging output in CreateHook 2016-09-07 22:05:30 +02:00
Matthias Beyer 30c672821d Add debugging output in Runtime 2016-09-07 22:05:30 +02:00
Matthias Beyer 112646c002 Do not store reference to store path in the hook objects 2016-09-07 22:05:30 +02:00
Matthias Beyer 6714f4e3c7 Implement CreateHook::access() 2016-09-07 22:05:30 +02:00
Matthias Beyer 989c1790be Simplify error creating code snippet, as we have From<> now implemented 2016-09-07 22:05:30 +02:00
Matthias Beyer e5a066ed0b Add error kind and impl From<Git2Error> for HE 2016-09-07 22:05:30 +02:00
Matthias Beyer 204ebc884c Runtime::repository() should return HookResult 2016-09-07 22:05:29 +02:00
Matthias Beyer 5615ad12df Let the commit_message() helper always return a proper commit msg 2016-09-07 22:05:29 +02:00
Matthias Beyer ba1b4682d7 Remove lifetimes from Runtime struct 2016-09-07 22:05:29 +02:00
Matthias Beyer 068c731857 Remove author/committer fetching, the git2 crate can do this 2016-09-07 22:05:29 +02:00
Matthias Beyer 2dbad3f232 Revert "Add stubs for getting information from the config"
This reverts commit 8f7f89ae10325a2f7f2e64378c3342c14780563b.
2016-09-07 22:05:29 +02:00
Matthias Beyer d59b139f23 Revert "Add Runtime::new_committer_sig()"
This reverts commit 883a3392279baddc3a1305874e7c7e92e1d485dc.
2016-09-07 22:05:29 +02:00
Matthias Beyer 81c0a9e170 Impl From<GitHookError> for HookError 2016-09-07 22:05:29 +02:00
Matthias Beyer 21c6945a46 Add missing import of HookResult 2016-09-07 22:05:29 +02:00
Matthias Beyer 9d9338d0e4 Add Runtime::new_committer_sig() 2016-09-07 22:05:29 +02:00
Matthias Beyer e0a390d840 Add Runtime::has_repository() 2016-09-07 22:05:29 +02:00
Matthias Beyer d498ed75d9 Use Runtime object rather than own Repository object 2016-09-07 22:05:29 +02:00
Matthias Beyer 9ed13f265d Move config to Runtime 2016-09-07 22:05:29 +02:00
Matthias Beyer 2ef530b462 Add error kind if config is not available 2016-09-07 22:05:29 +02:00
Matthias Beyer e5503116ad Add Runtime::ensure_configured_branch_is_checked_out 2016-09-07 22:05:29 +02:00
Matthias Beyer e13722accb Make Runtime pub 2016-09-07 22:05:29 +02:00
Matthias Beyer 464a9c4e4e Make Runtime fields nonpublic 2016-09-07 22:05:29 +02:00
Matthias Beyer 57fbeb54e7 Add Runtime::repository() 2016-09-07 22:05:29 +02:00
Matthias Beyer edd37b0e88 Add stubs for getting information from the config 2016-09-07 22:05:29 +02:00
Matthias Beyer 3c80632d4d Add error kind for runtime info setup errors 2016-09-07 22:05:28 +02:00
Matthias Beyer 3b138d2add Add Runtime object for git hooks 2016-09-07 22:05:28 +02:00
Matthias Beyer 4de051e1bb Start impl of StoreIdAccessor for CreateHook 2016-09-07 22:05:28 +02:00
Matthias Beyer 830d170518 Add GitHookError::inside_if() 2016-09-07 22:05:28 +02:00
Matthias Beyer 189ebb2aea Add error kinds for repository interaction errors 2016-09-07 22:05:28 +02:00
Matthias Beyer 554ec2ca5c Refactor: Use helper function internally 2016-09-07 22:05:28 +02:00
Matthias Beyer a356a96a99 Add helper to check whether to try to checkout the ensure_branch branch 2016-09-07 22:05:28 +02:00
Matthias Beyer c972b5706d Add helper to get the branch which must be checked out before any action takes place 2016-09-07 22:05:28 +02:00
Matthias Beyer c09f0b302f Add error kinds for configuration errors 2016-09-07 22:05:28 +02:00
Matthias Beyer 4436a294e2 Add helper to check config whether to abort the hook failing
This helper can be used to check the configuration of the hook whether
it should abort if the repository cannot be opened.
2016-09-07 22:05:28 +02:00
Matthias Beyer af089952c8 Add Repository instantiation 2016-09-07 22:05:28 +02:00