-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Git::IndexInfo into its own file.
Straight cut & paste. Didn't require any fixing. Signed-off-by: Eric Wong <normalperson@yhbt.net>
- Loading branch information
Michael G. Schwern
authored and
Eric Wong
committed
Jul 27, 2012
1 parent
e96cdba
commit 10c2aa5
Showing
5 changed files
with
37 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package Git::IndexInfo; | ||
use strict; | ||
use warnings; | ||
use Git qw/command_input_pipe command_close_pipe/; | ||
|
||
sub new { | ||
my ($class) = @_; | ||
my ($gui, $ctx) = command_input_pipe(qw/update-index -z --index-info/); | ||
bless { gui => $gui, ctx => $ctx, nr => 0}, $class; | ||
} | ||
|
||
sub remove { | ||
my ($self, $path) = @_; | ||
if (print { $self->{gui} } '0 ', 0 x 40, "\t", $path, "\0") { | ||
return ++$self->{nr}; | ||
} | ||
undef; | ||
} | ||
|
||
sub update { | ||
my ($self, $mode, $hash, $path) = @_; | ||
if (print { $self->{gui} } $mode, ' ', $hash, "\t", $path, "\0") { | ||
return ++$self->{nr}; | ||
} | ||
undef; | ||
} | ||
|
||
sub DESTROY { | ||
my ($self) = @_; | ||
command_close_pipe($self->{gui}, $self->{ctx}); | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters