Skip to content
Snippets Groups Projects
Commit 5a272f3d authored by Georges Racinet's avatar Georges Racinet :squid:
Browse files

Merged oldstable branch into stable

parents 520cac40 f59a8c2c
2 merge requests!88Merged stable branch into default for release,!87Merged stable branch into default for release
Pipeline #29610 failed
......@@ -14,4 +14,6 @@
# from `sha1-file.c` in Git 2.28 sources
# we're not dealing for now with the fact that there will be
# two kinds of OIDs with SHA-1 and SHA-256 soon.
# The Git tree object hash that corresponds to an empty tree (directory)
EMPTY_TREE_OID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
......@@ -17,4 +19,6 @@
EMPTY_TREE_OID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
# The Git blob object hash that corresponds to an empty blob (file)
EMPTY_BLOB_OID = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
OBJECT_MODE_LINK = 0o120000 # symlink to file or directory
......
......@@ -213,4 +213,5 @@
# For explicitness, let's instantiate a new BytesIO obj for each file
self.curr_diff.patch = BytesIO()
for diffhunk in iter_file_hunks:
self.curr_diff.patch.write(diffhunk)
if diffhunk.startswith(b'@@'):
......@@ -216,8 +217,7 @@
if diffhunk.startswith(b'@@'):
newdiffhunk = diffhunk.split(b'\n', 1)[-1]
lines = newdiffhunk.splitlines(True)
self.curr_diff.patch.write(diffhunk)
self.curr_diff.bytes_count += len(newdiffhunk)
diffhunk = diffhunk.split(b'\n', 1)[-1]
lines = diffhunk.splitlines(True)
self.curr_diff.bytes_count += len(diffhunk)
self.curr_diff.line_count += len(lines)
if self.limits.collapse_diffs:
......
# Copyright 2021 Georges Racinet <georges.racinet@octobus.net>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
#
# SPDX-License-Identifier: GPL-2.0-or-later
from hgitaly.service.diff import (
CurrDiff,
Limits,
Parser,
)
def test_parser_corner_cases():
parser = Parser(Limits(), CurrDiff())
parser.parse([b""])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment