Opened 9 years ago

Closed 4 years ago

#2672 closed defect (wontfix)

git plugin complains of: UnboundLocalError: local variable 'rev' referenced before assignment with an empty repository

Reported by: wam-trac-hacks-org@… Owned by: Samat Jain
Priority: normal Component: TracGitPlugin
Severity: normal Keywords: git GitPlugin
Cc: Trac Release: 0.11

Description (last modified by Ryan J Ollos)

When loading the Git plugin (for the trac .11 release) I get:

Trac detected an internal error:
UnboundLocalError: local variable 'rev' referenced before assignment

If I go into the source of the TracGit module, and execute, I get a similar error:

draal:~/gitplugin/0.11/tracext/git$ python /data/git/[scrubbed]/.git
git version [{'v_tuple': (1, 5, 2, 5), 'v_min_tuple': (1, 5, 2), 'v_compatible': True, 'v_min_str': '1.5.2', 'v_str': ''}]
statm = (5029888, 3309568, 1613824, 1011712, 0, 1720320, 0)
DATA:      0     +0
DATA:      0     +0
Traceback (most recent call last):
  File "", line 694, in <module>
    print "[%s]" % g.head()
  File "", line 358, in head
    return self.verifyrev("HEAD")
  File "", line 364, in verifyrev
    db, tag_db = self.rev_cache[2:4]
  File "", line 269, in get_rev_cache
    oldest = rev
UnboundLocalError: local variable 'rev' referenced before assignment

This was from the latest zip file that was pulled down Feb 26, 2008

Looking into the code a bit, I realized that the problem comes from PyGIT's processing of an empty repository (immediately after 'git init' and before any commits). Once I discovered this, I added a file to the repository and the problem went away.

Attachments (0)

Change History (3)

comment:1 Changed 9 years ago by anonymous

Looks like this might be a duplicate of #2013, which has a user contributed patch on it as well.

comment:2 Changed 4 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 4 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

Tickets should no longer be filed against TracGitPlugin. See GitPlugin or Git support in Trac 1.0.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Samat Jain.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.