-
Couldn't load subscription status.
- Fork 282
Add support --branch together with --all mentioned in #253 #552
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
base: release/0.4.5
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,17 +157,13 @@ main() { | |
| command-init | ||
|
|
||
| if $all_wanted && [[ ! $command =~ ^(help|status)$ ]]; then | ||
| if [[ -n $subrepo_branch ]]; then | ||
| error "options --branch and --all are not compatible" | ||
| fi | ||
|
|
||
| # Run the command on all subrepos | ||
| local args=( "${command_arguments[@]}" ) | ||
| get-all-subrepos | ||
| for subdir in ${subrepos[*]}; do | ||
| command-prepare | ||
| subrepo_remote= | ||
| subrepo_branch= | ||
| subrepo_branch=$override_branch | ||
| command_arguments=( "$subdir" "${args[@]}" ) | ||
| "command:$command" | ||
| done | ||
|
|
@@ -694,6 +690,16 @@ subrepo:fetch() { | |
| error "Can't fetch subrepo. Remote is 'none' in '$subdir/.gitrepo'." | ||
| fi | ||
|
|
||
| if $all_wanted && [[ -n $subrepo_branch ]]; then | ||
| o "Check if the remote branch ($subrepo_branch) exists." | ||
| OUT=true RUN git ls-remote --heads "$subrepo_remote" "$subrepo_branch" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is already a command for this git:branch-exists see 644 for an example |
||
| if [[ -z $output ]]; then | ||
| SAY=false OUT=true RUN git config --file="$gitrepo" subrepo.branch | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a function to read the gitrepo file read-gitrepo-file |
||
| o "Remote branch ($subrepo_branch) in '$subrepo_remote' not exists, using branch ($output) from subrepo config." | ||
| subrepo_branch="$output" | ||
| fi | ||
| fi | ||
|
|
||
| o "Fetch the upstream: $subrepo_remote ($subrepo_branch)." | ||
| RUN git fetch --no-tags --quiet "$subrepo_remote" "$subrepo_branch" | ||
| OK || return | ||
|
|
||
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.
Wouldn't something similar be necessary in subrepo:push?
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'm not sure. I don't think anything is missing in subrepo:push. It's works fine with --all.