Bug 413870 - Wrong git status determination
Summary: Wrong git status determination
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: plugins: git (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Sebastian Dörner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-06 09:14 UTC by Maciej Dems
Modified: 2019-11-10 21:18 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.11.80


Attachments
Patch fixing the reported issue (806 bytes, patch)
2019-11-06 09:14 UTC, Maciej Dems
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Dems 2019-11-06 09:14:59 UTC
Created attachment 123747 [details]
Patch fixing the reported issue

Sometimes, for large repositories the status is messed up (which in unlucky case cases `Commit..` command to disappear).

The reason tho this is that `FileViewGitPlugin::beginRetrieval` method cannot correctly parse the `git status` output. The reason for this is that `FileViewGitPlugin::readUntilZeroChar` does not return complete entry, because it is not provided fast enough.

I have made a patch that fixes this issue (see attachment). The idea is to allow the `FileViewGitPlugin::readUntilZeroChar` to wait for the remaining data.
Comment 1 Elvis Angelaccio 2019-11-06 22:00:16 UTC
Do you mind uploading the patch on phabricator? See https://community.kde.org/Infrastructure/Phabricator for instructions.
Comment 2 Elvis Angelaccio 2019-11-10 21:18:39 UTC
Git commit 2cf2d4d02912dd6e285350b30f00f24eb092ad9c by Elvis Angelaccio, on behalf of Maciej Dems.
Committed on 10/11/2019 at 21:16.
Pushed by elvisangelaccio into branch 'release/19.12'.

Fixed git status retrieval splitting entries

Summary:

Sometimes, for large repositories the status is messed up (which in unlucky case causes `Commit..` command to disappear).

The reason for this is that `FileViewGitPlugin::beginRetrieval` method cannot correctly parse the `git status` output. The reason for this is that `FileViewGitPlugin::readUntilZeroChar` does not return complete entry, because it is not provided fast enough.

The idea of this patch is to allow the `FileViewGitPlugin::readUntilZeroChar` to wait for the remaining data.

Test Plan:
The bug depends on the race condition between the plugin code and executed `git` code. Hence it is hard to test. To fake the issue make fake git process that pauses mid entry. In such case the loop in `FileViewGitPlugin::beginRetrieval` should parse eg:

    !! ABCDEFGH\0x00

Instead it gets:

    !! AB\0x00
    CDEFGH\0x00

which results in two entries for non-existent files.

The patch solves this issue.
FIXED-IN: 19.11.80

Reviewers: elvisangelaccio

Reviewed By: elvisangelaccio

Differential Revision: https://phabricator.kde.org/D25187

M  +7    -2    git/fileviewgitplugin.cpp

https://commits.kde.org/dolphin-plugins/2cf2d4d02912dd6e285350b30f00f24eb092ad9c