diff options
Diffstat (limited to 'db-functions')
-rw-r--r-- | db-functions | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/db-functions b/db-functions index 4b90d51..4c22bd8 100644 --- a/db-functions +++ b/db-functions @@ -28,6 +28,8 @@ mv_acl() { WORKDIR=$(mktemp -d "${TMPDIR}/${0##*/}.XXXXXXXXXX") LOCKS=() REPO_MODIFIED=0 +declare -a HISTORY_add_files=() +declare -a HISTORY_remove_files=() # check if messages are to be printed using color unset ALL_OFF BOLD BLUE GREEN RED YELLOW @@ -565,7 +567,7 @@ arch_history_add() { mkdir -p "${history_file%/*}" echo "$pkgbase $pkgver" > "$history_file" - arch_git add "$history_file" + HISTORY_add_files=("${HISTORY_add_files[@]}" "$history_file") } arch_history_remove() { @@ -574,12 +576,21 @@ arch_history_remove() { local tarches="$3" local history_file="$GITREPO/$repo/$tarch/$pkgname" - arch_git rm "$history_file" + + [[ -f "$history_file" ]] || return 1 + + HISTORY_remove_files=("${HISTORY_remove_files[@]}" "$history_file") } -arch_git() { +arch_history_commit() { pushd "$GITREPO" - git "$@" + if ((${#HISTORY_add_files[@]} > 0)); then + git add -- "${HISTORY_add_files[@]}" + fi + if ((${#HISTORY_remove_files[@]} > 0)); then + git rm -- "${HISTORY_remove_files[@]}" + fi + git commit -q -m "$1" popd } |