Skip to content

Commit 9e33d47

Browse files
committed
Extend output in subrepo clone, fetch and pull
When branch@commit is requested in clone, fetch and pull commands, show that in their output as well.
1 parent 2dbdfab commit 9e33d47

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

lib/git-subrepo

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ command:clone() {
206206
local re=
207207
$force_wanted && re=re
208208
local remote=$subrepo_remote
209-
say "Subrepo '$remote' ($subrepo_branch) ${re}cloned into '$subdir'."
209+
local bc=$subrepo_branch
210+
if [ -n "$subrepo_branch_commit" ]; then
211+
bc=$subrepo_branch@$subrepo_branch_commit
212+
fi
213+
say "Subrepo '$remote' ($bc) ${re}cloned into '$subdir'."
210214
}
211215

212216
# `git subrepo init <subdir>` command:
@@ -237,7 +241,11 @@ command:pull() {
237241

238242
subrepo:pull
239243
if OK; then
240-
say "Subrepo '$subdir' pulled from '$subrepo_remote' ($subrepo_branch)."
244+
local bc=$subrepo_branch
245+
if [ -n "$subrepo_branch_commit" ]; then
246+
bc=$subrepo_branch@$subrepo_branch_commit
247+
fi
248+
say "Subrepo '$subdir' pulled from '$subrepo_remote' ($bc)."
241249
elif [[ $CODE -eq -1 ]]; then
242250
say "Subrepo '$subdir' is up to date."
243251
elif [[ $CODE -eq 1 ]]; then
@@ -275,7 +283,11 @@ command:fetch() {
275283
say "Ignored '$subdir', no remote."
276284
else
277285
subrepo:fetch
278-
say "Fetched '$subdir' from '$subrepo_remote' ($subrepo_branch)."
286+
local bc=$subrepo_branch
287+
if [ -n "$subrepo_branch_commit" ]; then
288+
bc=$subrepo_branch@$subrepo_branch_commit
289+
fi
290+
say "Fetched '$subdir' from '$subrepo_remote' ($bc)."
279291
fi
280292
}
281293

0 commit comments

Comments
 (0)