Permalink
Browse files

changed missing note handling--it seems you cant prompt for input in …

…a git hook
  • Loading branch information...
1 parent 2af7b87 commit ed25fcfaf9f7383891201832b673606e8ce2cdad @harleypig committed Apr 5, 2013
Showing with 16 additions and 20 deletions.
  1. +16 −20 handle_metadata
View
@@ -86,13 +86,7 @@ if ( defined $save ) {
set_metadata_in_system();
print "Done setting ...\n";
- } else {
-
- # note did not exist
- print "Done saving ...\n";
-
}
-
} else {
die "Unknown and unhandled error! How'd you get here?\n";
@@ -290,36 +284,38 @@ sub get_note {
if ( $err =~ /No note found for object/ ) {
- my $create_note = 0;
-
if ( defined $create_on_missing ) {
- $create_note = 1;
+ get_metadata_from_system();
+ set_note();
+ print "Missing note created.\n";
+ return;
} else {
- print "This commit does not have a note associated with it. Do you want to create one now? (Yn) ";
+ print <<EOT
- ReadMode 'cbreak';
- my $r;
- do { 0 } while ! defined( $r = ReadKey( -1 ) );
- ReadMode 'restore';
+ !!! This commit does not have a note associated with it. !!!
- $create_note = ( $r =~ /^[y\n]$/i ) ? 1 : 0;
+ Your git action has successfully completed, but no permissions have
+ been set.
- }
+ To create a note for this commit, run the following command from the
+ top level of your git repository:
- if ( $create_note ) {
+ .git/hooks/handle_metadata --save
- get_metadata_from_system();
- set_note();
- return;
+ If you wish this to happen automatically, edit the
+ .git/hooks/post-commit file and add the '--create-on-missing' option.
+
+EOT
}
} else {
warn $err if $err;
+ return;
}

0 comments on commit ed25fcf

Please sign in to comment.