Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start with a fresh/empty repository #108

Closed
laurent-simon opened this issue Jul 7, 2020 · 4 comments
Closed

Unable to start with a fresh/empty repository #108

laurent-simon opened this issue Jul 7, 2020 · 4 comments
Assignees
Labels
Bug Bug that makes GitQlient unstable. It doesn't crash Solved This issues has been solved!
Milestone

Comments

@laurent-simon
Copy link

When you start with an empty repository ( git init and nothing else ), there is no way to add any file to it with GitQlient. The Untracked files list stays desperately empty (despite refreshes).

You have to go to the command line and use git add to add a first file (at least), then GitQlient becomes operational on the repository.

@laurent-simon laurent-simon changed the title Unable to start with a resh/empty repository Unable to start with a fresh/empty repository Jul 7, 2020
@francescmm francescmm self-assigned this Jul 8, 2020
@francescmm francescmm added the Bug Bug that makes GitQlient unstable. It doesn't crash label Jul 8, 2020
@francescmm francescmm added this to the v1.2.0 milestone Jul 8, 2020
@francescmm
Copy link
Owner

Hi @laurent-simon,

Thanks for reporting this! This is clearly a bug. I'll fix it as soon as possible and release a path version.

@fklappan
Copy link

fklappan commented Jul 8, 2020

Can confirm with updated develop branch.

Technical information
Should be an easy fix for you @francescmm

Take a look at

  • GitRequestorProcess.cpp at line 35
    If no output was captured, no history is being built. I simply removed the ba.size() part of the condition for testing, and it worked.

  • RevisionsCache.cpp at line 201
    If no parent SHA is provided, the file will not be added to the mRevisionsFileMap. I tried a simple fix with
    if (!sha1.isEmpty() && ( sha2.isEmpty() && mRevisionFilesMap.size() == 0)) { // probably the first item in history of the repo mRevisionFilesMap.insert(key, file); return true; }

I'm pretty sure both of them are not "clean" solutions, but I don't know the codebase good enough yet to contribute real code.

Happy coding 😄

@francescmm
Copy link
Owner

Hi @fklappan,

The first option would be better than the second one and I can actually explain why that worked so easily! 😄

It turns out that the problem is that no "work in progress" commit is added. The revisions/commits are added in the cache once the GitRequestorProcess emits the procDataReady signal. That drives to the GitRepoLoader::processRevision method and in there, all the revisions are added as well as the WIP commit (in the GitQlient slang).

I'm going to actually go for the first option. I actually thing it's a clean solution for the following reason: the signal should be triggered if the query went well. It's not a matter of GitRequestorProcess how much information the query reported. That should be handled by the GitRepoLoader::processRevision.

francescmm added a commit that referenced this issue Jul 8, 2020
Transferring the reponsability of evaluating the data to GitRepoLoader.
francescmm added a commit that referenced this issue Jul 8, 2020
Transferring the reponsability of evaluating the data to GitRepoLoader.
@francescmm francescmm added the Solved This issues has been solved! label Jul 8, 2020
@francescmm
Copy link
Owner

I've published a patch v1.1.1 with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug that makes GitQlient unstable. It doesn't crash Solved This issues has been solved!
Projects
None yet
Development

No branches or pull requests

3 participants