git: add git-st script
This commit is contained in:
parent
c2023b81ac
commit
3c12e2f746
2 changed files with 37 additions and 1 deletions
bin
31
bin/git-st
Executable file
31
bin/git-st
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
git branchless smartlog || true
|
||||
printf '\n'
|
||||
|
||||
awk -vOFS='' '
|
||||
NR==FNR {
|
||||
all[i++] = $0;
|
||||
difffiles[$1] = $0;
|
||||
next;
|
||||
}
|
||||
! ($2 in difffiles) {
|
||||
print; next;
|
||||
}
|
||||
{
|
||||
gsub($2, difffiles[$2]);
|
||||
print;
|
||||
}
|
||||
END {
|
||||
if (NR != FNR) {
|
||||
# Had diff output
|
||||
exit;
|
||||
}
|
||||
# Had no diff output, just print lines from git status -sb
|
||||
for (i in all) {
|
||||
print all[i];
|
||||
}
|
||||
}
|
||||
' \
|
||||
<(git diff --color --stat=$(($(tput cols) - 3)) HEAD | sed '$d; s/^ //')\
|
||||
<(git -c color.status=always status -sb)
|
Loading…
Add table
Add a link
Reference in a new issue