-
Notifications
You must be signed in to change notification settings - Fork 272
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
Add information about usage with nested subrepos #630
Open
abeforgit
wants to merge
6
commits into
ingydotnet:master
Choose a base branch
from
abeforgit:docs/add-info-about-nested-subrepos
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
127e133
Add information about usage with nested subrepos
abeforgit 4258e36
Remove overly aggressive note
abeforgit dbd8e45
Remove redundant remark about agnosticism
abeforgit 2e4a608
Remove unnecessary "simple"
abeforgit 89bb7ea
Remove another "simple"
abeforgit 46dc432
Change "your" to "a"
abeforgit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -599,6 +599,73 @@ If you want to chat about the `git-subrepo` command, join `#gitcommands` on | |
* Written in (very modern) Bash, with full test suite. Take a look. | ||
* A `.gitrepo` file never is in the top level dir (next to a `.git/` dir). | ||
|
||
= Working with nested subrepos | ||
|
||
`git-subrepo` supports adding subrepos which themselves make use of | ||
subrepos. In fact, subrepo itself is built this way. Take a look in the | ||
`ext/` folder, it houses 2 dependencies as subrepos, `test-more-bash` and | ||
`bashplus`. | ||
|
||
`test-more-bash` itself depends on 2 more subrepos: `bashplus` again, and | ||
`test-tap-bash`. | ||
|
||
The structure is therefore as follows: | ||
|
||
git-subrepo | ||
|- bashplus | ||
|- test-more-bash | ||
|- bashplus | ||
|- test-tap-bash | ||
|
||
However, it's important to understand how this works. Here's the key idea: | ||
there is *no* special handling for nested subrepos. | ||
|
||
When you clone a subrepo, *all* `git-subrepo` does is download the code | ||
and set up the subrepo file. | ||
This means that all the subrepo commands simply act on the subrepo as a whole, | ||
treating nested subrepos like any other part of the source code. | ||
|
||
Let's look at what this means in practice. Say you have a structure as follows: | ||
|
||
app-foo | ||
|- barlib | ||
|- bazlib | ||
|
||
You're working on app-foo, and make some changes to bazlib. How should you | ||
upstream these changes? | ||
|
||
Well, first you must realize that from the perspective of app-foo, you've simply | ||
made some changes to barlib. Whether or not those changes were themselves in a | ||
subrepo is irrelevant. So, just like any other changes, you run | ||
|
||
`git subrepo push barlib` | ||
|
||
Now, if `barlib` is a library you don't maintain, your responsibility would end | ||
admorgan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
here. `barlib`'s maintainer would see your changes and decide what to do with | ||
them. | ||
|
||
If you do maintain `barlib`, you might now want to upstream the changes all the | ||
way into `bazlib`. You could be tempted to try running something like: | ||
|
||
`git subrepo push barlib/bazlib` | ||
|
||
but you'll soon find out that doesn't work. | ||
`app-foo` doesn't know anything about the link between `barlib` and `bazlib`. | ||
|
||
What you should do is treat the changes to `barlib` as if they would come from | ||
another contributor, aka: | ||
|
||
* go to a local copy of `barlib` | ||
* pull down the changes with a `git pull` | ||
* you notice the changes include some work on your subrepo, time to upstream | ||
them: | ||
`git subrepo push bazlib` | ||
|
||
And you're done! One final step you'll likely want to do is to go back to | ||
admorgan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
`app-foo` and run `git subrepo pull barlib`, because the push you just did added | ||
a new commit. | ||
|
||
|
||
= Authors | ||
|
||
* Ingy döt Net <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to avoid using phrases such as "first you must realize". Even if it is true the fact that they are reading the documentation means that the documentation will educate them to the level they will realized these facts when they are done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see being addressed in the commits on this PR.