diff options
author | idl0r <idl0r@gentoo.org> | 2009-05-09 18:47:54 +0000 |
---|---|---|
committer | idl0r <idl0r@gentoo.org> | 2009-05-09 18:47:54 +0000 |
commit | 7fc2d82c74c2476310e4577cda8c9c567f437edb (patch) | |
tree | 7759c4b094acdf73103bdd6750ad117dffa4b39b | |
parent | Update category/package when creating the initial ChangeLog, thanks to Serkan... (diff) | |
download | gentoolkit-7fc2d82c74c2476310e4577cda8c9c567f437edb.tar.gz gentoolkit-7fc2d82c74c2476310e4577cda8c9c567f437edb.tar.bz2 gentoolkit-7fc2d82c74c2476310e4577cda8c9c567f437edb.zip |
Ignore .git dir when running echangelog in the repository root, fixes bug 199805 c8,c13. Improved git_unknown_objects(), git status parsing improved. Thanks to Andrew Gaffney <agaffney@gentoo.org> for testing etc.
svn path=/trunk/gentoolkit-dev/; revision=637
-rwxr-xr-x | src/echangelog/echangelog | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/src/echangelog/echangelog b/src/echangelog/echangelog index 4315acf..e288650 100755 --- a/src/echangelog/echangelog +++ b/src/echangelog/echangelog @@ -271,49 +271,44 @@ while (<C>) { my ($status, $filename) = ($1,$2); if($vcs eq "git") { - open P, "git rev-parse --sq --show-prefix |"; + open(P, '-|', "git rev-parse --sq --show-prefix"); my $prefix = <P>; - $prefix = substr($prefix, 0, -1); - close P; + close(P); - if ($filename =~ /$prefix(\S*)/) { - $filename = $1 ; - } - else { - next; + if (defined($prefix)) { + chomp($prefix); + + if ($filename =~ /$prefix(\S*)/) { + $filename = $1 ; + } + else { + next; + } } } - if( -d $filename ) { - next; - } + next if -d $filename; - push @files, $filename; + push(@files, $filename); ($actions{$filename} = $status) =~ tr/DARM/-+-/d; } } -# git only shows files already added so we need to check for unknown files -# separately here. -if($vcs eq "git") { - find(\&git_unknown_objects, "./"); -} - sub git_unknown_objects { my $object = $_; - my ($dev,$ino,$mode,$nlink,$uid,$gid); - # Ignore empty directories - git doesn't version them and cvs removes them. - if ( (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && ! -d _ ) { - open C, $vcs." status $_ 2>&1 1>/dev/null |"; + return if -d $object; + return if $File::Find::dir =~ m/^\.\/\.git\/?/; - while (<C>) { - $_ = <C>; - push @unknown, $object; - }; + open(C, '-|', "${vcs} status ${object} 2>&1 1>/dev/null"); + push(@unknown, $object) if defined(<C>); + close(C); +} - close C; - }; +# git only shows files already added so we need to check for unknown files +# separately here. +if($vcs eq "git") { + find(\&git_unknown_objects, "./"); } # Separate out the trivial files for now |