From bee4c2002d387c34b22bac886bd67ad4fd1c1bb8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 8 Sep 2016 10:46:54 +0200 Subject: [PATCH] Write the tree before finding the parent commits --- libimagstorestdhook/src/vcs/git/update.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libimagstorestdhook/src/vcs/git/update.rs b/libimagstorestdhook/src/vcs/git/update.rs index 32ee18a4..b02548ac 100644 --- a/libimagstorestdhook/src/vcs/git/update.rs +++ b/libimagstorestdhook/src/vcs/git/update.rs @@ -139,6 +139,13 @@ impl StoreIdAccessor for UpdateHook { .map_into_hook_error() ); + let tree_id = try!( + index.write_tree() + .map_err_into(GHEK::RepositoryIndexWritingError) + .map_dbg_err_str("Failed to write tree") + .map_into_hook_error() + ); + let mut parents = Vec::new(); { let commit = try!( @@ -153,14 +160,6 @@ impl StoreIdAccessor for UpdateHook { // for converting from Vec to Vec<&Commit> let parents = parents.iter().collect::>(); - let tree_id = try!( - index.write_tree() - .map_err_into(GHEK::RepositoryIndexWritingError) - .map_dbg_err_str("Failed to write tree") - .map_into_hook_error() - ); - - let tree = try!( repo.find_tree(tree_id) .map_err_into(GHEK::RepositoryParentFetchingError)