Project

General

Profile

Actions

Defect #13544

closed

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

Added by Dietmar H about 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Category:
SCM
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

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


Files

13544.patch (599 Bytes) 13544.patch Omar Kohl, 2013-07-04 13:00

Related issues

Related to Redmine - Patch #14476: Fix for Issue #13544Closed

Actions
Has duplicate Redmine - Defect #16017: fixing keywords failed to link to repository with identifierClosed

Actions
Has duplicate Redmine - Defect #14405: Alternate repo commit: link wrong when automatically added from a commit messageClosed

Actions
Has duplicate Redmine - Defect #12685: Commit message generates invalid link when repository has an identifierClosed

Actions
Has duplicate Redmine - Defect #13036: auto generated comment "Applied in changeset xxx" is not link to commitClosed

Actions
Actions #1

Updated by Omar Kohl almost 10 years ago

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

Actions #2

Updated by Jan Niggemann (redmine.org team member) almost 10 years ago

Actions #3

Updated by Omar Kohl over 9 years ago

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
# 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

My fix:

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}" 

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?

Actions #4

Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.4.3
  • Resolution set to Fixed

Fixed in r12660.

Actions #5

Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from Resolved to Closed

Merged.

Actions #6

Updated by Toshi MARUYAMA over 9 years ago

  • Has duplicate Defect #16017: fixing keywords failed to link to repository with identifier added
Actions #7

Updated by Toshi MARUYAMA about 9 years ago

  • Has duplicate Defect #14405: Alternate repo commit: link wrong when automatically added from a commit message added
Actions #8

Updated by Toshi MARUYAMA almost 8 years ago

  • Has duplicate Defect #12685: Commit message generates invalid link when repository has an identifier added
Actions #9

Updated by Toshi MARUYAMA almost 8 years ago

  • Has duplicate Defect #13036: auto generated comment "Applied in changeset xxx" is not link to commit added
Actions

Also available in: Atom PDF