From 5d4777313eed7a4c777fea2bd316ff233fb59af1 Mon Sep 17 00:00:00 2001 From: John Ankarstrom Date: Fri, 2 Jul 2021 15:18:34 +0200 Subject: Add 'git-s' utility --- git-s | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 git-s diff --git a/git-s b/git-s new file mode 100755 index 0000000..cc560d9 --- /dev/null +++ b/git-s @@ -0,0 +1,20 @@ +#!/bin/sh + +# git-s -- selection-friendly git-status + +git status -s | perl -ne ' + push @{$x{$1}}, $2 if /^(.). (.*)/; + push @{$y{$1}}, $2 if /^.(.) (.*)/; + END { + delete $x{"?"}; + for ([">" => \%x], ["." => \%y]) { + ($n, $h) = @$_; + for (sort keys %$h) { + next if $_ eq " "; + print "$n$_"; + print " $_" for @{$h->{$_}}; + print "\n"; + } + } + } +' -- cgit v1.2.3