Use up-to-date commit ID when creating new test branch
diff mbox series

Message ID 20180212011351.25201-1-andrew.donnellan@au1.ibm.com
State Accepted
Headers show
Series
  • Use up-to-date commit ID when creating new test branch
Related show

Commit Message

Andrew Donnellan Feb. 12, 2018, 1:13 a.m. UTC
When we create a new test branch, we use a commit ID taken from before
we've pulled the latest upstream branch.

Move the fetching of the current commit ID until after we've pulled.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
---
 src/main.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

diff --git a/src/main.rs b/src/main.rs
index a31c8846568a..a7f90f95a517 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -165,7 +165,6 @@  fn test_patch(settings: &Config, client: &Arc<Client>, project: &Project,
     let tag = utils::sanitise_path(
         path.file_name().unwrap().to_str().unwrap().to_string());
     let mut remote = repo.find_remote(&project.remote_name).unwrap();
-    let commit = git::get_latest_commit(&repo);
 
     let mut push_callbacks = RemoteCallbacks::new();
     push_callbacks.credentials(|_, _, _| {
@@ -186,6 +185,7 @@  fn test_patch(settings: &Config, client: &Arc<Client>, project: &Project,
         git::pull(&repo).unwrap();
 
         debug!("Creating a new branch...");
+        let commit = git::get_latest_commit(&repo);
         let mut branch = repo.branch(&tag, &commit, true).unwrap();
         debug!("Switching to branch...");
         repo.set_head(branch.get().name().unwrap())