fix: remote branch parsing
This commit is contained in:
		
							parent
							
								
									31c13e8d1d
								
							
						
					
					
						commit
						87f95140d9
					
				| @ -1,5 +1,19 @@ | ||||
| # Change Log | ||||
| 
 | ||||
| ## [Unreleased](https://github.com/skywinder/changelog_test/tree/HEAD) | ||||
| 
 | ||||
| [Full Changelog](https://github.com/skywinder/changelog_test/compare/v0.0.2...HEAD) | ||||
| 
 | ||||
| **Merged pull requests:** | ||||
| 
 | ||||
| - Here is a test hotfix should appear in v.0.0.2 [\#2](https://github.com/skywinder/changelog_test/pull/2) ([skywinder](https://github.com/skywinder)) | ||||
| 
 | ||||
| ## [v0.0.2](https://github.com/skywinder/changelog_test/tree/v0.0.2) (2015-03-04) | ||||
| 
 | ||||
| [Full Changelog](https://github.com/skywinder/changelog_test/compare/v0.0.1...v0.0.2) | ||||
| 
 | ||||
| ## [v0.0.1](https://github.com/skywinder/changelog_test/tree/v0.0.1) (2015-03-02) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* | ||||
| @ -26,7 +26,8 @@ module GitHubChangelogGenerator | ||||
|           :filter_issues_by_milestone => true, | ||||
|           :compare_link => true, | ||||
|           :unreleased => true, | ||||
|           :unreleased_label => 'Unreleased' | ||||
|           :unreleased_label => 'Unreleased', | ||||
|           :branch => 'origin' | ||||
|       } | ||||
| 
 | ||||
|       parser = OptionParser.new { |opts| | ||||
| @ -129,11 +130,20 @@ module GitHubChangelogGenerator | ||||
| 
 | ||||
|       if !options[:user] && !options[:project] | ||||
|         remote = `git remote -vv`.split("\n") | ||||
|         match = /.*(?:[:\/])((?:-|\w|\.)*)\/((?:-|\w|\.)*)?(?:\.git).*/.match(remote[0]) | ||||
|         # try to find repo in format: origin	git@github.com:skywinder/Github-Changelog-Generator.git (fetch) | ||||
|         remote.select { |v| v.include? options[:branch] } | ||||
|         match = /.*(?:[:\/])((?:-|\w|\.)*)\/((?:-|\w|\.)*)(?:\.git).*/.match(remote[0]) | ||||
| 
 | ||||
|         if match && match[1] && match[2] | ||||
|           puts "Detected user:#{match[1]}, project:#{match[2]}" | ||||
|           options[:user], options[:project] = match[1], match[2] | ||||
|         else | ||||
|         # try to find repo in format: origin	https://github.com/skywinder/ChangelogMerger (fetch) | ||||
|           match = /.*\/((?:-|\w|\.)*)\/((?:-|\w|\.)*).*/.match(remote[0]) | ||||
|           if match && match[1] && match[2] | ||||
|             puts "Detected user:#{match[1]}, project:#{match[2]}" | ||||
|             options[:user], options[:project] = match[1], match[2] | ||||
|           end | ||||
|         end | ||||
|       end | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Petr Korolev
						Petr Korolev