Skip to content

Commit

Permalink
Merge pull request #617 from stoivo/you-can-do-the-🎉-emoji
Browse files Browse the repository at this point in the history
Emoji: Support emoji in branch name
  • Loading branch information
divmain committed Mar 5, 2017
2 parents 9131af8 + 7f0f1de commit 40352a6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/commands/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def run_async(self, name=""):
self.window.show_input_panel(NEW_BRANCH_PROMPT, name, self.on_done, None, None)

def on_done(self, branch_name):
pattern = r"^(?!\.|.*\.\..*|.*@.*|\/)[a-zA-Z0-9\-\_\/\.]+(?<!\.lock)(?<!\/)(?<!\.)$"
pattern = r"^(?!\.|.*\.\..*|.*@.*|\/)[a-zA-Z0-9\-\_\/\.\u263a-\U0001f645]+(?<!\.lock)(?<!\/)(?<!\.)$"
match = re.match(pattern, branch_name)
if not match:
sublime.error_message("`{}` is a invalid branch name.\nRead more on $(man git-check-ref-format)".format(branch_name))
Expand Down
2 changes: 1 addition & 1 deletion core/git_mixins/active_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _get_branch_status_components(self):
return False, True, first_line[21:], clean, None, None, None, False

valid_punctuation = "".join(c for c in string.punctuation if c not in "~^:?*[\\")
branch_pattern = "[A-Za-z0-9" + re.escape(valid_punctuation) + "]+?"
branch_pattern = "[A-Za-z0-9" + re.escape(valid_punctuation) + "\u263a-\U0001f645]+?"
short_status_pattern = "## (" + branch_pattern + ")(\.\.\.(" + branch_pattern + ")( \[((ahead (\d+))(, )?)?(behind (\d+))?(gone)?\])?)?$"
status_match = re.match(short_status_pattern, first_line)

Expand Down
3 changes: 1 addition & 2 deletions core/git_mixins/branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def _parse_branch_line(self, line):
if not line:
return None

pattern = r"(\* )?(remotes/)?([a-zA-Z0-9\-\_\/\.\-]+(?<!\.lock)(?<!\/)(?<!\.)) +([0-9a-f]{40}) (\[([a-zA-Z0-9\-\_\/\.]+)(: ([^\]]+))?\] )?(.*)"
r"((: ))?"
pattern = r"(\* )?(remotes/)?([a-zA-Z0-9\-\_\/\.\-\u263a-\U0001f645]+(?<!\.lock)(?<!\/)(?<!\.)) +([0-9a-f]{40}) (\[([a-zA-Z0-9\-\_\/\.]+)(: ([^\]]+))?\] )?(.*)"

match = re.match(pattern, line)
if not match:
Expand Down

0 comments on commit 40352a6

Please sign in to comment.