#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 )
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)
Change History (9)
comment:1 by , 8 years ago
Description: | modified (diff) |
---|
comment:2 by , 8 years ago
Milestone: | next-stable-1.2.x → 1.2.2 |
---|---|
Owner: | set to |
Release Notes: | modified (diff) |
Status: | new → assigned |
comment:3 by , 8 years ago
Release Notes: | modified (diff) |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
comment:4 by , 8 years ago
I think the original author avoided to leak path of the git repository to non-administrator users.
by , 8 years ago
Attachment: | Screen Shot 2017-05-22 at 12.59.01.png added |
---|
by , 8 years ago
Attachment: | Screen Shot 2017-05-22 at 13.00.07.png added |
---|
comment:5 by , 8 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 26 26 from trac.util import shorten_line 27 27 from trac.util.datefmt import FixedOffset, to_timestamp, format_datetime 28 28 from trac.util.text import to_unicode, exception_to_unicode 29 from trac.util.translation import _ 29 from trac.util.translation import _, tag_ 30 30 from trac.versioncontrol.api import Changeset, Node, Repository, \ 31 31 IRepositoryConnector, InvalidRepository,\ 32 32 NoSuchChangeset, NoSuchNode, \ … … class GitRepository(Repository): 495 495 except PyGIT.GitError as e: 496 496 log.error(exception_to_unicode(e)) 497 497 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']))) 500 501 501 502 Repository.__init__(self, 'git:' + path, self.params, log) 502 503 self._cached_git_id = str(self.id)
Committed to 1.2-stable in r15924, merged to trunk in r15925.