From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 10558 invoked from network); 4 Nov 2021 22:41:07 -0000 Received: from 4ess.inri.net (216.126.196.42) by inbox.vuxu.org with ESMTPUTF8; 4 Nov 2021 22:41:07 -0000 Received: from mail-pl1-f175.google.com ([209.85.214.175]) by 4ess; Thu Nov 4 18:33:38 -0400 2021 Received: by mail-pl1-f175.google.com with SMTP id t21so9687009plr.6 for <9front@9front.org>; Thu, 04 Nov 2021 15:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:subject:message-id:mime-version:content-disposition; bh=POhnptxOVF9MxhqmEjKNY2xb0opS+uVfhvY0cQA90Wg=; b=BCeJ/o4N1SbpZNGOFKvCatY5SlgRPwkoBwszsngwIvTXQv41kKNobL4+JpVAi0LPg3 Sk48zDiBOlCp/vLh3eArzH5vHZhJIlHI8VKPCciMyoCrsOdea8ZlC+XoyVi73rgygZ/W kN6UQW6XkWqjRBJ/80B5LFqIEoWH69HriIVM2v9WZx13cBH/KL+k86gN1kRVv1Zb4zQT s+yqOHoWRa5kGwtQgEja7gjeiMp1e2zOr8c3lva+k3SIswH9N1CINr+E+wvbww4TtLgA DtMZYTPEUgP+mrxNiWv2MuUscs4Ax2u8/xai1BZbatFxWRcNLjtTi/3HqHzrneVAFJbZ UQ6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=POhnptxOVF9MxhqmEjKNY2xb0opS+uVfhvY0cQA90Wg=; b=b51HsfYBAyn/CMtSuPfAzT/4+LPkzVyK8TWoEb5qyceWZzr1Psxc8oL9P9WO3DBw19 S7II63SUhDDwXpxs/VwZbTovX0enIKVYAH0bEz2Llc/u3XHqcD+15Kk6WNjoG2Hh841J NkQPoWWB1XgOoqNSHDl3lQi3sOrn4TN3vcuyAzvp4uA3OanQMmn3smWOkY63agWigeWz szY10weWCkQKuA4zKjoMEQXvEXTZ5R/R1oCdLeDo9/F3GZEawq3xG15ej/p2tFFpSW8t NN5FlV9Bb4pqW1jh4tVzEhEc1qgKr1M9ym7CqYq93w+Jxzq2lreGi0fmY2sbq82R7D0E QY7A== X-Gm-Message-State: AOAM533llItA9bjgPkD80SszekM6vSCrwkQOh0XsYny3/yI49m8hfQqV vB5EqIBt+53RLp9j8yGlqCkRBimYqIc= X-Google-Smtp-Source: ABdhPJw6hPx1gGKG2/M/mBBLBARjNnSNuPLTZ11AK17JsyjKNVfRQuo5VB54QLwnwPQwzNW/AxPbjQ== X-Received: by 2002:a17:902:654b:b0:13d:c967:9cbd with SMTP id d11-20020a170902654b00b0013dc9679cbdmr47292492pln.88.1636065210601; Thu, 04 Nov 2021 15:33:30 -0700 (PDT) Return-Path: Received: from imac.0x30.net (d205-250-121-157.bchsia.telus.net. [205.250.121.157]) by smtp.gmail.com with ESMTPSA id u10sm5636432pfk.191.2021.11.04.15.33.29 for <9front@9front.org> (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 04 Nov 2021 15:33:29 -0700 (PDT) Date: Thu, 4 Nov 2021 15:33:28 -0700 From: Kyle Milz To: 9front@9front.org Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="git_args_checking.diff" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: advanced extension CMS shader Subject: [9front] git: consistent args checking Reply-To: 9front@9front.org Precedence: bulk hi, i audited the rc based git tools for similar bugs as the last. i found no more bugs but i wanted to make the error checking consistent for the tools that use a trivial number of args. args required: - git/add: > 1 - git/merge: 1 - git/push: 0 diff e2e4a46f26ff7268a696a45d82414fb992b648d5 uncommitted --- a/sys/src/cmd/git/add +++ b/sys/src/cmd/git/add @@ -5,7 +5,8 @@ gitup flagfmt='r:remove'; args='file ...' -eval `''{aux/getflags $*} || exec aux/usage +if(! eval `''{aux/getflags $*} || ~ $#* 0) + exec aux/usage add='tracked' del='removed' @@ -13,8 +14,6 @@ add='removed' del='tracked' } -if(~ $#* 0) - exec aux/usage paths=`$nl{cleanname -d $gitrel $* | drop $gitroot} if(~ $add tracked) --- a/sys/src/cmd/git/merge +++ b/sys/src/cmd/git/merge @@ -19,9 +19,7 @@ gitup flagfmt=''; args='theirs' -eval `''{aux/getflags $*} || exec aux/usage - -if(! ~ $#* 1) +if (! eval `''{aux/getflags $*} || ! ~ $#* 1) exec aux/usage theirs=`{git/query $1} --- a/sys/src/cmd/git/push +++ b/sys/src/cmd/git/push @@ -6,8 +6,7 @@ flagfmt='a:pushall, b:branch branch, f:force, d:debug, r:remove remove, u:upstream upstream' args='' -eval `''{aux/getflags $*} || exec aux/usage -if(! ~ $#* 0) +if (! eval `''{aux/getflags $*} || ! ~ $#* 0) exec aux/usage if(~ $pushall 1)