Skip to content

Commit

Permalink
Suppress expected error message when deleting repo
Browse files Browse the repository at this point in the history
When deleting a repo, we call invalidatedircache afterwards to ensure
that the NFS cache picks up on the repo being gone. This means that `ls`
will not find the directory, and `cd` will fail too. So we silence
errors from `ls`, and exit before running `cd` if we're calling
invalidatedircache, because there's nothing left to do at that point.
  • Loading branch information
rmunn committed May 9, 2024
1 parent 542182c commit 69baf48
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions hgweb/command-runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ echo ""
# Run the hg command, simply output to stdout
first_char=$(echo $project_code | cut -c1)
# Ensure NFS cache is refreshed in case project repo changed in another pod (e.g., project reset)
ls /var/hg/repos/$first_char/$project_code > /dev/null # Don't need output; this is enough to refresh NFS dir cache
ls /var/hg/repos/$first_char/$project_code >/dev/null 2>/dev/null # Don't need output; this is enough to refresh NFS dir cache
# Sometimes invalidatedircache is called after deleting a project, so the cd would fail. So exit fast in that case.
[ "x$command_name" = "xinvalidatedircache" ] && exit 0
cd /var/hg/repos/$first_char/$project_code
case $command_name in

Expand All @@ -63,10 +65,6 @@ case $command_name in
timeout 5 chg verify 2>&1
;;

invalidatedircache)
# Do nothing; the ls before the case was the whole point of this command
;;

*)
# Env var PYTHONUNBUFFERED required for commands like verify and recover, so that output can stream back to the project page
PYTHONUNBUFFERED=1 chg $command_name 2>&1
Expand Down

0 comments on commit 69baf48

Please sign in to comment.