diff options
author | root <root@localhost> | 2013-02-22 15:43:46 +0000 |
---|---|---|
committer | root <root@localhost> | 2013-02-22 15:43:46 +0000 |
commit | 1436e6eb8e011e319a0b8716ae135d4f79f8d49d (patch) | |
tree | b72d73a68b6e9a918d5ba7449fce1051b29b3d93 | |
parent | 188b25df8876b1e04e1cb6aac60b7eb0e2b0fd22 (diff) | |
download | git-remote-gcrypt-1436e6eb8e011e319a0b8716ae135d4f79f8d49d.zip git-remote-gcrypt-1436e6eb8e011e319a0b8716ae135d4f79f8d49d.tar.gz git-remote-gcrypt-1436e6eb8e011e319a0b8716ae135d4f79f8d49d.tar.bz2 |
Guard verify-pack and pack-objects and die on error
Use echo_kill for when echo_die is not enough.
-rwxr-xr-x | git-remote-gcrypt | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/git-remote-gcrypt b/git-remote-gcrypt index f4b7ad8..bf6c0a3 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -44,6 +44,7 @@ xecho_n() { xecho "$@" | tr -d \\n ; } # kill newlines echo_git() { xecho "$@" ; } # Code clarity echo_info() { xecho "gcrypt:" "$@" >&2; } echo_die() { echo_info "$@" ; exit 1; } +echo_kill() { echo_info "$@" ; kill $$; exit 1; } isnull() { case "$1" in "") return 0;; *) return 1;; esac; } isnonnull() { ! isnull "$1"; } @@ -612,7 +613,8 @@ EOF xecho "$r_del_list" | get_pack_files "$Localdir/pack/" - (set +f; git verify-pack -v "$Localdir"/pack/*.idx) | + (set +f; git verify-pack -v "$Localdir"/pack/*.idx || + echo_kill "git verify-pack failed!") | grep -E '^[0-9a-f]{40}' | cut -f 1 -d ' ' >> "$1" Packlist=$r_keep_packlist @@ -717,8 +719,9 @@ EOF repack_if_needed "$tmp_objlist" @r_pack_delete key_=$(genkey "$Packkey_bytes") - GIT_ALTERNATE_OBJECT_DIRECTORIES=$Localdir \ - git pack-objects --stdout < "$tmp_objlist" | + (GIT_ALTERNATE_OBJECT_DIRECTORIES=$Localdir \ + git pack-objects --stdout < "$tmp_objlist" || + echo_kill "git pack-objects failed!") | ENCRYPT "$key_" > "$tmp_encrypted" pack_id=$(gpg_hash "$Hashtype" < "$tmp_encrypted") |