All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Moritz Baumann via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Luke Diamand <luke@diamand.org>, Moritz Baumann <moritz.baumann@sap.com>
Subject: [PATCH v2 0/2] git-p4: fix two undefined variables
Date: Wed, 20 Jul 2022 18:55:28 +0000	[thread overview]
Message-ID: <pull.1297.v2.git.git.1658343330.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1297.git.git.1658298900.gitgitgadget@gmail.com>

Moritz Baumann (2):
  git-p4: fix typo in P4Submit.applyCommit()
  git-p4: fix error handling in P4Unshelve.renameBranch()

 git-p4.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)


base-commit: bbea4dcf42b28eb7ce64a6306cdde875ae5d09ca
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1297%2Fmbs-c%2Ffix-undefined-variables-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1297/mbs-c/fix-undefined-variables-v2
Pull-Request: https://github.com/git/git/pull/1297

Range-diff vs v1:

 1:  1484eee8961 = 1:  1484eee8961 git-p4: fix typo in P4Submit.applyCommit()
 2:  69c9fd5fbec ! 2:  f7566dd5fc3 git-p4: fix error handling in P4Unshelve.renameBranch()
     @@ Metadata
       ## Commit message ##
          git-p4: fix error handling in P4Unshelve.renameBranch()
      
     -    The error handling code referenced a variable that does not exist.
     -    Also, the condition could never evaluate to True.
     +    The error handling code path is meant to be triggered when the loop does
     +    not exit early via "break". This fails, as the boolean variable "found",
     +    which is used to track whether the loop was exited early, is initialized
     +    incorrectly.
     +
     +    It would be possible to fix this issue by correcting the initialization,
     +    but Python supports a for:-else: control flow construct for this exact
     +    use case (executing code if a loop does not exit early), so it is more
     +    idiomatic to remove the tracking variable entirely.
     +
     +    In addition, the error message no longer refers to a variable that does
     +    not exist.
      
          Signed-off-by: Moritz Baumann <moritz.baumann@sap.com>
      

-- 
gitgitgadget

  parent reply	other threads:[~2022-07-20 18:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20  6:34 [PATCH 0/2] git-p4: fix two undefined variables Moritz Baumann via GitGitGadget
2022-07-20  6:34 ` [PATCH 1/2] git-p4: fix typo in P4Submit.applyCommit() Moritz Baumann via GitGitGadget
2022-07-20 16:09   ` Junio C Hamano
2022-07-20  6:34 ` [PATCH 2/2] git-p4: fix error handling in P4Unshelve.renameBranch() Moritz Baumann via GitGitGadget
2022-07-20 16:18   ` Junio C Hamano
2022-07-20 16:21     ` Junio C Hamano
2022-07-20 17:01       ` Baumann, Moritz
2022-07-20 18:55 ` Moritz Baumann via GitGitGadget [this message]
2022-07-20 18:55   ` [PATCH v2 1/2] git-p4: fix typo in P4Submit.applyCommit() Moritz Baumann via GitGitGadget
2022-07-20 18:55   ` [PATCH v2 2/2] git-p4: fix error handling in P4Unshelve.renameBranch() Moritz Baumann via GitGitGadget
2022-07-20 20:54   ` [PATCH v2 0/2] git-p4: fix two undefined variables Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1297.v2.git.git.1658343330.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=luke@diamand.org \
    --cc=moritz.baumann@sap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.