Hi,
Just my two cents: - I suggest using $() instead of the backtick operator to enhance readability. This means f=`git rev-parse --git-dir` becomes f=$(git rev-parse --git-dir) - use {} to group commands instead of () (no sub-shell is needed) - stop processing if curl fails (hence second {} block) - if the repo path has spaces, then some quotes are missing
So finally the command would become: git clone --recurse-submodules https://git.trustedfirmware.org/hafnium/hafnium.git && { cd hafnium && f="$(git rev-parse --git-dir)"; curl -Lo "$f/hooks/commit-msg" https://review.trustedfirmware.org/tools/hooks/commit-msg && { chmod +x "$f/hooks/commit-msg"; git submodule --quiet foreach "cp "$toplevel/$f/hooks/commit-msg" "$toplevel/$f/modules/$path/hooks/commit-msg"" ; } ; }
/George
-----Original Message----- From: Hafnium hafnium-bounces@lists.trustedfirmware.org On Behalf Of Olivier Deprez via Hafnium Sent: 21 April 2021 19:12 To: Rebecca Cran rebecca@bsdio.com; hafnium@lists.trustedfirmware.org Subject: Re: [Hafnium] Getting Started page: problem with the command under "Getting the source code"
Hi,
Ah sorry for that; looks like there's some variable escape problem. I tried this with success, let me know if it works for you. I will update the doc page then.
git clone --recurse-submodules https://git.trustedfirmware.org/hafnium/hafnium.git && (cd hafnium && f=`git rev-parse --git-dir`; curl -Lo $f/hooks/commit-msg https://review.trustedfirmware.org/tools/hooks/commit-msg; chmod +x $f/hooks/commit-msg; git submodule --quiet foreach "cp $toplevel/$f/hooks/commit-msg $toplevel/$f/modules/$path/hooks/commit-msg")
If you don't require the git hooks a simpler way to clone the project can be:
git clone "https://review.trustedfirmware.org/hafnium/hafnium"; cd hafnium git submodule update --init
Regards, Olivier.
________________________________________ From: Rebecca Cran rebecca@bsdio.com Sent: 21 April 2021 16:33 To: Olivier Deprez; hafnium@lists.trustedfirmware.org Subject: Re: [Hafnium] Getting Started page: problem with the command under "Getting the source code"
It now exits with the message:
cp: cannot stat '/home/rebecca/src/uefi/tmp/hafnium//hooks/commit-msg': No such file or directory fatal: run_command returned non-zero status for driver/linux .
-- Rebecca Cran
On 4/21/21 2:23 AM, Olivier Deprez wrote:
Hi Rebecca,
Thanks for reporting.
Can you try with the updated command: https://review.trustedfirmware.org/plugins/gitiles/hafnium/hafnium/+/r efs/changes/31/9731/1/docs/GettingStarted.md
Thanks, Olivier.
From: Hafnium hafnium-bounces@lists.trustedfirmware.org on behalf of Rebecca Cran via Hafnium hafnium@lists.trustedfirmware.org Sent: 21 April 2021 04:39 To: hafnium@lists.trustedfirmware.org Subject: [Hafnium] Getting Started page: problem with the command under "Getting the source code"
On the Getting Started document (https://review.trustedfirmware.org/plugins/gitiles/hafnium/hafnium/+/ HEAD/docs/GettingStarted.md) there's a command listed to get the source code:
git clone --recurse-submodules https://git.trustedfirmware.org/hafnium/hafnium.git && (cd hafnium && f=`git rev-parse --git-dir`/hooks/commit-msg ; curl -Lo $f https://review.trustedfirmware.org/tools/hooks/commit-msg ; chmod +x $f ; for m in `git rev-parse --git-dir`/modules/*; do cp $f $m/hooks/commit-msg; done)
However, on my system it's erroring out because the 'hooks' directory it tries to write to doesn't exist:
% Total % Received % Xferd Average Speed Time Time Time
Current Dload Upload Total Spent Left Speed 100 2174 100 2174 0 0 4221 0 --:--:-- --:--:-- --:--:-- 4221 cp: cannot create regular file '.git/modules/driver/hooks/commit-msg': No such file or directory cp: cannot create regular file '.git/modules/project/hooks/commit-msg': No such file or directory cp: cannot create regular file '.git/modules/third_party/hooks/commit-msg': No such file or directory
-- Rebecca Cran
-- Hafnium mailing list Hafnium@lists.trustedfirmware.org https://lists.trustedfirmware.org/mailman/listinfo/hafnium
-- Hafnium mailing list Hafnium@lists.trustedfirmware.org https://lists.trustedfirmware.org/mailman/listinfo/hafnium