From: b Date: Thu, 28 Sep 2023 21:45:26 +0000 (+0200) Subject: add tree, rename name, change push X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;p=cresnov%2Fimagimoth-tracker add tree, rename name, change push --- diff --git a/moth.pl b/moth.pl index 7ffec15..b427e76 100755 --- a/moth.pl +++ b/moth.pl @@ -84,7 +84,7 @@ elsif ($action eq 'rename') { goto_branch($new_name); remove_branch($old_name); } -elsif ($action eq 'addname') { +elsif ($action eq 'name') { if ((scalar @ARGV) < 3) { print STDERR "Name(s) missing.\n"; exit 1; @@ -105,6 +105,16 @@ elsif ($action eq 'goto') { goto_tree(); goto_branch($name); } +elsif ($action eq 'tree') { + if ((scalar @ARGV) < 2) { + print STDERR "Name missing.\n"; + exit 1; + } + my $name = $ARGV[1]; + goto_tree(); + goto_branch($name); + show_tree(); +} elsif ($action eq 'rm') { if ((scalar @ARGV) < 2) { print STDERR "Name missing.\n"; @@ -348,7 +358,7 @@ sub push_out { } $r = system_encoded(GIT(), ( - GIT(), 'push', '--all', '--force' + GIT(), 'push', '--mirror' )); if ($r != 0) { print STDERR "Git push fail.\n"; @@ -362,4 +372,14 @@ sub push_out { print STDERR "Git remote remove fail.\n"; exit 1; } -} \ No newline at end of file +} + +sub show_tree { + my $r = system_encoded(GIT(), ( + GIT(), 'log', '--graph', '--oneline', + )); + if ($r != 0) { + print STDERR "Git log fail.\n"; + exit 1; + } +}