@@ -104,8 +104,8 @@ void GitRevwalk::FileHistoryWalkWorker::Execute()
104104 }
105105
106106 const git_diff_delta *delta = git_patch_get_delta (nextPatch);
107- bool isEqualOldFile = !strcmp (delta->old_file .path , baton->file_path );
108- bool isEqualNewFile = !strcmp (delta->new_file .path , baton->file_path );
107+ bool isEqualOldFile = !strncmp (delta->old_file .path , baton->file_path , strlen (baton-> file_path ) );
108+ bool isEqualNewFile = !strncmp (delta->new_file .path , baton->file_path , strlen (baton-> file_path ) );
109109
110110 if (isEqualNewFile) {
111111 if (delta->status == GIT_DELTA_ADDED || delta->status == GIT_DELTA_DELETED ) {
@@ -173,8 +173,8 @@ void GitRevwalk::FileHistoryWalkWorker::Execute()
173173 }
174174
175175 const git_diff_delta *delta = git_patch_get_delta (nextPatch);
176- bool isEqualOldFile = !strcmp (delta->old_file .path , baton->file_path );
177- bool isEqualNewFile = !strcmp (delta->new_file .path , baton->file_path );
176+ bool isEqualOldFile = !strncmp (delta->old_file .path , baton->file_path , strlen (baton-> file_path ) );
177+ bool isEqualNewFile = !strncmp (delta->new_file .path , baton->file_path , strlen (baton-> file_path ) );
178178 int oldLen = strlen (delta->old_file .path );
179179 int newLen = strlen (delta->new_file .path );
180180 char *outPair = new char [oldLen + newLen + 2 ];
@@ -185,7 +185,7 @@ void GitRevwalk::FileHistoryWalkWorker::Execute()
185185
186186 if (isEqualNewFile) {
187187 std::pair<git_commit *, std::pair<char *, git_delta_t > > *historyEntry;
188- if (!isEqualOldFile) {
188+ if (!isEqualOldFile || delta -> status == GIT_DELTA_RENAMED ) {
189189 historyEntry = new std::pair<git_commit *, std::pair<char *, git_delta_t > >(
190190 nextCommit,
191191 std::pair<char *, git_delta_t >(strdup (outPair), delta->status )
0 commit comments