git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 0/2] git-p4: fix two undefined variables

From
MGMoritz Baumann via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 20, 2022, 18:55 UTC
Message-ID
<pull.1297.v2.git.git.1658343330.gitgitgadget@gmail.com>
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
Previous: Baumann, MoritzNext: Moritz Baumann via GitGitGadget
Message 8 of 11 in “git-p4: fix two undefined variables”
  1. 0/2 git-p4: fix two undefined variablesMoritz Baumann via GitGitGadget, Jul 20, 2022
  2. 1/2 git-p4: fix typo in P4Submit.applyCommit()Moritz Baumann via GitGitGadget, Jul 20, 2022
  3. Junio C HamanoJul 20, 2022
  4. 2/2 git-p4: fix error handling in P4Unshelve.renameBranch()Moritz Baumann via GitGitGadget, Jul 20, 2022
  5. Junio C HamanoJul 20, 2022
  6. Junio C HamanoJul 20, 2022
  7. Baumann, MoritzJul 20, 2022
  8. 0/2 git-p4: fix two undefined variablesMoritz Baumann via GitGitGadget, Jul 20, 2022
  9. 1/2 git-p4: fix typo in P4Submit.applyCommit()Moritz Baumann via GitGitGadget, Jul 20, 2022
  10. 2/2 git-p4: fix error handling in P4Unshelve.renameBranch()Moritz Baumann via GitGitGadget, Jul 20, 2022
  11. Junio C HamanoJul 20, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.