FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
code-utils/git-utils/git-submodule-usage.sh at master · Praqma/code-utils · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
Praqma
/
code-utils
Public
Notifications
You must be signed in to change notification settings
Fork
15
Star
17
Code
Issues
3
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
code-utils
/
git-utils
/
git-submodule-usage.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
62 lines (52 loc) · 2.24 KB
Breadcrumbs
code-utils
/
git-utils
/
git-submodule-usage.sh
Copy path
File metadata and controls
executable file
·
62 lines (52 loc) · 2.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!
/bin/bash
#
Enable strict mode for better error handling
set
-euo pipefail
while
getopts
"
s:h
"
opt
;
do
case
${opt}
in
s )
subm_repo_name=
"
${OPTARG}
"
shift
;;
\?
|h )
echo
"
Usage:
$0
-s <submodule-name>
"
echo
"
-s <submodule-name> Specify the old tag to be retagged
"
exit
1
;;
esac
done
if
[[
-z
"
${subm_repo_name
:-
}
"
]]
;
then
$0
-h
exit
1
fi
for
subm_path
in
$(
git config get -f .gitmodules --all --regexp
"
.*/
${subm_repo_name}
.path$
"
)
;
do
printf
"
Submodule path: %s\n
"
"
$subm_path
"
for
sha1_root
in
$(
git rev-list --all --
${subm_path}
)
;
do
sha1_sub=
"
$(
git ls-tree
$sha1_root
${subm_path}
|
cut -d
"
"
-f 3
|
cut -d
$'
\t
'
-f 1
)
"
||
true
if
[
-z
"
${sha1_sub
:-
}
"
]
;
then
sha1_sub=
"
(no submodule)
"
else
git -C
${subm_path}
rev-parse --verify
$sha1_sub
>
/dev/null
2>&1
||
{
git -C
${subm_path}
fetch origin
$sha1_sub
>
/dev/null
git artifact fetch-tags -s
$sha1_sub
>
/dev/null
git -C
${subm_path}
rev-parse --verify
$sha1_sub
>
/dev/null
2>&1
||
{
sha1_sub_ls_remote=
"
(dead sha1)
"
}
}
sha1_sub_ls_remote=
$(
git -C
${subm_path}
ls-remote --tags origin
|
grep
$sha1_sub
|
cut -d / -f 3-
)
||
true
if
[
-z
"
${sha1_sub_ls_remote
:-
}
"
]
;
then
sha1_sub_ls_remote=
"
(no tag)
"
fi
fi
remote_branches_contains_count=
$(
git branch -r --contains
$sha1_root
|
wc -l
)
tags_contains_count=
$(
git tag --contains
$sha1_root
|
wc -l
)
printf
"
%14.14s %-60.60s %-80.80s %-20.20s\n
"
\
"
$sha1_sub
"
\
"
$sha1_sub_ls_remote
"
\
"
$(
git log --oneline -1 --decorate --format=
"
%h %cd %s
"
$sha1_root
|
cut -c1-90
)
"
\
"
(ct.br:
$remote_branches_contains_count
ct.t:
${tags_contains_count}
)
"
if
[[
"
${verbose_branches
:-
verbose_branches_false}
"
==
true
&&
"
$remote_branches_contains_count
"
-gt
0 ]]
;
then
git branch -r --contains
$sha1_root
|
grep -e origin/master -e origin/main -e origin/products/.
*
||
true
fi
done
echo
done
Back
|
FazBrowse Home
|
New Git URL