dakanji / RefindPlusUDK

RefindPlus UEFI Development Kit
BSD 2-Clause "Simplified" License
7 stars 39 forks source link

RepoUpdater Script not Correctly Syncing with Upstream #6

Closed startergo closed 3 years ago

startergo commented 3 years ago

Running the script from within its folder yields this:

Repo Updater ``` ## RepoUpdater ## ----------------- Syncing Refind-UDK Already on 'rudk' Your branch is up to date with 'origin/rudk'. HEAD is now at 56c1ccd8 Update gitignore Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/Refind-UDK.git + 029b4582...56c1ccd8 HEAD -> rudk (forced update) From https://github.com/dakanji/Refind-UDK * branch rudk -> FETCH_HEAD Updating 56c1ccd8..029b4582 Fast-forward 000-BuildScript/RepoUpdater.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/Refind-UDK.git 56c1ccd8..029b4582 rudk -> rudk Everything up-to-date Synced Refind-UDK Syncing RefindPlus Already on 'GOPFix' Your branch is up to date with 'origin/GOPFix'. HEAD is now at 60644bd Update for v0.12.0.AN Release Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/RefindPlus.git + 9054d73...60644bd HEAD -> GOPFix (forced update) remote: Enumerating objects: 8, done. remote: Counting objects: 100% (8/8), done. remote: Total 8 (delta 7), reused 8 (delta 7), pack-reused 0 Unpacking objects: 100% (8/8), done. From https://github.com/dakanji/RefindPlus * branch GOPFix -> FETCH_HEAD 9691685..9054d73 GOPFix -> upstream/GOPFix Updating 60644bd..9054d73 Fast-forward EfiLib/BdsConnect.c | 8 ++--- MainRP/driver_support.c | 146 +++++++++++++++++++++++++++-------------------------------------------------- MainRP/driver_support.h | 1 - MainRP/lib.c | 4 +-- MainRP/main.c | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ MainRP/menu.c | 6 ++-- MainRP/scan.c | 36 +++++++++---------- MainRP/screen.c | 100 ++++++++++++++++++++++++++++------------------------- MainRP/screen.h | 2 +- NEWS.txt | 7 ++++ README.md | 8 +++-- config.conf-sample | 123 ++++++++++++++++++++++++++++++++++++----------------------------- filesystems/RamDiskDxe/RamDiskFileExplorer.c | 2 +- filesystems/RamDiskDxe/RamDiskImpl.h | 2 +- include/version.h | 2 +- libeg/screen.c | 85 ++++++++------------------------------------- mountesp | 2 +- refind-install | 4 +-- 18 files changed, 383 insertions(+), 328 deletions(-) Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/RefindPlus.git 60644bd..9054d73 GOPFix -> GOPFix Everything up-to-date Synced RefindPlus ----------------- ## RepoUpdater ## g5@Big-Sur ~ % /Users/g5/Documents/RefindPlus/edk2/000-BuildScript/RepoUpdater.sh ## RepoUpdater ## ----------------- Syncing Refind-UDK Already on 'rudk' Your branch is up to date with 'origin/rudk'. HEAD is now at 56c1ccd8 Update gitignore Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/Refind-UDK.git + 029b4582...56c1ccd8 HEAD -> rudk (forced update) From https://github.com/dakanji/Refind-UDK * branch rudk -> FETCH_HEAD Updating 56c1ccd8..029b4582 Fast-forward 000-BuildScript/RepoUpdater.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/Refind-UDK.git 56c1ccd8..029b4582 rudk -> rudk Everything up-to-date Synced Refind-UDK Syncing RefindPlus Already on 'GOPFix' Your branch is up to date with 'origin/GOPFix'. HEAD is now at 60644bd Update for v0.12.0.AN Release Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/RefindPlus.git + 9054d73...60644bd HEAD -> GOPFix (forced update) From https://github.com/dakanji/RefindPlus * branch GOPFix -> FETCH_HEAD Updating 60644bd..9054d73 Fast-forward EfiLib/BdsConnect.c | 8 ++--- MainRP/driver_support.c | 146 +++++++++++++++++++++++++++-------------------------------------------------- MainRP/driver_support.h | 1 - MainRP/lib.c | 4 +-- MainRP/main.c | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ MainRP/menu.c | 6 ++-- MainRP/scan.c | 36 +++++++++---------- MainRP/screen.c | 100 ++++++++++++++++++++++++++++------------------------- MainRP/screen.h | 2 +- NEWS.txt | 7 ++++ README.md | 8 +++-- config.conf-sample | 123 ++++++++++++++++++++++++++++++++++++----------------------------- filesystems/RamDiskDxe/RamDiskFileExplorer.c | 2 +- filesystems/RamDiskDxe/RamDiskImpl.h | 2 +- include/version.h | 2 +- libeg/screen.c | 85 ++++++++------------------------------------- mountesp | 2 +- refind-install | 4 +-- 18 files changed, 383 insertions(+), 328 deletions(-) Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/RefindPlus.git 60644bd..9054d73 GOPFix -> GOPFix Everything up-to-date Synced RefindPlus ----------------- ## RepoUpdater ## ```

Both git repositories are even with the remote branches

startergo commented 3 years ago

This is the content of the local RepoUpdater:

Repo Updater ``` #!/usr/bin/env bash ### # RepoUpdater.sh # A script to sync the RefindPlus and Refind-UDK Repos with upstream # # Copyright (c) 2020-2021 Dayo Akanji # MIT License ### # Provide custom colours msg_base() { echo -e "\033[0;36m$1\033[0m" } msg_info() { echo -e "\033[0;33m$1\033[0m" } msg_status() { echo -e "\033[0;32m$1\033[0m" } msg_error() { echo -e "\033[0;31m$1\033[0m" } ## ERROR HANDLER ## runErr() { # $1: message # Declare Local Variables local errMessage errMessage="${1:-Runtime Error ... Exiting}" echo '' msg_error "${errMessage}" echo '' echo '' exit 1 } trap runErr ERR ## UPDATE RUDK BRANCH ## clear msg_info '## RepoUpdater ##' msg_info '-----------------' echo '' msg_base "Syncing Refind-UDK" BASE_DIR="${HOME}/Documents/RefindPlus/edk2" pushd ${BASE_DIR} > /dev/null || runErr "ERROR: Could not find ${BASE_DIR} ...Exiting" git checkout rudk git reset --hard 56c1ccd80326fa48c5ab7a9d0103b205f4df6f6c git push origin HEAD -f git pull --tags upstream rudk git push origin git push --tags origin popd > /dev/null || runErr "ERROR: Could not return to starting directory ...Exiting" echo '' msg_status "Synced Refind-UDK" echo '' echo '' ## UPDATE GOPFIX BRANCH ## msg_base "Syncing RefindPlus" BASE_DIR="${HOME}/Documents/RefindPlus/Working" pushd ${BASE_DIR} > /dev/null || runErr "ERROR: Could not find ${BASE_DIR} ...Exiting" git checkout GOPFix git reset --hard 60644bd05a631e0e79071294ef3dca3b44ff071f git push origin HEAD -f git pull --tags upstream GOPFix git push origin git push --tags origin popd > /dev/null || exit 1 echo '' msg_status "Synced RefindPlus" echo '' msg_info '-----------------' msg_info '## RepoUpdater ##' echo '' echo '' ```
dakanji commented 3 years ago

Sorry, I couldn't find what the issue being raised was in the posts made or in the title

startergo commented 3 years ago

The issue is that the output of repo updater is always:

Output ``` ## RepoUpdater ## ----------------- Syncing Refind-UDK Already on 'rudk' Your branch is up to date with 'origin/rudk'. HEAD is now at 56c1ccd8 Update gitignore Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/Refind-UDK.git + 029b4582...56c1ccd8 HEAD -> rudk (forced update) From https://github.com/dakanji/Refind-UDK * branch rudk -> FETCH_HEAD Updating 56c1ccd8..029b4582 Fast-forward 000-BuildScript/RepoUpdater.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/Refind-UDK.git 56c1ccd8..029b4582 rudk -> rudk Everything up-to-date Synced Refind-UDK Syncing RefindPlus Already on 'GOPFix' Your branch is up to date with 'origin/GOPFix'. HEAD is now at 60644bd Update for v0.12.0.AN Release Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/RefindPlus.git + 9054d73...60644bd HEAD -> GOPFix (forced update) From https://github.com/dakanji/RefindPlus * branch GOPFix -> FETCH_HEAD Updating 60644bd..9054d73 Fast-forward EfiLib/BdsConnect.c | 8 ++--- MainRP/driver_support.c | 146 +++++++++++++++++++++++++++-------------------------------------------------- MainRP/driver_support.h | 1 - MainRP/lib.c | 4 +-- MainRP/main.c | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------ MainRP/menu.c | 6 ++-- MainRP/scan.c | 36 +++++++++---------- MainRP/screen.c | 100 ++++++++++++++++++++++++++++------------------------- MainRP/screen.h | 2 +- NEWS.txt | 7 ++++ README.md | 8 +++-- config.conf-sample | 123 ++++++++++++++++++++++++++++++++++++----------------------------- filesystems/RamDiskDxe/RamDiskFileExplorer.c | 2 +- filesystems/RamDiskDxe/RamDiskImpl.h | 2 +- include/version.h | 2 +- libeg/screen.c | 85 ++++++++------------------------------------- mountesp | 2 +- refind-install | 4 +-- 18 files changed, 383 insertions(+), 328 deletions(-) Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/RefindPlus.git 60644bd..9054d73 GOPFix -> GOPFix Everything up-to-date Synced RefindPlus ----------------- ## RepoUpdater ## ```

I can run it 10 consecutive times it is still the same.

startergo commented 3 years ago

I think that "git reset --hard" should only be applied if the remote branch is reverted to a previous commit.

Output ``` ## RepoUpdater ## ----------------- Syncing Refind-UDK Already on 'rudk' Your branch is up to date with 'origin/rudk'. Everything up-to-date From https://github.com/dakanji/Refind-UDK * branch rudk -> FETCH_HEAD Already up to date. Everything up-to-date Everything up-to-date Synced Refind-UDK Syncing RefindPlus Already on 'GOPFix' Your branch is up to date with 'origin/GOPFix'. Everything up-to-date From https://github.com/dakanji/RefindPlus * branch GOPFix -> FETCH_HEAD Already up to date. Everything up-to-date Everything up-to-date Synced RefindPlus ----------------- ## RepoUpdater ## ```

The above output is with both lines commented and running the script from outside RefindPlus folder.

startergo commented 3 years ago
Output ``` git log -p -2 commit 9054d7305eddf65230dcf0a91a5c09f4e6a03f10 (HEAD -> GOPFix, upstream/GOPFix, origin/HEAD, origin/GOPFix) Author: dakanji Date: Thu Jan 7 13:16:54 2021 +0300 Update Boot Loading Screen Fix diff --git a/EfiLib/BdsConnect.c b/EfiLib/BdsConnect.c index 8727e07..d0c741d 100644 --- a/EfiLib/BdsConnect.c +++ b/EfiLib/BdsConnect.c @@ -547,7 +547,7 @@ ApplyGOPFix ( if (!EFI_ERROR (Status)) { Status = AcquireGOP(); #if REFIT_DEBUG > 0 - MsgLog ("INFO: Acquire GOP on RAM ...%r\n\n", Status); + MsgLog ("INFO: Acquire GOP on Random Access Memory ...%r\n\n", Status);^M #endif // connect all devices diff --git a/MainRP/main.c b/MainRP/main.c index c849ad6..507bae8 100644 --- a/MainRP/main.c +++ b/MainRP/main.c @@ -627,7 +627,11 @@ OpenProtocolEx ( IN EFI_HANDLE ControllerHandle, IN UINT32 Attributes ) { ```
dakanji commented 3 years ago

Still don't understand.

As far as I can see, your two forks are aligned with the respective upstream repos which is what the outcome is supposed to be.

startergo commented 3 years ago

Still don't understand.

As far as I can see, your two forks are aligned with the respective upstream repos which is what the outcome is supposed to be.

When you make a change the issue will be more obvious. I will update the results.

dakanji commented 3 years ago

Reviewed the outputs posted and done tests. The script is working correctly as it is supposed to. End result is always that your local and remote repos are synced with the upstream repo.

startergo commented 3 years ago

I have just updated the repo:

Output ```RepoUpdater.sh ## RepoUpdater ## ----------------- Syncing Refind-UDK Already on 'rudk' Your branch is up to date with 'origin/rudk'. HEAD is now at 56c1ccd8 Update gitignore Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/Refind-UDK.git + 7252fc23...56c1ccd8 HEAD -> rudk (forced update) From https://github.com/dakanji/Refind-UDK * branch rudk -> FETCH_HEAD Updating 56c1ccd8..7252fc23 Fast-forward .github/ISSUE_TEMPLATE/bug-report.md | 35 +++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature-request.md | 20 ++++++++++++++++++ 000-BuildScript/RepoUpdateSHA.txt | 8 +++++++ 000-BuildScript/RepoUpdater.sh | 6 ++++-- 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug-report.md create mode 100644 .github/ISSUE_TEMPLATE/feature-request.md create mode 100644 000-BuildScript/RepoUpdateSHA.txt Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/Refind-UDK.git 56c1ccd8..7252fc23 rudk -> rudk Everything up-to-date Synced Refind-UDK Syncing RefindPlus Already on 'GOPFix' Your branch is up to date with 'origin/GOPFix'. HEAD is now at 60644bd Update for v0.12.0.AN Release Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/RefindPlus.git + d75d4e9...60644bd HEAD -> GOPFix (forced update) From https://github.com/dakanji/RefindPlus * branch GOPFix -> FETCH_HEAD Updating 60644bd..d75d4e9 Fast-forward EfiLib/AcquireGOP.c | 4 + EfiLib/AmendSysTable.c | 26 ++- EfiLib/BdsConnect.c | 18 +- MainRP/apple.c | 92 ++++++-- MainRP/apple.h | 68 +++--- MainRP/config.c | 21 +- MainRP/driver_support.c | 146 +++++-------- MainRP/driver_support.h | 1 - MainRP/global.h | 2 +- MainRP/install.c | 118 +++++++--- MainRP/launch_efi.c | 16 +- MainRP/launch_legacy.c | 2 + MainRP/lib.c | 16 +- MainRP/main.c | 308 +++++++++++++++++++++------ MainRP/menu.c | 23 +- MainRP/scan.c | 38 ++-- MainRP/screen.c | 100 +++++---- MainRP/screen.h | 2 +- NEWS.txt | 9 + README.md | 8 +- config.conf-sample | 142 ++++++------ filesystems/RamDiskDxe/RamDiskFileExplorer.c | 2 +- filesystems/RamDiskDxe/RamDiskImpl.h | 2 +- include/version.h | 2 +- libeg/screen.c | 131 +++++------- mok/mok.c | 6 + mountesp | 2 +- refind-install | 4 +- 28 files changed, 816 insertions(+), 493 deletions(-) Total 0 (delta 0), reused 0 (delta 0) To https://github.com/startergo/RefindPlus.git 60644bd..d75d4e9 GOPFix -> GOPFix Everything up-to-date Synced RefindPlus ----------------- ## RepoUpdater ## ```

Then I looked at the changed file and compared with the contents of the local file:

                    }
                    else {
                        Status = refit_call3_wrapper(gBS->StartImage, ImageHandle, NULL, NULL);
                    }
                }

                MyFreePool (DecompressedImageBuffer);
            }
        }

As you can see the local file was not updated.

startergo commented 3 years ago

I deleted the contents of both local repos (without the hidden files) and ran the script again from outside the main RefindPlus folder (with hard reset pointing to the latest commits). Now the old RefindPlus folder inside EDK2 is gone and the AcquireGOP.c is directly under Efilib inside Working directory.

dakanji commented 3 years ago

Still not seeing your issue and it is still not clear what the issue actually is from your posts. As far as I can see, your GitHub repos are synced which is how they are supposed to be after running the script.

If you can present a situation where you have run the script and your repos on GitHub are not synced with upstream, then there will be something to look into. That is, run the script and leave in the "broken" state to check as otherwise, things look to be working as expected.

startergo commented 3 years ago

Still not seeing your issue and it is still not clear what the issue actually is from your posts. As far as I can see, your GitHub repos are synced which is how they are supposed to be after running the script.

If you can present a situation where you have run the script and your repos on GitHub are not synced with upstream, then there will be something to look into. That is, run the script and leave in the "broken" state to check as otherwise, things look to be working as expected.

My GitHub repos automatically update without my intervention. I have issue matching my local folders with the github repo using the update script. Basically the script claims everything matches, but when I inspect the files manually that is not the case. If the repo commit number was included in the debug file it would have been easier to troubleshoot.

dakanji commented 3 years ago

Well, what the script does is this:

  1. It checks the default branch out
  2. It resets your local repo default branch to a specified commit in the past
  3. It forces your remote repo default branch to the same commit as the local repo is now at
  4. it pulls the current upstream repo default branch to your local repo default branch
    • At which point your local repo and the upstream are the same
  5. it pushes your local repo default branch to your remote repo default branch
    • At which point your local and remote repos are the same with the upstream repo
  6. It pushes tags from local repo to your remote repo

It appears to be doing just that as I can map each of those steps to your outputs.

Example: **1: Checkouts rudk** ``` Already on 'rudk' Your branch is up to date with 'origin/rudk'. ``` **2: Resets your local repo to a specified commit in the past** **Reset local repo to SHA 56c1ccd8** ``` HEAD is now at 56c1ccd8 Update gitignore Total 0 (delta 0), reused 0 (delta 0) ``` **3: Forces your remote repo default branch to that same commit as the local repo is now at (56c1ccd8)** **Your remote is set from 7252fc23 to 56c1ccd8** ``` To https://github.com/startergo/Refind-UDK.git + 7252fc23...56c1ccd8 HEAD -> rudk (forced update) ``` **4: Pulls the current upstream repo default branch to your local repo default branch** **Moved your local from 56c1ccd8 to 7252fc23** ``` From https://github.com/dakanji/Refind-UDK branch rudk -> FETCH_HEAD Updating 56c1ccd8..7252fc23 Fast-forward .github/ISSUE_TEMPLATE/bug-report.md | 35 +++++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature-request.md | 20 ++++++++++++++++++ 000-BuildScript/RepoUpdateSHA.txt | 8 +++++++ 000-BuildScript/RepoUpdater.sh | 6 ++++-- 4 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug-report.md create mode 100644 .github/ISSUE_TEMPLATE/feature-request.md create mode 100644 000-BuildScript/RepoUpdateSHA.txt Total 0 (delta 0), reused 0 (delta 0) ``` **5: Pushes your local repo default branch to your remote repo default branch** **Your remote is set from 56c1ccd8 to 7252fc23** ``` To https://github.com/startergo/Refind-UDK.git 56c1ccd8..7252fc23 rudk -> rudk ``` **6: Pushes tags from local repo to your remote repo** `Everything up-to-date`

You were obviously running on synced repos since everything started and ended at 7252fc23.

Anyway, as far I can see, it is working as expected. Now, you might have a crash when running before the commit that fixed #7, but just run again and all should be synced.

As for debug log containing github commits, that one is not as good idea as it may sound.

Anyone that wants to build can easily make sure they are synced before doing a build. They will need to go and check that what they see there matches in the first place anyway. So why not just sync anyway?

BTW, if you already have something that syncs your remote with the upstream, then no need to use this script at all. Just sync your local with your remote yourself by using git pull.