StreakyCobra / gws

Colorful KISS helper for git workspaces
https://streakycobra.github.io/gws/
MIT License
234 stars 22 forks source link

gws check does not detect git repo inside git repo #25

Closed oupala closed 7 years ago

oupala commented 7 years ago

As said in the title, gws check does not detect git repo inside git repo and hence cannot report them as Unknown.

StreakyCobra commented 7 years ago

Hi, sadly I don't have time to maintain this project anymore :disappointed: I've put right now a message at the top of the README about this. Hopefully someone will want to maintain it and fix this issue.

oupala commented 7 years ago

What a shame...

Do you know any alternative to gws?

StreakyCobra commented 7 years ago

During discussions on other threads online, people talked about a few alternatives that I remember:

oupala commented 7 years ago

@StreakyCobra I know you don't maintain gws any more.

But as far as I check the source code, what I found is not a bug but a desired feature, or at least a desired behaviour.

# Remove elements from a list that have as prefix another element of the same list
# Used to remove subrepositories, e.g. the list ( foo/bar/ foo/ ). The element
# foo/bar/ has for prefix foo/, so removing foo/bar because it is a subrepository
function remove_prefixed()

see https://github.com/StreakyCobra/gws/blob/a45c2da2ff1a00e8b8cc6116e9fb4cdd5cca533d/src/gws#L180-L183

Can you please just explain what did you added this behaviour?

And by the way, why did you choosed to not maintain gws any more? Don't you find it useful any more? Are you using something else? Have you quit using git?

StreakyCobra commented 7 years ago

Can you please just explain what did you added this behavior?

IIRC I did this to avoid git submodules being detected because my vim config makes a heavy use of them. I want my vim config repository being shown, but not the 85 git submodules that are inside, so I decided that only first-level git repositories should be used.

And by the way, why did you chosed to not maintain gws any more? Don't you find it useful any more? Are you using something else? Have you quit using git?

I'm still using git. I still feel the need of a workspace manager. I'm still using gws, but only the basic commands gws and gws ff, mainly because they work as-is with my current config. I would probably opt for another workspace manager if my needs evolve.

I stopped maintaining gws for the combination of 2 reasons: bash and time. I can still find a little bit of time to work on open-source projects, but not enough to deal with bash and the bug it introduces. This language is clearly not adapted for this kind of software. It has too many problems to deal with:

Also now that I have >100 repositories within my workspace, gws starts to be slow. The commands should be run in parallel, I feel it would be a nightmare to implement in bash, and this would require a refactoring on how output is shown anyway.

TL;DR I tried to implement a git workspace manager in bash, it is feasible but bash is clearly not the language to go, so I decided to stop wasting time on this direction.

oupala commented 7 years ago

Thanks for this clear answer.

I do understand why you added this git subrepo exclusion. You are using git submodule while I'm using nested submodules without using git submodule feature.

I also understand why you stopped maintaining gws. I'm however using it on a daily basis as it works perfectly for my needs. I may switch one day for another tool if my requirements change.

emlun commented 7 years ago

Hi @oupala! I'm the new maintainer. I'm wondering why you need gws check to detect nested repositories in the first place, as I'm unaware of a scenario where you'd even have any that are not submodules. Care to enlighten me?

oupala commented 7 years ago

Thanks @emlun for maintaining gws!

I'm using nested git repositories without using submodules because I'm working on a project that generates a static website. Each document that needs to be published in the website is in a separate git repository, and the integration is made by continuous integration, not git submodules.

Tell me if I don't give enough information with this comment. And tell what more you want to know.

In my opinion, there should be a specific flag to tell gws init if I want to detect subrepos or not. The best feature would be to not have a flag but to detect only subrepos that are not managed by git submodules.

emlun commented 7 years ago

Ok, I'll have a look at it and see if and how it seems reasonable to achieve.

emlun commented 7 years ago

@oupala I think this is now implemented on the detect-nested branch, does it work for you?

oupala commented 7 years ago

I tested the detect-nested branch and I cannot succeed to make it detected nested repository.

I have the following tree:

The only projects detected are project 1 and project 2.

nested sub-repo and submodule are not detected.

emlun commented 7 years ago

Ok, I'll have another look at it. Thanks!

emlun commented 7 years ago

I tested this again, and I can't make it not work.. :) I'll include this in release 0.1.11, coming up soon. Let me know then if it still doesn't work.

oupala commented 7 years ago

I tried it again.

It appears that nested submodule are detected, but submodules are not detected.

Is this the behavior you were waiting for?

oupala commented 7 years ago

And by the way, when I download gws 0.1.11, and I do gws -v on it, it tell me:

>./gws -v
gws version 0.1.10

I think you forgot to update version number.

emlun commented 7 years ago

It appears that nested submodule are detected, but submodules are not detected. Is this the behavior you were waiting for?

Yes, that is intended; although technically a probable effect of implementation details rather than a proper feature. gws check detects a .git directory, while submodules usually have a .git text file instead.

Anyway: I think it is more correct for gws to assume that submodules are not separate from their parent repository since they are after all explicitly linked to it, and git already provides utilities for interacting with them.

I think you forgot to update version number.

Oops, indeed I did! Thanks!

oupala commented 7 years ago

I totally agree with you, submodules are part of the main module while nested modules are just nested modules.

I'm now waiting for an official 0.1.11 or 0.1.12 release of gws so I can update my locale install.