aboutsummaryrefslogtreecommitdiff
path: root/git/git-s
blob: faf55ffdcd8328df9aa275c9d6156f15d4aebd08 (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{"?"}; delete $x{" "}; delete $y{" "};
		for (["index" => \%x], ["tree" => \%y]) {
			($n, $h) = @$_;
			print "$n:" if values %$h;
			for (sort keys %$h) {
				print "	$_ ";
				print " $_" for @{$h->{$_}};
				print "\n";
			}
		}
	}
'