Edgewall Software
Modify

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12797 closed enhancement (fixed)

Log unique message for missing control files

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.2.2
Component: plugin/git Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Error message differs for Git control files not found vs path does not exist.

API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

A while back I was helping with a question in SO:29981668/121694, and thought it would be useful to log/raise a specific error messages for each condition that leads to GIT control files missing: tags/trac-1.0.6/tracopt/versioncontrol/git/PyGIT.py@:371-384#L370.

Attachments (2)

Screen Shot 2017-05-22 at 12.59.01.png (51.0 KB ) - added by Ryan J Ollos 7 years ago.
Screen Shot 2017-05-22 at 13.00.07.png (36.5 KB ) - added by Ryan J Ollos 7 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Ryan J Ollos, 7 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 7 years ago

Milestone: next-stable-1.2.x1.2.2
Owner: set to Ryan J Ollos
Release Notes: modified (diff)
Status: newassigned

comment:3 by Ryan J Ollos, 7 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed to 1.2-stable in r15924, merged to trunk in r15925.

comment:4 by Jun Omae, 7 years ago

I think the original author avoided to leak path of the git repository to non-administrator users.

by Ryan J Ollos, 7 years ago

by Ryan J Ollos, 7 years ago

comment:5 by Ryan J Ollos, 7 years ago

The path is leaked to the end user, but it is due to: raising InvalidRepository in git_fs.

Should we change that?

  • tracopt/versioncontrol/git/git_fs.py

    diff --git a/tracopt/versioncontrol/git/git_fs.py b/tracopt/versioncontrol/git/git_fs.py
    index 378664ffb..27055bf02 100644
    a b from trac.env import ISystemInfoProvider  
    2626from trac.util import shorten_line
    2727from trac.util.datefmt import FixedOffset, to_timestamp, format_datetime
    2828from trac.util.text import to_unicode, exception_to_unicode
    29 from trac.util.translation import _
     29from trac.util.translation import _, tag_
    3030from trac.versioncontrol.api import Changeset, Node, Repository, \
    3131                                    IRepositoryConnector, InvalidRepository,\
    3232                                    NoSuchChangeset, NoSuchNode, \
    class GitRepository(Repository):  
    495495        except PyGIT.GitError as e:
    496496            log.error(exception_to_unicode(e))
    497497            raise InvalidRepository(
    498                 _("%(path)s does not appear to be a Git repository.",
    499                   path=path))
     498                tag_("%(name)s does not appear to be a Git repository. See the "
     499                     "log for more information.",
     500                     name=tag.strong(params['name'])))
    500501
    501502        Repository.__init__(self, 'git:' + path, self.params, log)
    502503        self._cached_git_id = str(self.id)

comment:6 by Ryan J Ollos, 7 years ago

comment:5 change committed to 1.2-stable in r15959, merged to trunk in r15960.

comment:7 by Ryan J Ollos, 7 years ago

#12896 is related.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.