git-p4: fix two undefined variables
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 1 replyIn review
- v12 patches 4 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | git-p4: fix typo in P4Submit.applyCommit()git-p4.py | +1 | 0 replies | |
| 2/2 | git-p4: fix error handling in P4Unshelve.renameBranch()git-p4.py | +2 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [PATCH v2 0/2] git-p4: fix two undefined variables
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.
Signature · 1 line
gitgitgadget