diff options
author | Malfurious <m@lfurio.us> | 2021-03-24 01:32:14 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2021-03-24 01:32:14 -0400 |
commit | 4c8973e82367a370988b7ae41be00fb51dd1ea9f (patch) | |
tree | b8147fdc0d84244e9c352dff4567fe6e540f02c4 | |
parent | d10bbe731ea7d6afb2565dea005e1523d085bb8b (diff) | |
parent | b63fbc85fda00873e5e6984de53971c0d229660b (diff) | |
download | git-sonar-4c8973e82367a370988b7ae41be00fb51dd1ea9f.tar.gz git-sonar-4c8973e82367a370988b7ae41be00fb51dd1ea9f.zip |
Merge branch 'add_typechanged' of https://github.com/hallzy/git-radar
Merge pending pull request #111 of upstream git-radar project from user
hallzy. They write:
I came across "typechanged" the other day in my git status. It occurs
when (for example) you change a file from being a regular file, to a
symlink.
Not sure if you want this in. I am using "TC" in the terminal to show
this.
I would also like a check on the grep's in the lines that I added. I
understand that everything inside of the square brackets can be matched,
but I am unsure what letters I would also need with this.
-rwxr-xr-x | radar-base.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/radar-base.sh b/radar-base.sh index e942332..9d52012 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -347,6 +347,7 @@ staged_status() { local filesDeleted="$(printf '%s' "$gitStatus" | grep -oE "D[AMCR ] " | wc -l | grep -oEi '[1-9][0-9]*')" local filesRenamed="$(printf '%s' "$gitStatus" | grep -oE "R[AMCD ] " | wc -l | grep -oEi '[1-9][0-9]*')" local filesCopied="$(printf '%s' "$gitStatus" | grep -oE "C[AMDR ] " | wc -l | grep -oEi '[1-9][0-9]*')" + local typeChanged="$(printf '%s' "$gitStatus" | grep -oE "T[AMDR ] " | wc -l | grep -oEi '[1-9][0-9]*')" if [ -n "$filesAdded" ]; then staged_string="$staged_string$filesAdded${prefix}A${suffix}" @@ -363,6 +364,9 @@ staged_status() { if [ -n "$filesCopied" ]; then staged_string="$staged_string$filesCopied${prefix}C${suffix}" fi + if [ -n "$typeChanged" ]; then + staged_string="$staged_string$typeChanged${prefix}TC${suffix}" + fi printf '%s' "$staged_string" } @@ -396,6 +400,7 @@ unstaged_status() { local filesModified="$(printf '%s' "$gitStatus" | grep -oE "[ACDRM ]M " | wc -l | grep -oEi '[1-9][0-9]*')" local filesDeleted="$(printf '%s' "$gitStatus" | grep -oE "[AMCR ]D " | wc -l | grep -oEi '[1-9][0-9]*')" + local typeChanged="$(printf '%s' "$gitStatus" | grep -oE "[AMDR ]T " | wc -l | grep -oEi '[1-9][0-9]*')" if [ -n "$filesDeleted" ]; then unstaged_string="$unstaged_string$filesDeleted${prefix}D${suffix}" @@ -403,6 +408,9 @@ unstaged_status() { if [ -n "$filesModified" ]; then unstaged_string="$unstaged_string$filesModified${prefix}M${suffix}" fi + if [ -n "$typeChanged" ]; then + unstaged_string="$unstaged_string$typeChanged${prefix}TC${suffix}" + fi printf '%s' "$unstaged_string" } |