From nobody Thu May 2 10:05:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57263+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57263+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1586651200; cv=none; d=zohomail.com; s=zohoarc; b=WU3xUOS4QaLzKnWCul4zIbhiFBhgMidJ3h6uMA3A2LtSV/mDHtFDQMgwcIbmjdUGXyf+5Cy7oFRFSc/jZ2uOCW7hqAUZjVTKiFEuqwJKbw3WtlWRxiSl3iUKE0FO0T1k+fkS5ovKzRdFF8TxJi5NTC2VJ0tYqMhC4B6Lj6sDIc0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586651200; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=w0ASTrwLoNcS5ffcRnuXj4G/5ZYlRnL2VtJ1DEdyDnA=; b=IogN6GDARVtqH1zdZwF/q5QOAsH0pvYflG+GjZXtjal4f2qdBoFVSeF2WGNz1L/SQsYzHpt+1s29FDMnBf5SQFcwJauhE1HfHWojgP9XsZbYU+wONw+fEWQaCBBxoUtrxvIT7aZRW0xusuIVylhYtF/OOXQFmdTpwHhzVd5tZU0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57263+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1586651200052781.6504971027845; Sat, 11 Apr 2020 17:26:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id RQJgYY1788612xQWEKvuPTyn; Sat, 11 Apr 2020 17:26:39 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.4184.1586651199013405411 for ; Sat, 11 Apr 2020 17:26:39 -0700 IronPort-SDR: Bi2dRClhz1wCN5o2LNV5NwZ5t8Y6VTaREjrvcItdsXWWGtLBKt5yIjbHijzscH143TJX60EnN1 eELdI0kI9ZHg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Apr 2020 17:26:38 -0700 IronPort-SDR: IZGk6u9GM9mS5VfbkYr20lTI+9PJyEaqt6X8q4TE+PAHDBIUqXmjA1lla4ohnQFBUxcMrgEe/X MxNBENlxlZfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,372,1580803200"; d="scan'208";a="264461990" X-Received: from nldesimo-desk1.amr.corp.intel.com ([10.7.159.63]) by orsmga008.jf.intel.com with ESMTP; 11 Apr 2020 17:26:37 -0700 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Ashley DeSimone , Puja Pandya , Erik Bjorge , Prince Agyeman , Bret Barkelew , Philippe Mathieu-Daude Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Update combo displayed in shell after checkout Date: Sat, 11 Apr 2020 17:26:30 -0700 Message-Id: <20200412002630.4790-1-nathaniel.l.desimone@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nathaniel.l.desimone@intel.com X-Gm-Message-State: H8u6Rv86ZoLFaCqCEyy1XD2Kx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1586651199; bh=J8elsBUplzez2DB/0zP7SJ1lk/bioCOeI6uZSAKYhWo=; h=Cc:Date:From:Reply-To:Subject:To; b=hU29vGEiYgbKCZQhhn2/ba9ABkOBqJNNRI09OeJRViJPLDEYtwi6UXslouG9PLBue0i BScUVHcbAVKRITS7v0XokfWMQ4FcDYN6QQl3ISaecljySUe/+dhTCSv61pBUpF2YmwVim G+lyF0TNppPBw65yDNE2VdzWOWDMWSkNCe8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" With the current version of the command completion script, after running "edkrepo checkout" the branch combination listed in the shell prompt is not updated to reflect the new branch combination. The reason for this is because the branch combination isn't checked for changes unless the present working directory was changed by the previous command. To fix this bug, the scripts have been updated to check for changes to the branch combination when the last command run by the user was "edkrepo" OR the present working directory was changed by the previous command. Signed-off-by: Nate DeSimone Cc: Ashley DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Prince Agyeman Cc: Bret Barkelew Cc: Philippe Mathieu-Daude Reviewed-by: Ashley DeSimone --- .../Vendor/win_edkrepo_prompt.sh | 17 ++++++++- edkrepo_installer/linux-scripts/install.py | 38 +++++++++++++++++-- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/edkrepo_installer/Vendor/win_edkrepo_prompt.sh b/edkrepo_insta= ller/Vendor/win_edkrepo_prompt.sh index 5404175..91496a7 100644 --- a/edkrepo_installer/Vendor/win_edkrepo_prompt.sh +++ b/edkrepo_installer/Vendor/win_edkrepo_prompt.sh @@ -39,7 +39,16 @@ if [ -x "$(command -v edkrepo)" ] && [ -x "$(command -v = $command_completion_edkr # manifest XML, which is a relatively expensive operation to do every ti= me # the user presses . # As a performance optimization, only do this if the present working dir= ectory - # changed + # changed or if the last command executed was edkrepo + do_combo_check=3D"0" + edkrepo_check_last_command() { + if [[ "$BASH_COMMAND" =3D=3D *"edkrepo"* ]] && [[ "$BASH_COMMAND" !=3D= *"_edkrepo"* ]]; then + if [[ "$BASH_COMMAND" !=3D *"edkrepo_"* ]]; then + do_combo_check=3D"1" + fi + fi + } + trap 'edkrepo_check_last_command' DEBUG if [[ ! -z ${PROMPT_COMMAND+x} ]] && [[ "$PROMPT_COMMAND" !=3D "edkrepo_= combo_chpwd" ]]; then old_prompt_command=3D$PROMPT_COMMAND fi @@ -48,6 +57,10 @@ if [ -x "$(command -v edkrepo)" ] && [ -x "$(command -v = $command_completion_edkr if [[ "$(pwd)" !=3D "$old_pwd" ]]; then old_pwd=3D$(pwd) current_edkrepo_combo=3D$(command_completion_edkrepo current-combo) + do_combo_check=3D"0" + elif [ "$do_combo_check" =3D=3D "1" ]; then + current_edkrepo_combo=3D$(command_completion_edkrepo current-combo) + do_combo_check=3D"0" fi if [[ ! -z ${PROMPT_COMMAND+x} ]]; then eval $old_prompt_command @@ -57,4 +70,4 @@ if [ -x "$(command -v edkrepo)" ] && [ -x "$(command -v $= command_completion_edkr fi =20 PS1=3D"$newps1$prompt_suffix" -MSYS2_PS1=3D"$PS1" # for detection by MSYS2 SDK's bash.basrc +MSYS2_PS1=3D"$PS1" # for detection by MSYS2 SDK's bash.bashrc diff --git a/edkrepo_installer/linux-scripts/install.py b/edkrepo_installer= /linux-scripts/install.py index 099954d..f9f324a 100755 --- a/edkrepo_installer/linux-scripts/install.py +++ b/edkrepo_installer/linux-scripts/install.py @@ -296,7 +296,16 @@ if [ -x "$(command -v edkrepo)" ] && [ -x "$(command -= v command_completion_edkre # manifest XML, which is a relatively expensive operation to do every ti= me # the user presses . # As a performance optimization, only do this if the present working dir= ectory - # changed + # changed or if the last command executed was edkrepo + do_combo_check=3D"0" + edkrepo_check_last_command() { + if [[ "$BASH_COMMAND" =3D=3D *"edkrepo"* ]] && [[ "$BASH_COMMAND" !=3D= *"_edkrepo"* ]]; then + if [[ "$BASH_COMMAND" !=3D *"edkrepo_"* ]]; then + do_combo_check=3D"1" + fi + fi + } + trap 'edkrepo_check_last_command' DEBUG if [[ ! -z ${PROMPT_COMMAND+x} ]] && [[ "$PROMPT_COMMAND" !=3D "edkrepo_= combo_chpwd" ]]; then old_prompt_command=3D$PROMPT_COMMAND fi @@ -305,6 +314,10 @@ if [ -x "$(command -v edkrepo)" ] && [ -x "$(command -= v command_completion_edkre if [[ "$(pwd)" !=3D "$old_pwd" ]]; then old_pwd=3D$(pwd) current_edkrepo_combo=3D$(command_completion_edkrepo current-combo) + do_combo_check=3D"0" + elif [ "$do_combo_check" =3D=3D "1" ]; then + current_edkrepo_combo=3D$(command_completion_edkrepo current-combo) + do_combo_check=3D"0" fi if [[ ! -z ${PROMPT_COMMAND+x} ]]; then eval $old_prompt_command @@ -346,16 +359,34 @@ if [ -x "$(command -v edkrepo)" ] && [ -x "$(command = -v command_completion_edkre # manifest XML, which is a relatively expensive operation to do every ti= me # the user presses . # As a performance optimization, only do this if the present working dir= ectory - # changed + # changed or if the last command executed was edkrepo + do_combo_check=3D"0" function edkrepo_combo_chpwd() { current_edkrepo_combo=3D$(command_completion_edkrepo current-combo) + do_combo_check=3D"0" } chpwd_functions=3D(${chpwd_functions[@]} "edkrepo_combo_chpwd") + function edkrepo_combo_preexec() { + if [[ "$1" =3D *"edkrepo"* ]] && [[ "$1" !=3D *"_edkrepo"* ]]; then + if [[ "$1" !=3D *"edkrepo_"* ]]; then + do_combo_check=3D"1" + fi + fi + } + preexec_functions=3D(${preexec_functions[@]} "edkrepo_combo_preexec") + function edkrepo_combo_precmd() { + if [ "$do_combo_check" =3D "1" ]; then + current_edkrepo_combo=3D$(command_completion_edkrepo current-combo) + do_combo_check=3D"0" + fi + } + precmd_functions=3D(${precmd_functions[@]} "edkrepo_combo_precmd") fi =20 # Load version control information autoload -Uz vcs_info -precmd() { vcs_info } +git_precmd() { vcs_info } +precmd_functions=3D(${precmd_functions[@]} "git_precmd") =20 # Format the vcs_info_msg_0_ variable zstyle ':vcs_info:git:*' formats " %{$fg[cyan]%}(%b)%{$reset_color%}" @@ -363,6 +394,7 @@ zstyle ':vcs_info:git:*' formats " %{$fg[cyan]%}(%b)%{$= reset_color%}" # Set up the prompt (with git branch name) setopt PROMPT_SUBST eval "PROMPT=3D'$new_prompt\${vcs_info_msg_0_}\$prompt_suffix'" + ''' =20 def add_command_to_startup_script(script_file, regex, command, username): --=20 2.26.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#57263): https://edk2.groups.io/g/devel/message/57263 Mute This Topic: https://groups.io/mt/72956799/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-