From fb9eb88623257a95fbae69cf4264b21bd69d8cb3 Mon Sep 17 00:00:00 2001
From: Eduardo Cavazos <dharmatech@finkelstein.stackeffects.info>
Date: Wed, 14 Jan 2009 02:20:24 -0600
Subject: [PATCH] git-tool: Preliminary support for auto-refresh via file
 system monitors

---
 extra/git-tool/git-tool.factor | 37 +++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/extra/git-tool/git-tool.factor b/extra/git-tool/git-tool.factor
index 454f63f325..7fa79a5b0e 100644
--- a/extra/git-tool/git-tool.factor
+++ b/extra/git-tool/git-tool.factor
@@ -425,6 +425,21 @@ TUPLE: <git-status>
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
+! :: git-tool ( REPO -- )
+
+!   <pile> 1 >>fill
+
+!     "Repository: " REPO [ current-directory get ] with-directory append
+!     <label>
+!     add-gadget
+
+!     REPO git-status <pile> 1 >>fill tuck refresh-status-pile  add-gadget
+!     REPO            <pile> 1 >>fill tuck refresh-remotes-pile add-gadget
+
+!   "Git" open-window ;
+
+! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
 :: git-tool ( REPO -- )
 
   <pile> 1 >>fill
@@ -433,11 +448,31 @@ TUPLE: <git-status>
     <label>
     add-gadget
 
-    REPO git-status <pile> 1 >>fill tuck refresh-status-pile  add-gadget
+    [let | STATUS [ REPO git-status ]
+           PILE   [ <pile> 1 >>fill ] |
+
+      [
+        [let | MONITOR [ REPO t <monitor> ] |
+          [
+
+            [ MONITOR next-change 2drop STATUS PILE refresh-status-pile t ]
+            loop
+          ]
+          in-thread
+        ]
+      ]
+      with-monitors
+           
+      STATUS PILE refresh-status-pile
+      
+      PILE add-gadget ]
+
+    ! REPO git-status <pile> 1 >>fill tuck refresh-status-pile  add-gadget
     REPO            <pile> 1 >>fill tuck refresh-remotes-pile add-gadget
 
   "Git" open-window ;
 
+
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 : factor-git-tool ( -- ) "resource:" git-tool ;