Modify

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#3141 closed defect (duplicate)

submodule handling

Reported by: anonymous Owned by: hvr
Priority: normal Component: GitPlugin
Severity: normal Keywords: submodule
Cc: Trac Release: 0.11

Description

the code breaks at some places in git_fs, on commits having submodule changes. the first one i found is get_content_length returning None, and then trac trying to sum Nones. a quick workaround is changing

if not self.isfile:
  return None

to

if not self.isfile:
  return 0

the second is in get_changes. submodule changes have a different mode than directory changes, so they end up with kind = file, and trac tries to read the content. my workaround is changing the condition

if mode2.startswith('04') or mode1.startswith('04'):
  kind = Node.DIRECTORY

to

if mode2.startswith('04') or mode1.startswith('04') or mode1.startswith('16'):
  kind = Node.DIRECTORY

so these changes are treated like directory changes.

these are just some quick hacks, but they make the plugin usable on repos with submodules, until there's a better solution.

Attachments (0)

Change History (3)

comment:1 in reply to: ↑ description Changed 6 years ago by anonymous

  • Keywords submodule added

Replying to anonymous:

the code breaks at some places in git_fs, on commits having submodule changes. the first one i found is get_content_length returning None, and then trac trying to sum Nones. a quick workaround is changing

if not self.isfile:
  return None

to

if not self.isfile:
  return 0

the second is in get_changes. submodule changes have a different mode than directory changes, so they end up with kind = file, and trac tries to read the content. my workaround is changing the condition

if mode2.startswith('04') or mode1.startswith('04'):
  kind = Node.DIRECTORY

to

if mode2.startswith('04') or mode1.startswith('04') or mode1.startswith('16'):
  kind = Node.DIRECTORY

so these changes are treated like directory changes.

these are just some quick hacks, but they make the plugin usable on repos with submodules, until there's a better solution.

comment:2 Changed 6 years ago by anonymous

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

see also #3104

comment:3 Changed 5 years ago by anonymous

Does anyone know why this was closed as duplicate? Applying the diff from 3104 doesn't fix the issue above, though it does address a different issue with submodules.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from hvr. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.