[PATCH 2/4] git-cvsserver: simplify control flow in pserver authentication

Subsystems: the rest

DORMANTno replies

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH 2/4] git-cvsserver: simplify control flow in pserver authentication

From: Áshin László <hidden>
Date: 2016-06-15 22:49:04

 git-cvsserver.perl |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 9664e86..46e5fdb 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -225,18 +225,12 @@ if ($state->{method} eq 'pserver') {
        }

        # Fall through to LOVE
-    } else {
-        # Trying to authenticate a user
-        if (not exists $cfg->{gitcvs}->{authdb}) {
-            print "E the repo config file needs a [gitcvs] section
with an 'authdb' parameter set to the filename of the authentication
database\n";
-            print "I HATE YOU\n";
-            exit 1;
-        }
-
+    } elsif (exists $cfg->{gitcvs}->{authdb}) {
        my $authdb = $cfg->{gitcvs}->{authdb};

        unless (-e $authdb) {
-            print "E The authentication database specified in
[gitcvs.authdb] does not exist\n";
+            print "E The authentication database specified in ";
+            print "[gitcvs.authdb] does not exist\n";
            print "I HATE YOU\n";
            exit 1;
        }
@@ -258,6 +252,10 @@ if ($state->{method} eq 'pserver') {
        }

        # Fall through to LOVE
+    } else {
+        print "E Unable to find usable authentication method\n";
+        print "I HATE YOU\n";
+        exit 1;
    }

    # For checking whether the user is anonymous on commit
--
1.7.2.rc1.dirty

Re: [PATCH 2/4] git-cvsserver: simplify control flow in pserver authentication

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:49:04

Looks good. That code is somewhat contrived as-is.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help