diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-11-30 12:12:34 -0500 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2022-11-30 12:14:20 -0500 |
commit | ebe4988fffbcb7d2af1303f3fdaa0af90f7c6033 (patch) | |
tree | 73ce59ea87b04a20853424c0d4405f9bd23fe0d2 | |
parent | 6e3e4ed98f7a5001eb14fb324b4ae6de812e2830 (diff) | |
download | b4-stable-0.10.y.tar.gz |
Fix crasher on handling renamed filesstable-0.10.y
Fix a small logical error when handling renamed files in preparation for
diff and 3-way.
Fixes: 10cabf05b0404f7a87522180750d003985211814 (Fix 'LoreSeries::make_fake_am_range' with renamed, then modified file)
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/b4/__init__.py b/b4/__init__.py index 16a1dc5..c0cea09 100644 --- a/b4/__init__.py +++ b/b4/__init__.py @@ -1519,7 +1519,8 @@ class LoreMessage: @staticmethod def get_indexes(diff: str) -> Set[tuple]: indexes = set() - curfile = None + oldfile = None + newfile = None for line in diff.split('\n'): if line.find('diff ') != 0 and line.find('index ') != 0: continue @@ -1529,7 +1530,7 @@ class LoreMessage: newfile = matches.groups()[1] continue matches = re.search(r'^index\s+([\da-f]+)\.\.[\da-f]+.*$', line) - if matches and oldfile is not None: + if matches and oldfile is not None and newfile is not None: indexes.add((oldfile, matches.groups()[0], newfile)) return indexes |