What we're listening to:
Jared

The Hold Steady:
Heaven Is Whenever
Jeff

Paper Route:
Absence

redmine and git

January 15th, 2009

Over the last few months, I’ve become a big fan of Redmine. It’s just what I was looking for when I was tired of setting up a TRAC for each project but missed the source code integration when we were using Basecamp. Redmine doesn’t look very pretty at first, but there’s some good themes (we use the basecamp inspired theme) that make it much better.

When we started using git, it brought some new issues up with our workflow and redmine, and we’re not the only ones . Some people are just changing and making the repository on their redmine server their “central” repository, but our redmine is hosted locally, and our repositories for each project are hosted on the deployment machine. This causes some problems because the redmine repo doesn’t receive updates.

There’s a plugin aimed at solving this, but it’s not functional yet. We solved it with a quick hack to run a git pull before redmine brings in new information from the repository:

Index: app/models/repository/git.rb
===================================================================
--- app/models/repository/git.rb (revision 2251)
+++ app/models/repository/git.rb (working copy)
@@ -36,6 +36,7 @@
end

def fetch_changesets
+ scm.fetch
scm_info = scm.info
if scm_info
# latest revision found in database
Index: lib/redmine/scm/adapters/git_adapter.rb

===================================================================
--- lib/redmine/scm/adapters/git_adapter.rb (revision 2251)
+++ lib/redmine/scm/adapters/git_adapter.rb (working copy)
@@ -24,6 +24,11 @@

# Git executable name
GIT_BIN = "git"
+
+ def fetch
+ cmd="#{GIT_BIN} --git-dir #{target('')} --bare fetch"
+ shellout(cmd)
+ end

# Get the revision of a particuliar file
def get_rev (rev,path)

Simple, but functional. Give us a shout if this helps you or if you have a better solution.

  • Jared Moody
    Hi Jack,

    Yes, we're still running this. I don't know where that plugin went, but we never used it anyway.

    I don't know if there's now a better way to do this, but this patch is still working for us with the most recent version of redmine, and you should be able to apply the patch as is above.

    That help?
  • Jack Fuchs
    Hi there,

    do you have it still running? The repo linked above does not exist anymore.

    Or is there any better way to doing it in the meantime?

    If not, could you send me the packed repo?

    Greetings
    jack
blog comments powered by Disqus