This patch adds git support to the Debian tla-load-dirs package.

diff -u -Naur tla-load-dirs-1.0.31/debian/control tla-load-dirs-1.0.33/debian/control
--- tla-load-dirs-1.0.31/debian/control	2006-09-04 16:17:28.000000000 +0200
+++ tla-load-dirs-1.0.33/debian/control	2006-09-11 18:16:06.000000000 +0200
@@ -46,6 +46,19 @@
  changes.  It works on a principle similar to Subversion's
  svn_load_dirs or my tla_load_dirs package for tla.
 
+Package: git-load-dirs
+Architecture: all
+XB-Python-Version: ${python:Versions}
+Depends: load-dirs-common (= ${Source-Version}), git-core, ${shlibs:Depends} ${misc:Depends} ${python:Depends}
+Description: Import upstream archives into git
+ Git works fine for importing new archives.  However, for situations
+ where the upstream renames or moves files and directories on a regular
+ basis, version information can be lost.
+ .
+ git-load-dirs works with git to import these things and preserve
+ changes.  It works on a principle similar to Subversion's
+ svn_load_dirs or my tla_load_dirs package for tla.
+
 Package: load-dirs-common
 Architecture: all
 XB-Python-Version: ${python:Versions}
diff -u -Naur tla-load-dirs-1.0.31/debian/git-load-dirs.install tla-load-dirs-1.0.33/debian/git-load-dirs.install
--- tla-load-dirs-1.0.31/debian/git-load-dirs.install	1970-01-01 01:00:00.000000000 +0100
+++ tla-load-dirs-1.0.33/debian/git-load-dirs.install	2006-09-09 22:27:06.000000000 +0200
@@ -0,0 +1,2 @@
+debian/tmp/usr/bin/git_load_dirs usr/bin
+
diff -u -Naur tla-load-dirs-1.0.31/docs/tla_load_dirs.sgml tla-load-dirs-1.0.33/docs/tla_load_dirs.sgml
--- tla-load-dirs-1.0.31/docs/tla_load_dirs.sgml	2005-09-06 17:14:58.000000000 +0200
+++ tla-load-dirs-1.0.33/docs/tla_load_dirs.sgml	2006-09-12 14:31:27.000000000 +0200
@@ -24,7 +24,7 @@
 
     <refnamediv>
       <refname>tla_load_dirs</refname>
-      <refpurpose>Import upstream archives into tla/arch or darcs and handle renames</refpurpose>
+      <refpurpose>Import upstream archives into tla/arch,darcs or git and handle renames</refpurpose>
     </refnamediv>
 
     <refsynopsisdiv>
@@ -76,7 +76,7 @@
       <title>Description</title>
       <para>
         &tld; is a tool to help you import archives from people that
-        do not use Arch or Darcs into an Arch or Darcs
+        do not use Arch, Darcs or Git into an Arch, Darcs or Git
         archive.  Along the way, it takes
         care of all the typical hassles: it will create tags in the
         repository for new files; delete tags for removed files;
@@ -197,7 +197,7 @@
         <varlistentry><term>-v</term>
           <term>--verbose</term>
           <listitem><para>Causes &tld; to display additional status
-              information.  You will see the darcs/tla commands that are
+              information.  You will see the darcs/tla/git commands that are
               being run behind the scenes, and some executed commands
               may receive arguments asking them to be more verbose as
               well.
@@ -271,6 +271,7 @@
       <para>
         <application>tla</application>(1),
         <application>darcs</application>(1),
+        <application>git</application>(1),
         <application>tla-buildpackage</application>(1).
       </para>
     </refsect1>
diff -u -Naur tla-load-dirs-1.0.31/git_load_dirs tla-load-dirs-1.0.33/git_load_dirs
--- tla-load-dirs-1.0.31/git_load_dirs	1970-01-01 01:00:00.000000000 +0100
+++ tla-load-dirs-1.0.33/git_load_dirs	2006-09-09 22:23:37.000000000 +0200
@@ -0,0 +1,21 @@
+#!/usr/bin/python2.3
+# arch-tag: tla load dirs primary executable
+# Copyright (C) 2003 John Goerzen
+# <jgoerzen@complete.org>
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from tla_support import init
+init.run("git")
diff -u -Naur tla-load-dirs-1.0.31/setup.py tla-load-dirs-1.0.33/setup.py
--- tla-load-dirs-1.0.31/setup.py	2005-10-24 03:02:14.000000000 +0200
+++ tla-load-dirs-1.0.33/setup.py	2006-09-09 22:24:52.000000000 +0200
@@ -23,7 +23,7 @@
       author = 'John Goerzen',
       author_email = 'jgoerzen@complete.org',
       packages = ['tla_support'],
-      scripts = ['tla_load_dirs', 'darcs_load_dirs', 'baz_load_dirs', 'svk_load_dirs']
+      scripts = ['tla_load_dirs', 'darcs_load_dirs', 'baz_load_dirs', 'svk_load_dirs', 'git_load_dirs']
       #license = offlineimap.version.copyright + \
       #          ", Licensed under the GPL version 2"
 )
diff -u -Naur tla-load-dirs-1.0.31/tla_support/commandver.py tla-load-dirs-1.0.33/tla_support/commandver.py
--- tla-load-dirs-1.0.31/tla_support/commandver.py	2006-08-10 23:13:07.000000000 +0200
+++ tla-load-dirs-1.0.33/tla_support/commandver.py	2006-09-11 19:23:45.000000000 +0200
@@ -22,9 +22,10 @@
 tlacmd = None
 darcs = False
 svk = False
+git = False
 
 def setscm(x):
-    global darcs, svk, tlacmd
+    global darcs, svk, git, tlacmd
     darcs = False
     if (x == "darcs"):
         tlacmd = "darcs"
@@ -33,6 +34,9 @@
         tlacmd = "baz"
     elif (x == "tla"):
         tlacmd = "tla"
+    elif (x == "git"):
+        tlacmd = "git"
+        git = True
     else:
         tlacmd = "svk"
         svk = True
@@ -46,6 +50,10 @@
     global svk
     return svk
 
+def isgit():
+    global git
+    return git
+
 def gettlasyntax():
     global tlasyn, tlaobj
     if tlasyn != None:
@@ -54,6 +62,9 @@
     if isdarcs():
         tlasyn = 'darcs'
         tlaobj = Darcs()
+    if isgit():
+        tlasyn = 'Git'
+        tlaobj = Git()
     elif util.getstdoutsafeexec(tlacmd, ['-V'])[0].find('tla-1.0.') != -1:
         tlasyn = '1.0'
         tlaobj = Tla10()
@@ -123,6 +134,15 @@
     replay = 'pull'
     commit = 'record'
 
+class Git:
+    tagging_method = None
+    add = ['add']
+    move = 'mv'
+    delete = 'rm'
+    update = 'checkout'
+    replay = None 
+    commit = 'commit'
+
 class Svk:
 	tagging_method = None
 	add = ['add']
diff -u -Naur tla-load-dirs-1.0.31/tla_support/tla_wc.py tla-load-dirs-1.0.33/tla_support/tla_wc.py
--- tla-load-dirs-1.0.31/tla_support/tla_wc.py	2006-06-17 18:20:54.000000000 +0200
+++ tla-load-dirs-1.0.33/tla_support/tla_wc.py	2006-09-12 14:22:22.000000000 +0200
@@ -18,7 +18,7 @@
 
 import util
 import os.path
-from commandver import cmd, isdarcs, issvk, tlacmd
+from commandver import cmd, isdarcs, issvk, isgit, tlacmd
 
 class wc:
     """Object for a working copy."""
@@ -36,6 +36,8 @@
             return "Darcs repository"
         elif issvk():
             return "Svk repository"
+        elif isgit():
+            return "Git repository"
         else:
             return util.chdircmd(self.wcpath, util.getstdoutsafeexec, tlacmd,
                                  ['tree-version'])[0].strip() 
@@ -48,7 +50,7 @@
         return 1
 
     def gettaggingmethod(self):
-        if isdarcs():
+        if isdarcs() or isgit():
             return 'explicit'
         else:
             return util.chdircmd(self.wcpath, util.getstdoutsafeexec, tlacmd,
@@ -56,7 +58,7 @@
 
     def gettree(self):
         return util.maketree(self.wcpath,
-                             ignore = [r'(^(\{arch\}$|,,|_darcs|\.arch-ids$|\.arch-inventory$|\+\+)|/\.arch-ids/)'])
+                             ignore = [r'(^(\{arch\}$|,,|\.git|_darcs|\.arch-ids$|\.arch-inventory$|\+\+)|/\.arch-ids/)'])
     
     def addtag(self, file):
         if self.verb:
@@ -80,7 +82,7 @@
     def movetag(self, src, dest):
         if self.verb:
             print "Moving %s to %s" % (src, dest)
-        if src[-1] == '/' and dest[-1] == '/' and (not isdarcs()):
+        if src[-1] == '/' and dest[-1] == '/' and (not isdarcs() and not isgit()):
             # Dir to dir -- mv will catch it already.
             return
         src, dest = self.slashstrip(src, dest)
@@ -96,8 +98,8 @@
             destdir = os.path.dirname(dest)
             if (not os.path.exists(destdir)) and destdir != '':
                 self.makedirs(destdir)
-            if not isdarcs():
-                # Darcs moves it itself
+            if not isdarcs() and not isgit():
+                # Darcs and git move it itself
                 os.rename(src, dest)
 
         util.chdircmd(self.wcpath, doit)
@@ -112,6 +114,7 @@
             util.safeexec("rm", ['-rf', fullfile])
 
     def deltag(self, file):
+    	# FXIME: what about git?
         if not isdarcs():
             if self.verb:
                 print "Deleting %s" % file
@@ -122,16 +125,18 @@
     def makelog(self, summary, logtext):
         self.summary = summary
         self.logtext = logtext
-        if not isdarcs():
+	if isgit():
+            logfn = ",,gitlog"
+	elif isdarcs():
+            logfn = ",,darcslog"
+	else:
             logfn =  util.chdircmd(self.wcpath, util.getstdoutsafeexec, tlacmd,
                                    ['make-log'])[0].strip()
-        else:
-            logfn = ",,darcslog"
 
         self.logfn = logfn
         
         fd = open(logfn, "w")
-        if not isdarcs():
+        if not isdarcs() and not isgit():
             fd.write("Summary: %s\n" % summary)
             fd.write("Keywords: \n\n")
         fd.write(logtext)
@@ -147,6 +152,10 @@
                           [cmd().commit, "-l", "-a", "-m", self.summary,
                            "--logfile", self.logfn,
                            "--delete-logfile"])
+        elif isgit():
+            util.chdircmd(self.wcpath, util.safeexec, tlacmd,
+                          [cmd().commit, "-a", "-F", self.logfn])
+	    os.unlink(self.logfn)
         else:
             if len(util.chdircmd(self.wcpath, util.getstdoutsafeexec, tlacmd, ['logs']))==0:
                 util.chdircmd(self.wcpath, util.safeexec, tlacmd, [cmd().importcmd])
