Skip to content

Commit

Permalink
Override the ssh-askpass.sh script to respect the workspace ssh key (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vinokurig authored Nov 7, 2024
1 parent 4d9933c commit 029a3d9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .rebase/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,9 @@ https://github.com/che-incubator/che-code/pull/353

- code/src/vs/server/node/extensionHostConnection.ts
---

#### @vinokurig
https://github.com/che-incubator/che-code/pull/400

- code/extensions/git/src/ssh-askpass.sh
---
6 changes: 2 additions & 4 deletions code/extensions/git/src/ssh-askpass.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/bin/sh
VSCODE_GIT_ASKPASS_PIPE=`mktemp`
ELECTRON_RUN_AS_NODE="1" VSCODE_GIT_ASKPASS_PIPE="$VSCODE_GIT_ASKPASS_PIPE" VSCODE_GIT_ASKPASS_TYPE="ssh" "$VSCODE_GIT_ASKPASS_NODE" "$VSCODE_GIT_ASKPASS_MAIN" $VSCODE_GIT_ASKPASS_EXTRA_ARGS $*
cat $VSCODE_GIT_ASKPASS_PIPE
rm $VSCODE_GIT_ASKPASS_PIPE
# see https://github.com/devfile/devworkspace-operator/blob/main/docs/additional-configuration.adoc#configuring-devworkspaces-to-use-ssh-keys-for-git-operations
cat /etc/ssh/passphrase
13 changes: 13 additions & 0 deletions rebase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,17 @@ apply_code_src_vs_code_browser_workbench_workbench_changes() {
git add code/src/vs/code/browser/workbench/workbench.ts > /dev/null 2>&1
}

# Apply changes on code/extensions/git/src/ssh-askpass.sh file
apply_code_extensions_git_src_ssh-askpass_changes() {

echo " ⚙️ reworking code/extensions/git/src/ssh-askpass.sh..."
# reset the file from local
git checkout --ours code/extensions/git/src/ssh-askpass.sh > /dev/null 2>&1

# resolve the change
git add code/extensions/git/src/ssh-askpass.sh > /dev/null 2>&1
}

# Apply changes for the given file
apply_changes() {
local filePath="$1"
Expand Down Expand Up @@ -369,6 +380,8 @@ resolve_conflicts() {
apply_code_vs_workbench_contrib_webview_browser_pre_index_no_csp_html_changes
elif [[ "$conflictingFile" == "code/src/vs/code/browser/workbench/workbench.ts" ]]; then
apply_code_src_vs_code_browser_workbench_workbench_changes
elif [[ "$conflictingFile" == "code/extensions/git/src/ssh-askpass.sh" ]]; then
apply_code_extensions_git_src_ssh-askpass_changes
elif [[ "$conflictingFile" == "code/src/vs/base/common/product.ts" ]]; then
apply_changes "$conflictingFile"
elif [[ "$conflictingFile" == "code/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts" ]]; then
Expand Down

0 comments on commit 029a3d9

Please sign in to comment.