Commit 43d15218 authored by Robert Ricci's avatar Robert Ricci

Automatically figure out HW and student from current branch

parent ea19ef8a
#!/usr/bin/perl -w
die "Usage: $0 <hw> <student>\n" unless (scalar(@ARGV) == 2);
die "Usage: $0 [<hw> <student>]\n" unless (scalar(@ARGV) == 2 ||
scalar(@ARGV) == 0);
my ($hw,$student) = @ARGV;
my ($hw,$student);
if (scalar(@ARGV)) {
($hw, $student) = @ARGV;
} else {
my $branch = `git rev-parse --abbrev-ref HEAD`;
chomp $branch;
if ($branch =~ /^(\w+)-graded-(\w+)$/) {
($hw, $student) = ($1, $2);
} else {
die "Unable to determine HW and student from branch name, use arguments\n";
}
}
system("git push $student $hw-graded-$student:$hw-graded");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment