Skip to content

Commit 3e17a77

Browse files
committed
Fix update option
1 parent be9f02a commit 3e17a77

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lib/git-subrepo

+12-10
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Options:
6464
h Show the command summary
6565
help Help overview
6666
version Print the git-subrepo version number
67-
67+
6868
a,all Perform command on all current subrepos
6969
A,ALL Perform command on all subrepos and subsubrepos
7070
b,branch= Specify the upstream branch to push/pull/fetch
@@ -76,7 +76,7 @@ m,message= Specify a commit message
7676
r,remote= Specify the upstream remote to push/pull/fetch
7777
s,squash Squash commits on push
7878
u,update Add the --branch and/or --remote overrides to .gitrepo
79-
79+
8080
q,quiet Show minimal output
8181
v,verbose Show verbose output
8282
d,debug Show the actual commands used
@@ -1399,14 +1399,16 @@ update-gitrepo-file() {
13991399
fi
14001400
fi
14011401

1402-
1403-
# TODO: only update remote and branch if supplied and $update_wanted
1404-
if $newfile || [[ $update_wanted && $override_remote ]]; then
1405-
RUN git config --file="$gitrepo" subrepo.remote "$subrepo_remote"
1406-
fi
1407-
1408-
if $newfile || [[ $update_wanted && $override_branch ]]; then
1409-
RUN git config --file="$gitrepo" subrepo.branch "$subrepo_branch"
1402+
# only update remote and branch if supplied and $update_wanted
1403+
if $newfile || $update_wanted; then
1404+
if [[ $override_remote ]]; then
1405+
o "Update remote to $subrepo_remote"
1406+
RUN git config --file="$gitrepo" subrepo.remote "$subrepo_remote"
1407+
fi
1408+
if [[ $override_branch ]]; then
1409+
o "Update branch to $subrepo_branch"
1410+
RUN git config --file="$gitrepo" subrepo.branch "$subrepo_branch"
1411+
fi
14101412
fi
14111413

14121414
RUN git config --file="$gitrepo" subrepo.commit "$upstream_head_commit"

0 commit comments

Comments
 (0)