temporary workaround for git reset

temporary workaround for git reset

All of this code is going to go tomorrow once we figure out how to inspect
without the checkout

From f77dafa5e6deebf30963c5dda3e110e2703aa6f0 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Tue, 27 Nov 2018 20:25:31 +1100
Subject: [PATCH] temporary workaround for git reset

All of this code is going to go tomorrow once we figure out how to inspect
without the checkout

diff --git a/lib/discourse_code_review/github_repo.rb b/lib/discourse_code_review/github_repo.rb
index 9d14ee1..5bd070a 100644
--- a/lib/discourse_code_review/github_repo.rb
+++ b/lib/discourse_code_review/github_repo.rb
@@ -64,7 +64,13 @@ module DiscourseCodeReview
             diff = git("diff #{hash[:commit_id]}~1 #{hash[:commit_id]} #{hash[:path]}")
           end
 
-          git("checkout -f master")
+          begin
+            git("checkout -f master")
+          rescue => e
+            # TODO stop with this exception handling and figure out a cleaner
+            # way of inspecting the git repo for the diff
+            Rails.logger.warn("Failed to run checkout back to master #{e}")
+          end
 
           if diff.present?
             # 5 is preamble

GitHub

1 Like

This is holding up fine as is, @ZogStriP feel free to approve.

1 Like