apply: check git diffs for missing old filenames
[git/git-svn.git] / perl / Git / IndexInfo.pm
bloba43108c985440db24688d7b053b94d428e6dd1bb
1 package Git::IndexInfo;
2 use strict;
3 use warnings;
4 use Git qw/command_input_pipe command_close_pipe/;
6 sub new {
7 my ($class) = @_;
8 my ($gui, $ctx) = command_input_pipe(qw/update-index -z --index-info/);
9 bless { gui => $gui, ctx => $ctx, nr => 0}, $class;
12 sub remove {
13 my ($self, $path) = @_;
14 if (print { $self->{gui} } '0 ', 0 x 40, "\t", $path, "\0") {
15 return ++$self->{nr};
17 undef;
20 sub update {
21 my ($self, $mode, $hash, $path) = @_;
22 if (print { $self->{gui} } $mode, ' ', $hash, "\t", $path, "\0") {
23 return ++$self->{nr};
25 undef;
28 sub DESTROY {
29 my ($self) = @_;
30 command_close_pipe($self->{gui}, $self->{ctx});