On 27 December 2011 20:47, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Sven Strickroth <sven.strickroth@xxxxxxxxxxxxxxx> writes: >> +sub askpass_prompt { >> + my ($self, $prompt) = _maybe_self(@_); >> + if (exists $ENV{'GIT_ASKPASS'}) { >> + return _askpass_prompt($ENV{'GIT_ASKPASS'}, $prompt); >> + } elsif (exists $ENV{'SSH_ASKPASS'}) { >> + return _askpass_prompt($ENV{'SSH_ASKPASS'}, $prompt); >> + } else { >> + return undef; > > Two problems with this if/elsif/else cascade. > > - If _askpass_prompt() fails to open the pipe to ENV{'GIT_ASKPASS'}, it > will return 'undef' to us. Don't we want to fall back to SSH_ASKPASS in > such a case? > > - The last "return undef" makes all callers of this method to implement a > fall-back way somehow. I find it very likely that they will want to use Not only that, "return undef" will have nasty side-effects if this subroutine is called in list-context -- it's usually discouraged to have explicit returns of "undef", where in scalar context that might be OK, but in list context, the caller will see: (undef) and not: () i.e., the empty list. -- Thomas Adam -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html