aboutsummaryrefslogtreecommitdiff
path: root/git-s
blob: cc560d99fbf23c5f92d8ee07cd196d59faa08e8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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";
			}
		}
	}
'