]>
git.proxmox.com Git - pmg-api.git/blob - repoid.pl
3 # use use the first 8 characters from the master commit ID
5 # git status --porcelain
9 use PVE
::Tools
qw(run_command);
12 die "no repository" if !$gitdir;
14 my $path = "$gitdir/refs/heads/master";
15 die "master branch does not exists" if ! -f
$path;
20 die "unknown parameter '$arg1'" if $arg1 ne 'check';
24 return if $line =~ m/^#/;
25 return if $line =~ m/^\?\?/;
27 die "detected modified content: $line\n";
30 my $cmd = ['git', '--git-dir', $gitdir ,'status', '--porcelain'];
31 run_command
($cmd, outfunc
=> $testfunc);
34 my $repoid = `cat $path`;
37 die "invalid commit format" if $repoid !~ m/^[0-9a-f]{40}$/;
39 my $res = substr $repoid, 0, 8;