I'm looking for a part-time remote job.

Hire me


I'm the author of:

Mastering Redmine is a comprehensive guide with tips, tricks and best practices, and an easy-to-learn structure.

Check the book's project or

Buy the book

Social pages of the book:

By buying this book you also donate to Redmine (see this page).


Follow me:

Bug #2102

Code to strip '.git' extensions is not correct.

Added by Martin Corino over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
27 Sep 2012
Due date:
14 Nov 2012
% Done:

100%

Redmine version:
2.1.0
External issue:

Description

The code (regular expression) to strip the '.git’ extension from repository paths is not correct. It now also strips anything that ends with any character followed by 'git’.
This is the result of constructing a regular expression from a string and forgetting the rule that in a string to get an escape character you have to escape that escape, i.e. “\\”.
Below the patch I made to fix this.

diff --git a/plugins/redmine_scm/lib/creator/git_creator.rb b/plugins/redmine_scm/lib/creator/git_creator.rb
index 14148ce..f50c150 100644
--- a/plugins/redmine_scm/lib/creator/git_creator.rb
+++ b/plugins/redmine_scm/lib/creator/git_creator.rb
@@ -36,7 +36,7 @@ class GitCreator < SCMCreator

         def repository_name(path)
             base = Redmine::Platform.mswin? ? options['path'].gsub(%r{\\}, "/") : options['path']
-            matches = Regexp.new("^#{Regexp.escape(base)}/([^/]+?)(\.git)?/?$").match(path)
+            matches = Regexp.new("^#{Regexp.escape(base)}/([^/]+?)(\\.git)?/?$").match(path)
             matches ? matches[1] : nil
         end


Related issues

Related to SCM Creator (+Github) - Patch #2095: Git repositories are always created without .git extension Closed 24 Jul 2012 14 Nov 2012

Associated revisions

Revision 119 (diff)
Added by Andriy Lesyuk over 11 years ago

Applied fixes (#2095, #2102 and #2120)

History

#1 Updated by Andriy Lesyuk over 11 years ago

  • Status changed from New to Open
  • Assignee set to Andriy Lesyuk

Thanks for the patch!

#2 Updated by Andriy Lesyuk over 11 years ago

  • Target version set to 0.4.2

#3 Updated by Andriy Lesyuk over 11 years ago

  • Due date set to 14 Nov 2012
  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Not yet committed...

Also available in: Atom PDF

Terms of use | Privacy policy