プロジェクト

全般

プロフィール

Vote #73613

完了

Commit reference: autogenerated issue note has wrong commit link syntax in multi-repo or cross-project context

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
SCM_3
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
3
version_id:
78
issue_org_id:
13544
author_id:
40457
assigned_to_id:
1
comments:
9
status_id:
5
tracker_id:
1
plus1:
1
affected_version:
closed_on:
affected_version_id:
68
ステータス-->[Closed]

説明

Redmine 2.2.3, multi project, multi repo per project.
If I do:

git commit -am "bla... refs #123456"

open issue #123456 in browser. The added note reads:

Applied in changeset somerepo|commit:aa101cb4a8

In order to become a link, it should be

Applied in changeset commit:somerepo|aa101cb4a8

instead.

For cross project links, the generated note is:

Applied in changeset someproj:somerepo|commit:aa101cb4a8

should be

Applied in changeset someproj:commit:somerepo|commit:aa101cb4a8

journals

+1
I can confirm this on version 2.3.1. Attached is a patch that fixes the issue.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This issue is still open in 2.3.3.

The correct syntax for commit links is as follows: (see http://www.redmine.org/help/wiki_syntax_detailed.html)

* Changesets:
** *!r758* (link to a changeset)
** *!commit:c6f4d0fd* (link to a changeset with a non-numeric hash)
** *!svn1|r758* (link to a changeset of a specific repository, for projects with multiple repositories)
** *!commit:hg|c6f4d0fd* (link to a changeset with a non-numeric hash of a specific repository)
** *!sandbox:r758* (link to a changeset of another project)
** *!sandbox:commit:c6f4d0fd* (link to a changeset with a non-numeric hash of another project)

The current code in *app/models/changeset.rb* generates links such as:

* *hg|commit:c6f4d0fd* instead of *!commit:hg|c6f4d0fd*

<pre><code class="ruby">
# Current Code
def text_tag(ref_project=nil)
tag = if scmid?
"commit:#{scmid}"
else
"r#{revision}"
end
if repository && repository.identifier.present?
tag = "#{repository.identifier}|#{tag}"
end
if ref_project && project && ref_project != project
tag = "#{project.identifier}:#{tag}"
end
tag
end
</code></pre>

My fix:
<pre><code class="diff">
diff --git a/app/models/changeset.rb b/app/models/changeset.rb
index d3fa8ab..1951703 100644
--- a/app/models/changeset.rb
+++ b/app/models/changeset.rb
@@ -157,7 +157,11 @@ class Changeset < ActiveRecord::Base
"r#{revision}"
end
if repository && repository.identifier.present?
- tag = "#{repository.identifier}|#{tag}"
+ if scmid?
+ tag = "commit:#{repository.identifier}|#{scmid}"
+ else
+ tag = "#{repository.identifier}|#{tag}"
+ end
end
if ref_project && project && ref_project != project
tag = "#{project.identifier}:#{tag}"
</code>
</pre>

It is a nuisance to fix this every time I update Redmine. Could maybe someone with Commit-Access to Redmine have a look at this?
--------------------------------------------------------------------------------
Fixed in r12660.
--------------------------------------------------------------------------------
Merged.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,14476,Fix for Issue #13544
duplicates,Closed,16017,fixing keywords failed to link to repository with identifier
duplicates,Closed,14405,Alternate repo commit: link wrong when automatically added from a commit message
duplicates,Closed,12685,Commit message generates invalid link when repository has an identifier
duplicates,Closed,13036,auto generated comment "Applied in changeset xxx" is not link to commit

Admin Redmine さんが3年以上前に更新

  • カテゴリSCM_3 にセット
  • 対象バージョン2.4.3_78 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0