Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Always operates on first origin #67

Open
bartlibert opened this issue Sep 26, 2018 · 5 comments
Open

Always operates on first origin #67

bartlibert opened this issue Sep 26, 2018 · 5 comments
Assignees
Labels

Comments

@bartlibert
Copy link

bartlibert commented Sep 26, 2018

I have a repository setup with multiple subtrees. Because I added the origins of the subtrees (on gitlab) first and then pushed the new repository to gitlab, lab will operate on the first added remote instead of the real one called "origin".

Some information obfuscated for privacy reasons:

$ git remote -v build_tools git@gitlab.<hidden>/build_tools.git (fetch) build_tools git@gitlab.<hidden>/build_tools.git (push) common_libs git@gitlab.<hidden>/common_libs.git (fetch) common_libs git@gitlab.<hidden>/common_libs.git (push) origin git@gitlab.<hidden>/project.git (fetch) origin git@gitlab.<hiden>/project.git (push)
Any "lab" command will operate on the "build_tools" remote instead of the "origin" remote.

Also, if I remove the build_tools origin, lab will fail with "Not found gitlab remote repository", while there are still 2 remotes on gitlab left.

lab ver: v0.5.3 rev: 5d09e6d
git version 2.19.0

@lighttiger2505
Copy link
Owner

This is different from the assumed behavior.

I will investigate the possibility of a bug.

@lighttiger2505 lighttiger2505 self-assigned this Sep 29, 2018
@lighttiger2505
Copy link
Owner

I made the same repository as you and tested it.
However even if origin was deleted, lab properly referred to the remaining remote.
As we are referring to the remote I first found as logic, this is the expected behavior.

However, how to handle remote of git subtree is another problem, I have to think properly.

@bartlibert
Copy link
Author

I tried it again and I cannot reproduce the "deleted origin" part, very strange.

For the subtree, I realize it's not easy. Maybe a per-repo config for the remote to use?

@bartlibert
Copy link
Author

Is there some form of caching going on, because I changed the name of my remotes (prefixed with x_), so now the origin is the first one in the list of remotes, but lab still uses the original "first remote"?

@lighttiger2505
Copy link
Owner

No, lab dose not use caching when referring to git remote. Always run git remote command.

And if the repository has more than one remote of gitlab, we refer to the result of executing git remote from the above and target the remote found first.

lighttiger2505 added a commit that referenced this issue Oct 4, 2018
lighttiger2505 added a commit that referenced this issue Oct 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants