From 5cb23e4ce619e6353effb6e5a317fc6b715282c0 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@archlinux.org>
Date: Mon, 5 Aug 2019 17:47:41 -0400
Subject: [PATCH] update-keys: don't restore cwd in a subprocess

Using popd at the very end of a shell script is unnecessary, because, as
the very last command, there is nothing to restore state for.
Immediately after, the shell subprocess is ended, and processes don't
control the cwd of the parent process. Changing the cwd for the last
microsecond of the shell process, during which no commands are run, is
a mildly expensive no-op.

By the same measure, if popd is never used, pushd is not needed to
record the old cwd. So simply use 'cd'.

Signed-off-by: Christian Hesse <mail@eworm.de>
---
 update-keys | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/update-keys b/update-keys
index 74828178..d5deb4bb 100755
--- a/update-keys
+++ b/update-keys
@@ -21,7 +21,7 @@ armor
 no-emit-version
 __EOF__
 
-pushd "$(dirname "$0")" >/dev/null
+cd "$(dirname "$0")"
 
 "${GPG[@]}" --gen-key <<EOF
 %echo Generating Arch Linux keyring temporary master key...
@@ -91,5 +91,3 @@ while read -ra data; do
 done < packager-revoked-keyids
 
 cat master/*.asc master-revoked/*.asc packager/*.asc packager-revoked/*.asc > archlinux.gpg
-
-popd >/dev/null
-- 
GitLab