]> git.lizzy.rs Git - plan9front.git/commit
git/fetch: ensure we clean packfiles on failure
authorOri Bernstein <ori@eigenstate.org>
Sat, 17 Jul 2021 00:10:44 +0000 (00:10 +0000)
committerOri Bernstein <ori@eigenstate.org>
Sat, 17 Jul 2021 00:10:44 +0000 (00:10 +0000)
commit2204634275cbb3337cfc7cc994b57f9aa4017d0d
tree37184084a99927c14e83df7993459014ac9786c5
parentfad1b3f7f77f08764f0e32f8ce18bee16da3aa69
git/fetch: ensure we clean packfiles on failure

When pulling into a git repository that is group
writable as a non-owner, the pack file is left
in place because we do not have permission to
remove it.

We also leave it behind if we bail out early due
to an error, or due to only listing the changes.

This pushes down the creation of the file, and
cleans it up on error.

thanks to Anthony Martin for spotting the bug.
git/fetch: ensure we clean packfiles on failure

When pulling into a git repository that is group
writable as a non-owner, the pack file is left
in place because we do not have permission to
remove it.

We also leave it behind if we bail out early due
to an error, or due to only listing the changes.

This pushes down the creation of the file, and
cleans it up on error.

Also, while we're here, clean up index caching,
and ensure we close the fd in all cases.

thanks to Anthony Martin for spotting the bug.
sys/src/cmd/git/fetch.c
sys/src/cmd/git/pack.c