File tree Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66
77## [ Unreleased]
88
9+ ## [ 2.0.5] - 2021-02-16
10+ ### Changed
11+ - bl_all_files_in_repo now excludes submodules
12+
913## [ 2.0.4] - 2020-09-25
1014### Changed
1115- bl_hub_issue_number_for_title now returns the first matching issue number only, instead of all matching issue numbers separated by newlines.
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ files within it's directory.
126126 <li><b>bl_in_git_repo</b>: True if current directory is a git working directory</li>
127127 <li><b>bl_github_owner_repo</b>: returns $owner/$repo extracted from the url of the origin remote</li>
128128 <li><b>bl_repo_root</b>: Find the root of the current git repo.</li>
129- <li><b>bl_all_files_in_repo</b>: List files tracked by git.</li>
129+ <li><b>bl_all_files_in_repo</b>: List files tracked by git, excludes submodules .</li>
130130 <li><b>bl_remote_latest_tag</b>: Returns the symbolic name of the latest tag from a remote.</li>
131131 <li><b>bl_remote_latest_tagged_commit</b>: Returns the SHA of the most recently tagged commit in a remote repo (<code>tag^{}</code>).</li>
132132 <li><b>bl_remote_sha_for_ref</b>: Returns the SHA for a given ref from a named remote.</li>
Original file line number Diff line number Diff line change @@ -28,10 +28,13 @@ function bl_repo_root(){
2828 git rev-parse --show-toplevel
2929}
3030
31- # List files tracked by git
31+ # List files tracked by git excluding submodules
3232function bl_all_files_in_repo(){
3333 bl_in_git_repo
34- git ls-tree -r HEAD --name-only
34+ git ls-files -s | grep -v ^16 | cut -f2-
35+ # ^- show status code ^16 = submodule
36+ # ^- exclude submodules
37+ # ^- return only file paths (not status code)
3538}
3639
3740# Find the latest tag available at a repo url
Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ setup(){
1717 SKIP_GITLEAKS=YES git commit --allow-empty -m " initial"
1818 echo " some content" > a_file
1919 git add a_file
20- git commit -a -m " some operations fail on empty repos"
20+ # Add a submodule as that trips up some operations
21+ git submodule add https://github.com/cyberark/conjur conjur
22+ git submodule update --init
23+ SKIP_GITLEAKS=YES git commit -a -m " some operations fail on empty repos"
2124}
2225
2326teardown (){
@@ -112,7 +115,8 @@ teardown(){
112115 # untracked file shouldn't be listed in output
113116 date > b
114117 run bl_all_files_in_repo
115- assert_output " a_file"
118+ assert_output " .gitmodules
119+ a_file"
116120 assert_success
117121}
118122
You can’t perform that action at this time.
0 commit comments