Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions levels/core_editor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
difficulty 1
description "Set up your git default editor, this is important for editing commits, fixing merge conflicts and rebases. Or maybe you just like nano, we don't discriminate."

setup do
repo.init
end

solution do
valid = false

editor = request("What is your default editor for git?")
config_editor = repo.config["core.editor"]

if editor.respond_to?(:force_encoding)
config_editor = config_editor.force_encoding("UTF-8")
end

if editor == config_editor
valid = true
end

puts "Your config has the following core editor: #{config_editor}"

valid
end

hint do
puts "These settings are config settings. You should run `git help config` if you are stuck. In case you'd like to know what you're doing: man git-commit"
end
2 changes: 1 addition & 1 deletion lib/githug/level.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Githug
class Level
include UI

LEVELS = [nil, "init", "config", "add", "commit", "clone",
LEVELS = [nil, "init", "config", "core_editor", "add", "commit", "clone",
"clone_to_folder", "ignore", "include", "status",
"number_of_files_committed", "rm", "rm_cached", "stash", "rename",
"restructure", "log", "tag", "push_tags", "commit_amend",
Expand Down