From 27ef9b5118152808d017e5ef81d28fbfd9448726 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Tue, 17 Aug 2021 17:35:04 -0700 Subject: [PATCH] Girocco/Util.pm: add get_git_chomp function Signed-off-by: Kyle J. McKay --- Girocco/Util.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Girocco/Util.pm b/Girocco/Util.pm index 5becd2f..0439960 100644 --- a/Girocco/Util.pm +++ b/Girocco/Util.pm @@ -30,7 +30,8 @@ BEGIN { is_shellish read_HEAD_ref git_add_config to_json json_bool from_json ref_indicator get_token_key get_timed_token get_token_field check_timed_token - valid_branch_name get_project_from_dir); + valid_branch_name get_project_from_dir + get_git_chomp); } BEGIN {require "Girocco/extra/capture_command.pl"} @@ -49,6 +50,14 @@ sub get_git { return get_cmd($Girocco::Config::git_bin, @_); } +# Same as get_git except that the result (if not undef) is chomp'd before +# returning it +sub get_git_chomp { + my $ans = get_git(@_); + defined($ans) and chomp $ans; + return $ans; +} + sub scrypt { my ($pwd) = @_; crypt($pwd||'', join ('', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64])); -- 2.11.4.GIT