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 | * a string (double and simple quote)
|
15 | */
|
16 | 'string': /("|')(\\?.)*?\1/m,
|
17 |
|
18 | /*
|
19 | * a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
|
20 | * For instance:
|
21 | * $ git add file.txt
|
22 | */
|
23 | 'command': {
|
24 | pattern: /^.*\$ git .*$/m,
|
25 | inside: {
|
26 | /*
|
27 | * A git command can contain a parameter starting by a single or a double dash followed by a string
|
28 | * For instance:
|
29 | * $ git diff --cached
|
30 | * $ git log -p
|
31 | */
|
32 | 'parameter': /\s(--|-)\w+/m
|
33 | }
|
34 | },
|
35 |
|
36 | /*
|
37 | * Coordinates displayed in a git diff command
|
38 | * For instance:
|
39 | * $ git diff
|
40 | * diff --git file.txt file.txt
|
41 | * index 6214953..1d54a52 100644
|
42 | * --- file.txt
|
43 | * +++ file.txt
|
44 | * @@ -1 +1,2 @@
|
45 | * -Here's my tetx file
|
46 | * +Here's my text file
|
47 | * +And this is the second line
|
48 | */
|
49 | 'coord': /^@@.*@@$/m,
|
50 |
|
51 | /*
|
52 | * Regexp to match the changed lines in a git diff output. Check the example above.
|
53 | */
|
54 | 'deleted': /^-(?!-).+$/m,
|
55 | 'inserted': /^\+(?!\+).+$/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 | };
|