Skip to content

Commit 2bff41d

Browse files
faustinoaqRX14
authored andcommittedJan 2, 2018
Avoid empty author and email (#5355)
1 parent 7cad39c commit 2bff41d

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed
 

‎src/compiler/crystal/tools/init.cr

+15-8
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,27 @@ module Crystal
4444
end
4545

4646
def self.fetch_author
47-
return "[your-name-here]" unless system(WHICH_GIT_COMMAND)
48-
`git config --get user.name`.strip
47+
if system(WHICH_GIT_COMMAND)
48+
user_name = `git config --get user.name`.strip
49+
user_name = nil if user_name.empty?
50+
end
51+
user_name || "your-name-here"
4952
end
5053

5154
def self.fetch_email
52-
return "[your-email-here]" unless system(WHICH_GIT_COMMAND)
53-
`git config --get user.email`.strip
55+
if system(WHICH_GIT_COMMAND)
56+
user_email = `git config --get user.email`.strip
57+
user_email = nil if user_email.empty?
58+
end
59+
user_email || "your-email-here"
5460
end
5561

5662
def self.fetch_github_name
57-
default = "[your-github-name]"
58-
return default unless system(WHICH_GIT_COMMAND)
59-
github_user = `git config --get github.user`.strip
60-
github_user.empty? ? default : github_user
63+
if system(WHICH_GIT_COMMAND)
64+
github_user = `git config --get github.user`.strip
65+
github_user = nil if github_user.empty?
66+
end
67+
github_user || "your-github-user"
6168
end
6269

6370
def self.fetch_name(opts, args)

0 commit comments

Comments
 (0)
Please sign in to comment.