From 28725e6cbcd9adba3b1e07d1862fa3735b18b84d Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Tue, 23 Apr 2019 22:08:02 -0400 Subject: Respect blobs-ignore when removing blobs --- libs/git | 10 ++-------- libs/project | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'libs') diff --git a/libs/git b/libs/git index b5b2ffdb..429d4783 100755 --- a/libs/git +++ b/libs/git @@ -361,18 +361,12 @@ git_project_prepare_blobs() { shift local repository_path=$(git_project_repository_path "$repository") - local blobs_path=$(project_blobs_path "$project" "$@") local blob - if ! [[ -f "$blobs_path" ]] - then - return - fi - - while read blob + while read -r blob do git_remove "$repository_path" "$blob" - done < "$blobs_path" + done < <(project_blobs "$project" "$@") if ! git_diff_staged_check "$repository_path" then diff --git a/libs/project b/libs/project index dfb745a0..c830e1ee 100755 --- a/libs/project +++ b/libs/project @@ -535,6 +535,22 @@ project_sources_prepare_patch() { done } +project_blobs() { + local project=$1 + shift + + local blobs_path=$(project_blobs_path "$project" "$@") + local blobs_ignore_path=$(project_blobs_ignore_path "$project" "$@") + + if [[ -n $blobs_path ]]; then + if [[ -n $blobs_ignore_path ]]; then + comm -23 <(sort "$blobs_path") <(sort "$blobs_ignore_path") + else + cat "$blobs_path" + fi + fi +} + project_blobs_path() { local project=$1 shift -- cgit v1.2.3-70-g09d2 From ac24b44b0ad54a45d32884c96e537f6b2198307e Mon Sep 17 00:00:00 2001 From: Andrew Robbins Date: Fri, 19 Apr 2019 20:54:04 -0400 Subject: libs/project: Modify output of project_blobs_path() project_blobs_ignore_path() prints nothing if a blobs-ignore file is not found for the given project and arguments (if any); this behavior should be the same for project_blobs_path() --- libs/project | 2 -- 1 file changed, 2 deletions(-) (limited to 'libs') diff --git a/libs/project b/libs/project index c830e1ee..52888e32 100755 --- a/libs/project +++ b/libs/project @@ -580,8 +580,6 @@ project_blobs_path() { return fi done - - printf '%s\n' "$blobs_path" } project_blobs_ignore_path() { -- cgit v1.2.3-70-g09d2