Permalink
Browse files

git-dig: some minor fixups...

mainly about files with spaces in the names
  • Loading branch information...
1 parent 29c88e7 commit 6d418796a013e7238c3e23c7f3b9b7c53045a60a @sitaramc committed Feb 28, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 git-dig
View
@@ -73,8 +73,9 @@ my ( $blob, $name );
my %name;
my %size;
while (<$objects>) {
+ chomp;
next unless / ./; # no commits or top level trees
- ( $blob, $name ) = split; # TODO test with filenames containing spaces also
+ ( $blob, $name ) = split( ' ', $_, 2 ); # TODO test with filenames containing spaces also
next unless $name =~ /$path_match/;
$name{$blob} = $name;
say $blobfile $blob;
@@ -114,14 +115,16 @@ for my $name (@names_by_size) {
# IOW, doing it this way lets 'git dig -cs -- --not --all' shows you
# *only* those files that are in the stash (or reflog if you used -crl)
+ my @args1 = qw(--no-pager log -1 --diff-filter=MARC);
+ my @args2 = qw(--not --branches --remotes --tags);
for my $r (@refs) {
- system("git --no-pager log -1 --format='%x09%h%x09%x09%ar%x09$r' $r -- $name");
+ system("git", @args1, "--format=%x09%h%x09%x09%ar%x09$r", $r, "--", $name);
}
for my $r (@stash_shas) {
- system("git --no-pager log -1 --format='%x09%h%x09%x09%ar%x09$r' $r --not --branches --remotes --tags -- $name");
+ system("git", @args1, "--format=%x09%h%x09%x09%ar%x09$r", $r, @args2, "--", $name);
}
for my $r (@reflog_shas) {
- system( "git --no-pager log -1 --format='%x09%h%x09%x09%ar%x09$r' $r --not --branches --remotes --tags " . join( " ", @stash_shas ) . " -- $name" );
+ system("git", @args1, "--format=%x09%h%x09%x09%ar%x09$r", $r, @args2, @stash_shas, "--", $name);
}
print "\n";

0 comments on commit 6d41879

Please sign in to comment.