1 | Prism.languages.git = {
|
2 | /*
|
3 | * A simple one line comment like in a git status command
|
4 | * For instance:
|
5 | * $ git status
|
6 | * # On branch infinite-scroll
|
7 | * # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged,
|
8 | * # and have 1 and 2 different commits each, respectively.
|
9 | * nothing to commit (working directory clean)
|
10 | */
|
11 | 'comment': /^#.*/m,
|
12 |
|
13 | /*
|
14 | * Regexp to match the changed lines in a git diff output. Check the example below.
|
15 | */
|
16 | 'deleted': /^[-–].*/m,
|
17 | 'inserted': /^\+.*/m,
|
18 |
|
19 | /*
|
20 | * a string (double and simple quote)
|
21 | */
|
22 | 'string': /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
|
23 |
|
24 | /*
|
25 | * a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
|
26 | * For instance:
|
27 | * $ git add file.txt
|
28 | */
|
29 | 'command': {
|
30 | pattern: /^.*\$ git .*$/m,
|
31 | inside: {
|
32 | /*
|
33 | * A git command can contain a parameter starting by a single or a double dash followed by a string
|
34 | * For instance:
|
35 | * $ git diff --cached
|
36 | * $ git log -p
|
37 | */
|
38 | 'parameter': /\s--?\w+/
|
39 | }
|
40 | },
|
41 |
|
42 | /*
|
43 | * Coordinates displayed in a git diff command
|
44 | * For instance:
|
45 | * $ git diff
|
46 | * diff --git file.txt file.txt
|
47 | * index 6214953..1d54a52 100644
|
48 | * --- file.txt
|
49 | * +++ file.txt
|
50 | * @@ -1 +1,2 @@
|
51 | * -Here's my tetx file
|
52 | * +Here's my text file
|
53 | * +And this is the second line
|
54 | */
|
55 | 'coord': /^@@.*@@$/m,
|
56 |
|
57 | /*
|
58 | * Match a "commit [SHA1]" line in a git log output.
|
59 | * For instance:
|
60 | * $ git log
|
61 | * commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
|
62 | * Author: lgiraudel
|
63 | * Date: Mon Feb 17 11:18:34 2014 +0100
|
64 | *
|
65 | * Add of a new line
|
66 | */
|
67 | 'commit-sha1': /^commit \w{40}$/m
|
68 | };
|