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

gitwalk clones local repositories #3

Open
aspiers opened this issue Sep 1, 2017 · 6 comments
Open

gitwalk clones local repositories #3

aspiers opened this issue Sep 1, 2017 · 6 comments

Comments

@aspiers
Copy link

aspiers commented Sep 1, 2017

The README says:

You can match repositories on your file system using glob. Note that gitwalk will clone the repository
even if it's stored locally on your computer. One can never be too careful.

Sorry, but I strongly disagree ;-) Firstly, I'd suggest that this is too careful:

  • For gitwalk processors which only read repos and don't write to them, there is zero risk.
  • The "original" repos (i.e. the ones which already existed on the local file system) are still git repos, so even if the changes by gitwalk were wrong, you can simply use normal git commands to revert them. That safety net is the whole point of git :-) And anyway, if the user is deliberately invoking changes on the repo then they are surely already aware of the risks. They could already do the same thing manually, one repo at a time.

If there were no downsides to being careful, I'd concede that OK, no harm done. But unfortunately this approach has several big disadvantages to the user experience:

  • For gitwalk processors which write to repos, this makes those processors highly inconvenient: the writes happen on the gitwalk-owned clones, so if you wanted the changes in your original repos, you'd then have to manually propagate the changes across. It would actually be less work to construct a shell for loop to work directly on the original repos, which defeats the point of gitwalk.
  • It's a needless waste of disk space, especially since gitwalk builds one clone per branch of each original repo.
  • The first time gitwalk runs on these local repos, it will be annoyingly slow due to this cloning.
  • For subsequent times gitwalk has to fetch updates from the original repos, which is also a loss in performance, and has another unfortunate side-effect:
  • If you run a processor which writes to the repos (e.g. via sed -i) and then another one which reads (e.g. grep) then the changes you just made vanish. This violates the Principle of Least Astonishment.

If I've misunderstood, please correct me. But otherwise please consider changing the design of this. Thanks!

@nnmrts
Copy link

nnmrts commented Oct 4, 2017

I have the same issues. Do you know any alternative for this? The creator of this wasn't active here for 2 years now. :/

@aspiers
Copy link
Author

aspiers commented Oct 4, 2017

Honestly I think the alternative is just to write a shell script with a for loop iterating over the repositories you need. Between this and #2 I came to the conclusion that this approach is somewhat over-engineered.

@pazdera
Copy link
Owner

pazdera commented Oct 4, 2017

Hi guys,

I'm sorry for my belated response.

I see your pain with this and agree -- it's inefficient for sure. Every time gitwalk runs, it force-updates the local branches to whatever's on origin. If someone's happy to add a config/CLI option that will skip this for local repos and process them in-situ, I'd be more than happy to accept it. Unfortunately, I'm not in a position to work on this myself at the moment :-/.

@aspiers You're right that if you have all the repos cloned already, a shell script works as well.

Radek

@aspiers
Copy link
Author

aspiers commented Oct 4, 2017

@pazdera No problem, thanks a lot for the reply and the clarification! :-)

@nnmrts
Copy link

nnmrts commented Oct 5, 2017

@pazdera Really no problem! Thanks for you answer! However, there is a fork of this repo, it would be great if it would be merged with this. It just updates dependencies, for example nodegit.

https://github.com/athombv/gitwalk

@pazdera
Copy link
Owner

pazdera commented Oct 5, 2017

@nnmrts Oh, I must have missed that! I'll look into it.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants