change git structure
This commit is contained in:
parent
8263bd2911
commit
93e740956e
2
controls_GardenaSmartDevice.txt
Normal file
2
controls_GardenaSmartDevice.txt
Normal file
@ -0,0 +1,2 @@
|
||||
UPD 2021-03-09_08:45:53 42674 FHEM/73_GardenaSmartBridge.pm
|
||||
UPD 2020-05-01_22:05:14 45622 FHEM/74_GardenaSmartDevice.pm
|
40
hooks/pre-commit
Executable file
40
hooks/pre-commit
Executable file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use File::Basename;
|
||||
use POSIX qw(strftime);
|
||||
use strict;
|
||||
|
||||
my @filenames = (
|
||||
'FHEM/73_GardenaSmartBridge.pm',
|
||||
'FHEM/74_GardenaSmartDevice.pm',
|
||||
);
|
||||
|
||||
my $controlsfile = 'controls_GardenaSmartDevice.txt';
|
||||
|
||||
open(FH, ">$controlsfile") || return("Can't open $controlsfile: $!");
|
||||
|
||||
for my $filename (@filenames) {
|
||||
my @statOutput = stat($filename);
|
||||
|
||||
if (scalar @statOutput != 13) {
|
||||
printf 'error: stat has unexpected return value for ' . $filename . "\n";
|
||||
next;
|
||||
}
|
||||
|
||||
my $mtime = $statOutput[9];
|
||||
my $date = POSIX::strftime("%Y-%m-%d", localtime($mtime));
|
||||
my $time = POSIX::strftime("%H:%M:%S", localtime($mtime));
|
||||
my $filetime = $date."_".$time;
|
||||
|
||||
my $filesize = $statOutput[7];
|
||||
|
||||
printf FH 'UPD ' . $filetime . ' ' . $filesize . ' ' .$filename . "\n";
|
||||
}
|
||||
|
||||
close(FH);
|
||||
|
||||
system("git add $controlsfile");
|
||||
|
||||
print 'Create controls File succesfully' . "\n";
|
||||
|
||||
exit 0;
|
Loading…
x
Reference in New Issue
Block a user