Skip to content

Commit 0a1c9be

Browse files
committed
Expand docs on cleaning extension update dir
This summarizes a conversation within #9934 PR regarding how the new extension update directory metadata would affect gh if not cleaned up.
1 parent 97eb8a1 commit 0a1c9be

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pkg/cmd/extension/manager.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,20 @@ func codesignBinary(binPath string) error {
849849
return cmd.Run()
850850
}
851851

852-
// cleanExtensionUpdateDir deletes extension state directory to avoid problems reinstalling extensions.
852+
// cleanExtensionUpdateDir deletes the extension-specific directory containing metadata used in checking for updates.
853+
// Because extension names are not unique across GitHub organizations and users, we feel its important to clean up this metadata
854+
// before installing or removing an extension with the same name to avoid confusing the extension manager based on past extensions.
855+
//
856+
// As of cli/cli#9934, the only effect on gh from not cleaning up metadata before installing or removing an extension are:
857+
//
858+
// 1. The last `checked_for_update_at` timestamp is sufficiently in the past and will check for an update on first use,
859+
// which would happen if no extension update metadata existed.
860+
//
861+
// 2. The last `checked_for_update_at` timestamp is sufficiently in the future and will not check for an update,
862+
// this is not a major concern as users could manually modify this.
863+
//
864+
// This could change over time as other functionality is added to extensions, which we cannot predict within cli/cli#9934,
865+
// such as extension manifest and lock files within cli/cli#6118.
853866
func (m *Manager) cleanExtensionUpdateDir(name string) error {
854867
if err := os.RemoveAll(m.UpdateDir(name)); err != nil {
855868
return fmt.Errorf("failed to remove previous extension update state: %w", err)

0 commit comments

Comments
 (0)