|
2 | 2 | # Proof of concept script to use Bash to produce report of file counts from git |
3 | 3 | # status. |
4 | 4 | # |
5 | | -# Run this as a standalone report, not as a hook. If you use this as a hook, it |
6 | | -# will print output in the console only not add to commit message |
| 5 | +# Run this as a standalone report, not for use as a hook. |
| 6 | +# If you use this as a hook, it will print output in the console only and |
| 7 | +# not add to commit message. |
7 | 8 | # |
8 | | -# See simple-hook.sh script for how CHANGES |
9 | | -# would get written out to a commit message file. |
| 9 | +# See simple-hook.sh script for how CHANGES would get written out to a commit |
| 10 | +# message file. |
10 | 11 | # |
11 | 12 | # This script will get count of files added, modified, deleted and renamed/moved |
12 | 13 | # and output it. Note that modified and renamed/moved can both apply to the same |
13 | 14 | # file. |
14 | | -# This does not support C (copied). |
15 | | - |
| 15 | +# This does not support 'C' (copied). |
| 16 | +# |
16 | 17 | # This report uses git status and passes it do the steps below to parse it. |
17 | 18 | # A more flexible approach (for unit tests for example) would be for this |
18 | 19 | # script to handle the status and call another script to do the parsing and |
|
22 | 23 | # Status summary excluding untracked files using a flag. |
23 | 24 | CHANGES=$(git status -s -uno --porcelain) |
24 | 25 |
|
25 | | -# Note quotes AND -n to preserve newlines so line count for grep, for start of lines works. |
| 26 | +# Note quotes AND -n to preserve newlines so line count for grep, for start |
| 27 | +# of lines works. |
26 | 28 | FILES=$(echo -n "$CHANGES" | wc -l) |
27 | 29 |
|
28 | 30 | echo "All files changed: $FILES" |
|
0 commit comments