Opened 7 years ago

Closed 2 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: sjain
Priority: normal Component: TracGitPlugin
Severity: normal Keywords: git GitPlugin
Cc: Trac Release: 0.11

Description (last modified by rjollos)

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 7 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 2 years ago by rjollos

  • Description modified (diff)

comment:3 Changed 2 years ago by rjollos

  • Resolution set to wontfix
  • Status changed from new to closed

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

Add Comment

Modify Ticket

as closed The owner will remain sjain.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.