Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
04d59466
Commit
04d59466
authored
Aug 05, 2020
by
Andrew Hickman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Preserve behaviour of `git_mwindow_scan_recently_used` with `*out_window` set
parent
8ea9187a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
src/mwindow.c
+9
-2
No files found.
src/mwindow.c
View file @
04d59466
...
@@ -184,7 +184,8 @@ int git_mwindow_contains(git_mwindow *win, off64_t offset)
...
@@ -184,7 +184,8 @@ int git_mwindow_contains(git_mwindow *win, off64_t offset)
/*
/*
* Find the least- or most-recently-used window in a file that is not currently
* Find the least- or most-recently-used window in a file that is not currently
* being used. The 'only_unused' flag controls whether the caller requires the
* being used. The 'only_unused' flag controls whether the caller requires the
* file to only have unused windows.
* file to only have unused windows. If '*out_window' is non-null, it is used as
* a starting point for the comparison.
*
*
* Returns whether such a window was found in the file.
* Returns whether such a window was found in the file.
*/
*/
...
@@ -197,10 +198,15 @@ static bool git_mwindow_scan_recently_used(
...
@@ -197,10 +198,15 @@ static bool git_mwindow_scan_recently_used(
{
{
git_mwindow
*
w
,
*
w_last
;
git_mwindow
*
w
,
*
w_last
;
git_mwindow
*
lru_window
=
NULL
,
*
lru_last
=
NULL
;
git_mwindow
*
lru_window
=
NULL
,
*
lru_last
=
NULL
;
bool
found
=
false
;
assert
(
mwf
);
assert
(
mwf
);
assert
(
out_window
);
assert
(
out_window
);
lru_window
=
*
out_window
;
if
(
out_last
)
lru_last
=
*
out_last
;
for
(
w_last
=
NULL
,
w
=
mwf
->
windows
;
w
;
w_last
=
w
,
w
=
w
->
next
)
{
for
(
w_last
=
NULL
,
w
=
mwf
->
windows
;
w
;
w_last
=
w
,
w
=
w
->
next
)
{
if
(
w
->
inuse_cnt
)
{
if
(
w
->
inuse_cnt
)
{
if
(
only_unused
)
if
(
only_unused
)
...
@@ -219,10 +225,11 @@ static bool git_mwindow_scan_recently_used(
...
@@ -219,10 +225,11 @@ static bool git_mwindow_scan_recently_used(
(
comparison_sign
==
GIT_MWINDOW__MRU
&&
lru_window
->
last_used
<
w
->
last_used
))
{
(
comparison_sign
==
GIT_MWINDOW__MRU
&&
lru_window
->
last_used
<
w
->
last_used
))
{
lru_window
=
w
;
lru_window
=
w
;
lru_last
=
w_last
;
lru_last
=
w_last
;
found
=
true
;
}
}
}
}
if
(
!
lru_window
)
if
(
!
found
)
return
false
;
return
false
;
*
out_window
=
lru_window
;
*
out_window
=
lru_window
;
...
...
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