Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
hgitaly
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
heptapod
hgitaly
Commits
5a272f3d
Commit
5a272f3d
authored
3 years ago
by
Georges Racinet
Browse files
Options
Downloads
Plain Diff
Merged oldstable branch into stable
parents
520cac40
f59a8c2c
Loading
Loading
2 merge requests
!88
Merged stable branch into default for release
,
!87
Merged stable branch into default for release
Pipeline
#29610
failed
3 years ago
Stage: main
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hgitaly/git.py
+4
-0
4 additions, 0 deletions
hgitaly/git.py
hgitaly/service/diff.py
+4
-4
4 additions, 4 deletions
hgitaly/service/diff.py
hgitaly/tests/test_diff.py
+17
-0
17 additions, 0 deletions
hgitaly/tests/test_diff.py
with
25 additions
and
4 deletions
hgitaly/git.py
+
4
−
0
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
...
...
This diff is collapsed.
Click to expand it.
hgitaly/service/diff.py
+
4
−
4
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
:
...
...
This diff is collapsed.
Click to expand it.
hgitaly/tests/test_diff.py
0 → 100644
+
17
−
0
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
""
])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment