Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
switch to YAML::Syck, its faster; modify readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Young committed Feb 13, 2013
1 parent bbe3b0d commit 435ef13
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
10 changes: 8 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Check this repository out somewhere in your development environment.

Either 'cp -a *' all files to your repositories '.git/hooks' directory or link them.

Comments and submissions welcome.

!!! PLEASE REVIEW setup !!!

This setup script works for me in my own development environment. Please, please double check it to make sure it works for you.

If you're happy with it, run it like so:

setup /path/to/top/level/git/repo
13 changes: 10 additions & 3 deletions handle_metadata
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ use warnings;
use Fcntl qw( :mode S_ISDIR );
use File::Spec ();
use File::stat; # overrides perl's stat and lstat
use File::Temp 'tempfile';
use File::Touch;
use Getopt::Long;
use IPC::Run3::Simple;
use Linux::Ext2::Attributes 'set_attrs';
use YAML;
use YAML::Syck;
use Unix::Mknod;

our $NOTE_NS = 'gitperms'; # What namespace are we using for notes?
Expand Down Expand Up @@ -47,11 +48,13 @@ if ( defined $save ) {

get_metadata_from_system();
set_note();
print "Done saving ...\n";

} elsif ( defined $set ) {

get_note();
set_metadata_in_system();
print "Done setting ...\n";

} else {

Expand Down Expand Up @@ -211,9 +214,13 @@ sub set_metadata_in_system { ## no critic qw( Subroutines::ProhibitExcessComplex

sub set_note {

my @cmd = ( qw( git notes --ref ), $NOTE_NS, qw( add HEAD -m ) );
my ( $fh, $filename ) = tempfile( unlink => 1 );

my ( $out, $err ) = run3( [ @cmd, Dump( \%metadata ) ] );
print $fh Dump( \%metadata );

my @cmd = ( qw( git notes --ref ), $NOTE_NS, qw( add HEAD -F ), $filename );

my ( $out, $err ) = run3( \@cmd );
! defined $quiet && warn "$out\n$err" if $err;

return;
Expand Down

0 comments on commit 435ef13

Please sign in to comment.