Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Git Formats] Add support for Git Log HEAD line #2807

Merged
merged 2 commits into from
Aug 24, 2021
Merged
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
27 changes: 23 additions & 4 deletions Git Formats/Git Log.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,32 @@ contexts:
main:
# 1st header line
# commit d9d9fb804f5d61c13ba2f8746af33a9f3c609075
- match: (?:(commit)\s+(\h{7,}))?\s*\n
scope: meta.header.git.commit markup.raw.block.git.log
- match: ^(commit)\s+(\h{7,})
captures:
1: keyword.other.commit.git.log
2: constant.other.hash.git.log
embed: commit-header
escape: (?=^commit\s)
push:
- meta_scope: meta.header.git.commit markup.raw.block.git.log
- match: $\n?
scope: meta.header.git.commit markup.raw.block.git.log
keith-hall marked this conversation as resolved.
Show resolved Hide resolved
pop: true
embed: commit-header
escape: (?=^commit\s)
- match: (\()(HEAD)\s*(->)
captures:
1: punctuation.section.parens.begin.git.log
2: support.type.git.log
3: punctuation.separator.mapping.git.log
push:
- match: \)
scope: punctuation.section.parens.end.git.log
pop: true
- match: \bmaster\b
scope: entity.other.branch-name.master.git.log
- match: (\w+)(?:(/)(\w+))?
scope: entity.other.branch-name.git.log
- match: ','
scope: punctuation.separator.sequence.git.log

commit-header:
# All header attributes are mappings of `key: value` format.
Expand Down
29 changes: 29 additions & 0 deletions Git Formats/tests/syntax_test_git_log
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,32 @@ Date: Thu Sep 21 22:53:04 2017 +0200
# ^ punctuation.separator.reference.issue.git
# ^ punctuation.definition.reference.issue.git

commit e2077c6e006acfd2f060aef03c4ef8f89c4db362 (HEAD -> branch_name, origin/branch_name)
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.git markup.raw.block.git
# ^ punctuation.section.parens.begin.git
# ^^^^ support.type.git
# ^^ punctuation.separator.mapping.git
# ^^^^^^^^^^^ entity.other.branch-name.git
# ^ punctuation.separator.sequence.git
# ^^^^^^^^^^^^^^^^^^ entity.other.branch-name.git
# ^ punctuation.section.parens.end.git
Author: username <[email protected]>
# <- meta.header.git.commit markup.raw.block.git.log keyword.other.header.git.log
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.git.commit markup.raw.block.git.log
#^^^^^^^ - string.unquoted.log
#^^^^^ keyword.other.header.git.log
# ^ punctuation.separator.mapping.pair.git.log - keyword.other.header.git.log
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.log
# ^ punctuation.definition.reference.email.begin.git
# ^^^^^^^^^^^^^^^^^^^^^^^^^ meta.reference.email.git
# ^^^^^^^^^^^^^^^^^^^^^^^ entity.name.reference.email.git
# ^ punctuation.separator.email.git
# ^ punctuation.separator.domain.git
# ^ punctuation.definition.reference.email.end.git
Date: Thu Sep 21 22:53:04 2017 +0200
# <- meta.header.git.commit markup.raw.block.git.log keyword.other.header.git.log
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.header.git.commit markup.raw.block.git.log
#^^^^^^^ - string.unquoted.log
#^^^ keyword.other.header.git.log
# ^ punctuation.separator.mapping.pair.git.log - keyword.other.header.git.log
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.unquoted.log