gitless-vcs / gitless

A simple version control system built on top of Git
https://gitless.com
MIT License
1.92k stars 106 forks source link

Remote is ahead but nothing shows in `gl status` #115

Open lehoff opened 7 years ago

lehoff commented 7 years ago
$ git status
Your branch is behind 'origin/master' by 12 commits, and can be fast-forwarded.
$ gl status
On branch master, repo-directory //

Tracked files with modifications:
  ➜ these will be automatically considered for commit
  ➜ use gl untrack f if you don't want to track changes to file f
  ➜ if file f was committed before, use gl checkout f to discard local changes

    There are no tracked files with modifications to list
...

I would have expected something in the gitless status output. What am I doing wrong?

lehoff commented 7 years ago

Not sure if it is related, but I tried to publish and was told that:

$ gl publish
! No dst branch specified, using upstream branch basho/remove-indirection-from-wm-common
✘ There are changes you need to fuse/merge

But also in this case gl status gave me nothing.

Then I tried to fuse the upstream branch. It started a fuse, but no files showed up as having conflicts in gitless, but in git they were showing.

It smells like it is related, but I cannot tell for sure.

spderosso commented 7 years ago

Regarding your original comment: You are not doing anything wrong. gl status doesn't currently tell you if your local branch is ahead/behind the remote branch. This is because in order to know whether your local branch is ahead/behind the remote branch we would have to make a request to the remote, and that would slow down gl status.

(Note that what git status is telling you there is that your branch is behind the "remote-tracking branch" origin/master, which is different from the remote branch.)

spderosso commented 7 years ago

Regarding your second comment:

This is unrelated to your original comment. If files show up as having conflicts in Git but not in Gitless then that is most likely a bug. If you can include the output you get from git status and the one you get from gl status that would help me figure out what's going on

lehoff commented 7 years ago

On the original comment: so with git I can see that I am behind the remote-tracking branch, which is nice, because then I know that I might have something to catch up on. How can I do that with gitless? I have just done a git fetch on a repo and it shows that my branch is behind the tracking branch, but gl status shows nothing.

If I have to fetch things with git instead of a gitless command so be it - that is not a problem. But if I cannot see that I have a potential fuse hanging around using a gitless command then it becomes a little weird.

I guess I am asking for a description of how to do fetch and that gl status shows if there is news on the remote tracking branch. Or is this outside the gitless model?

lehoff commented 7 years ago

Re the second comment: I tried to reproduce in a test repo, but I could not trigger it. The other repo is out of that state since it was a work thing that I had to do. I will create a new issue for that if the problem reappears.

spderosso commented 7 years ago

I agree that this is a nice feature to have, I'll look into it.

I just want to clarify that when git status says Your branch is behind 'origin/master' by 12 commits it doesn't mean what most people think: that in the remote origin the branch master has 12 commits that the local branch doesn't have. The branch master in the remote origin could be 12, 30, 40, or 5000 commits ahead, and you'll never really know until you do a fetch (docs). From your comments it seems that you understand what's going on, but many users would find this behavior puzzling. This is why in Gitless there is no concept of a remote-tracking branch (it's an implementation detail).

The accurate way of doing what you want in Gitless is to, every time the user executes gl status, do a request to the remote to see if there are new changes. I am going to run some tests and see if it's possible to do this without slowing down gl status too much. Thanks for your feedback

lehoff commented 7 years ago

This is a bit of a gotcha when you have worked a while with git.

With git I like to fetch from my remotes and then look at things before actually doing the merge. Might be a contrived use case, but I travel a lot and I like to do difficult merges on a plane. With gitless I would be forced to be online to be able to do a fuse.

I know that this might pollute the cleanness of the gitless model, but would there be a way to add a concept of syncing a remote? And then use that give input to gl status? Plus issue a warning if you are offline or you are out of sync with the remote?

It is not an easy thing to incorporate, but from where I stand right now it seems like something where the whole idea of hiding remote-tracking branches could be made more efficient. Perhaps adding to the output of gl remote to show the status of each remote.

I don't want remote-tracking branches to be visible (I like that idea), but it really seems like there is a concept around remotes that could be made and leveraged. If gitless did a fetch when a command like gl status was executed and printed "syncing with remote X due to current branch having an upstream branch in remote X" then it would become efficient to do a gl branch -r (it takes forever today).

If this is another enhancement let me know and I'll create the issue for it.