Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nodegit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xielei
nodegit
Commits
f4cd5777
Commit
f4cd5777
authored
Feb 05, 2016
by
Tyler Wanek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hot fix historywalk
was dropping deleted events due to rename detection.
parent
743c2a47
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
generate/templates/manual/revwalk/file_history_walk.cc
generate/templates/manual/revwalk/file_history_walk.cc
+9
-1
lib/revwalk.js
lib/revwalk.js
+1
-1
test/tests/revwalk.js
test/tests/revwalk.js
+14
-1
No files found.
generate/templates/manual/revwalk/file_history_walk.cc
View file @
f4cd5777
...
...
@@ -164,6 +164,14 @@ void GitRevwalk::FileHistoryWalkWorker::Execute()
}
baton
->
out
->
push_back
(
historyEntry
);
flag
=
true
;
}
else
if
(
isEqualOldFile
)
{
std
::
pair
<
git_commit
*
,
std
::
pair
<
char
*
,
git_delta_t
>
>
*
historyEntry
;
historyEntry
=
new
std
::
pair
<
git_commit
*
,
std
::
pair
<
char
*
,
git_delta_t
>
>
(
nextCommit
,
std
::
pair
<
char
*
,
git_delta_t
>
(
strdup
(
delta
->
new_file
.
path
),
delta
->
status
)
);
baton
->
out
->
push_back
(
historyEntry
);
flag
=
true
;
}
git_patch_free
(
nextPatch
);
...
...
@@ -220,7 +228,7 @@ void GitRevwalk::FileHistoryWalkWorker::HandleOKCallback()
Nan
::
Set
(
historyEntry
,
Nan
::
New
(
"commit"
).
ToLocalChecked
(),
GitCommit
::
New
(
batonResult
->
first
,
true
));
Nan
::
Set
(
historyEntry
,
Nan
::
New
(
"status"
).
ToLocalChecked
(),
Nan
::
New
<
Number
>
(
batonResult
->
second
.
second
));
if
(
batonResult
->
second
.
second
==
GIT_DELTA_RENAMED
)
{
Nan
::
Set
(
historyEntry
,
Nan
::
New
(
"
oldN
ame"
).
ToLocalChecked
(),
Nan
::
New
(
batonResult
->
second
.
first
).
ToLocalChecked
());
Nan
::
Set
(
historyEntry
,
Nan
::
New
(
"
altn
ame"
).
ToLocalChecked
(),
Nan
::
New
(
batonResult
->
second
.
first
).
ToLocalChecked
());
}
Nan
::
Set
(
result
,
Nan
::
New
<
Number
>
(
i
),
historyEntry
);
...
...
lib/revwalk.js
View file @
f4cd5777
...
...
@@ -129,7 +129,7 @@ Revwalk.prototype.getCommits = function(count) {
* @type {Object}
* @property {Commit} commit the commit for this entry
* @property {Number} status the status of the file in the commit
* @property {String}
oldName the old
name that is provided when status is
* @property {String}
altname the other
name that is provided when status is
* renamed
*/
...
...
test/tests/revwalk.js
View file @
f4cd5777
...
...
@@ -235,6 +235,8 @@ describe("Revwalk", function() {
var
repoPath
=
local
(
"
../repos/renamedFileRepo
"
);
var
signature
=
NodeGit
.
Signature
.
create
(
"
Foo bar
"
,
"
foo@bar.com
"
,
123456789
,
60
);
var
headCommit
;
return
RepoUtils
.
createRepository
(
repoPath
)
.
then
(
function
(
r
)
{
repo
=
r
;
...
...
@@ -276,6 +278,7 @@ describe("Revwalk", function() {
return
NodeGit
.
Reference
.
nameToId
(
repo
,
"
HEAD
"
);
})
.
then
(
function
(
commitOid
)
{
headCommit
=
commitOid
.
tostrS
();
var
walker
=
repo
.
createRevWalk
();
walker
.
sorting
(
NodeGit
.
Revwalk
.
SORT
.
TIME
);
walker
.
push
(
commitOid
.
tostrS
());
...
...
@@ -283,7 +286,17 @@ describe("Revwalk", function() {
})
.
then
(
function
(
results
)
{
assert
.
equal
(
results
[
0
].
status
,
NodeGit
.
Diff
.
DELTA
.
RENAMED
);
assert
.
equal
(
results
[
0
].
oldName
,
fileNameA
);
assert
.
equal
(
results
[
0
].
altname
,
fileNameA
);
})
.
then
(
function
()
{
var
walker
=
repo
.
createRevWalk
();
walker
.
sorting
(
NodeGit
.
Revwalk
.
SORT
.
TIME
);
walker
.
push
(
headCommit
);
return
walker
.
fileHistoryWalk
(
fileNameA
,
5
);
})
.
then
(
function
(
results
)
{
assert
.
equal
(
results
[
0
].
status
,
NodeGit
.
Diff
.
DELTA
.
RENAMED
);
assert
.
equal
(
results
[
0
].
altname
,
fileNameB
);
})
.
then
(
function
()
{
return
fse
.
remove
(
repoPath
);
...
...
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