Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
hgitaly
Commits
5a272f3d88a2
Commit
5a272f3d
authored
Nov 15, 2021
by
Georges Racinet on mutations.racinet.fr
Browse files
Merged oldstable branch into stable
parents
520cac404822
f59a8c2c121c
Pipeline
#29610
failed with stage
in 3 minutes and 17 seconds
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
hgitaly/git.py
View file @
5a272f3d
...
...
@@ -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
...
...
hgitaly/service/diff.py
View file @
5a272f3d
...
...
@@ -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
:
...
...
hgitaly/tests/test_diff.py
0 → 100644
View file @
5a272f3d
# 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
""
])
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment