From 3685f510f7860d09924007ac9fb7ad7d890ad300 Mon Sep 17 00:00:00 2001 From: Michael Lyons Date: Fri, 20 Dec 2024 13:52:06 -0500 Subject: [PATCH] [Diff] Git diff file header paths --- Git Formats/Git Diff.sublime-syntax | 11 ++++++++++ Git Formats/tests/syntax_test_git_diff.patch | 22 +++++++++++++++++++ .../tests/syntax_test_git_diff_combined.patch | 6 +++++ 3 files changed, 39 insertions(+) diff --git a/Git Formats/Git Diff.sublime-syntax b/Git Formats/Git Diff.sublime-syntax index 96eb25f7d5..e3ddeeb31b 100644 --- a/Git Formats/Git Diff.sublime-syntax +++ b/Git Formats/Git Diff.sublime-syntax @@ -291,10 +291,21 @@ contexts: signature: - meta_content_scope: comment.block.diff + diff-header-unified-from-file: + - meta_prepend: true + - include: diff-file-header-path-start + + diff-header-unified-to-file: + - meta_prepend: true + - include: diff-file-header-path-start + diff-file-header: - meta_scope: meta.toc-list.git - meta_content_scope: meta.function-call.arguments.git - include: pop-eol + - include: diff-file-header-path-start + + diff-file-header-path-start: # TODO: Quoted file names https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath - match: (?:a|b|ours|theirs)(?=/) scope: variable.parameter.source.diff diff --git a/Git Formats/tests/syntax_test_git_diff.patch b/Git Formats/tests/syntax_test_git_diff.patch index a28abc2716..0cc2394c93 100644 --- a/Git Formats/tests/syntax_test_git_diff.patch +++ b/Git Formats/tests/syntax_test_git_diff.patch @@ -113,8 +113,28 @@ diff --git a/Gemfile b/Gemfile \ ^ punctuation.separator.path.diff index c661619..989efe8 100644 --- a/Gemfile +\^^^^^^^^^^^^ meta.block.header.diff meta.diff.header.from-file meta.header.from-file.diff +\^^ punctuation.definition.from-file.diff +\ ^ variable.parameter.source.diff +\ ^^^^^^^^ meta.path.diff string.unquoted.git +\ ^ punctuation.separator.path.diff +++ b/Gemfile +\^^^^^^^^^^^^ meta.block.header.diff meta.diff.header.to-file meta.header.to-file.diff +\^^ punctuation.definition.to-file.diff +\ ^ variable.parameter.source.diff +\ ^^^^^^^^ meta.path.diff string.unquoted.git +\ ^ punctuation.separator.path.diff @@ -24,6 +24,7 @@ group :development do +\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff +\^^^^^^^^^^^^^^^^ meta.diff.range.unified meta.range.unified.diff meta.toc-list.hunk.diff +\^ punctuation.definition.range.begin.diff +\ ^ support.function.diff +\ ^ punctuation.separator.sequence.diff +\ ^ support.function.diff +\ ^ punctuation.separator.sequence.diff +\ ^^ punctuation.definition.range.end.diff +\ ^^^^^^^^^^^^^^^^^^^^^^ meta.toc-list.hunk.diff +\ ^^^^^^^^^^^^^^^^^^^^^ entity.name.section.diff gem 'listen', '~> 3.0.5' gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' @@ -124,6 +144,8 @@ index c661619..989efe8 100644 gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] diff --git a/app/assets/images/logo.jpeg b/app/assets/images/logo.jpeg new file mode 100644 +\^^^^^^^^^^^^^^^^^^^ meta.block.header.diff markup.inserted.diff +\ ^^^^^^ meta.number.integer.octal.diff constant.numeric.value.diff index 0000000000000000000000000000000000000000..064fa38be3ecd426a3c8977ed43df627c6f6f229 \^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.header.diff \^^^^ keyword.other.diff diff --git a/Git Formats/tests/syntax_test_git_diff_combined.patch b/Git Formats/tests/syntax_test_git_diff_combined.patch index bdd817c4a8..1bb07df3aa 100644 --- a/Git Formats/tests/syntax_test_git_diff_combined.patch +++ b/Git Formats/tests/syntax_test_git_diff_combined.patch @@ -12,9 +12,15 @@ index fabadb8,cc95eb0..4866510 644 --- a/describe.c \^^^^^^^^^^^^^^^^ meta.block.header.diff meta.diff.header.from-file meta.header.from-file.diff \^^ punctuation.definition.from-file.diff +\ ^ variable.parameter.source.diff +\ ^^^^^^^^^^^ meta.path.diff string.unquoted.git +\ ^ punctuation.separator.path.diff +++ b/describe.c \^^^^^^^^^^^^^^^^ meta.block.header.diff meta.diff.header.to-file meta.header.to-file.diff \^^ punctuation.definition.to-file.diff +\ ^ variable.parameter.source.diff +\ ^^^^^^^^^^^ meta.path.diff string.unquoted.git +\ ^ punctuation.separator.path.diff @@@ -98,20 -98,12 +98,20 @@@ \ ^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.block.delta.diff meta.diff.range.combined meta.range.combined.diff meta.toc-list.hunk.diff return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;