-
Notifications
You must be signed in to change notification settings - Fork 3
gh-18 : fix git version 2.49.0 test problem #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
80ce19c
0b90117
cef6e96
477994d
7e8e207
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ | |
**/.clone | ||
**/git-test.log | ||
**/run.log | ||
**/nok.log | ||
**/ok.log |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
* (HEAD, tag: v2.0) v2.0 | ||
| * (tag: v1.0) v1.0 | ||
|/ | ||
* (origin/main, origin/HEAD, main) First commit of git artifact | ||
* (origin/main, main) First commit of git artifact |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
* (HEAD -> main, origin/main, origin/HEAD) First commit of git artifact | ||
* (HEAD -> main, origin/main) First commit of git artifact |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
* (tag: v4.1, origin/latest) v4.1 | ||
| * (tag: v4.0) v4.0 | ||
|/ | ||
* (HEAD -> latest, origin/main, origin/HEAD, main) First commit of git artifact | ||
* (HEAD -> latest, origin/main, main) First commit of git artifact |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
* (HEAD, tag: v1.0) v1.0 | ||
* (origin/main, origin/HEAD, main, latest) First commit of git artifact | ||
* (origin/main, main, latest) First commit of git artifact |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,7 +3,10 @@ | |||||||||||||||||||||||||||||||||||||||||||||||
clear | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
set -euo pipefail | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainConsider the interaction between The Run this script to check if there are any commands outside the test blocks that could fail: 🏁 Script executed: #!/bin/bash
# Check for potentially failing commands outside test execution blocks
echo "Checking for commands that might fail with set -e enabled..."
echo "Commands between test blocks:"
gawk '/^[[:space:]]*} > .*\/run\.log 2>&1[[:space:]]*$/{intest=0} !intest && !/^[[:space:]]*#/ && !/^[[:space:]]*$/ && /[a-zA-Z]/ {print NR ": " $0} /^[[:space:]]*{[[:space:]]*$/{intest=1}' _tests.sh Length of output: 3964 Prevent unintended exits from setup commands under The initial setup and function definitions in
If any of these commands return a non-zero status, To guard against this, consider one of the following fixes:
This will ensure that an unexpected failure in your environment setup doesn’t bypass the aggregated test summary. 🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||
[[ ${debug:-} == true ]] && set -x | ||||||||||||||||||||||||||||||||||||||||||||||||
[[ ${debug:-} == true ]] && { | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "debug: ${debug}" | ||||||||||||||||||||||||||||||||||||||||||||||||
set -x | ||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||
PATH=$(pwd):$PATH | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
which git | ||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -17,7 +20,7 @@ git clean -xffdq . | |||||||||||||||||||||||||||||||||||||||||||||||
local_tester_repo=.local | ||||||||||||||||||||||||||||||||||||||||||||||||
remote_tester_repo=.remote | ||||||||||||||||||||||||||||||||||||||||||||||||
clone_tester_repo=.clone | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
global_exit_code=0 | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
function testcase_header() { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -30,25 +33,34 @@ function testcase_header() { | |||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
function eval_testcase() { | ||||||||||||||||||||||||||||||||||||||||||||||||
# expect to be in repo to test against | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
# In git 2.48 changes the way HEAD is handled and for some reason it is not set | ||||||||||||||||||||||||||||||||||||||||||||||||
# in order to be backward compatible we remove the HEAD reference | ||||||||||||||||||||||||||||||||||||||||||||||||
rm -rf .git/refs/remotes/origin/HEAD | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
if ! [[ -s "${root_folder}/${test}/git-test.log" ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||
git log --graph --all --oneline --decorate --format="%d %s" > "${root_folder}/${test}/git-test.log" | ||||||||||||||||||||||||||||||||||||||||||||||||
git log --graph --all --oneline --format="%d %s" > "${root_folder}/${test}/git-test.log" | ||||||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||||||
[[ ${debug:-} == true ]] && echo "Test $test : INFO: ${root_folder}/${test}/git-test.log is already available - use it" | ||||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||||
cd "${root_folder}/${test}" | ||||||||||||||||||||||||||||||||||||||||||||||||
if diff -w git-test.log git-reference.log ; then | ||||||||||||||||||||||||||||||||||||||||||||||||
if diff -w git-reference.log git-test.log ; then | ||||||||||||||||||||||||||||||||||||||||||||||||
if [[ ${verbose:-} == true ]] ; then | ||||||||||||||||||||||||||||||||||||||||||||||||
cat git-test.log | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "Test $test : OK" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo | ||||||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "Test $test : OK : ${testcase_synopsis}" | ||||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||||
mv run.log ok.log | ||||||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "ERROR: Test $test failed: ${testcase_synopsis}" | ||||||||||||||||||||||||||||||||||||||||||||||||
exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "Test $test : NOK : ${testcase_synopsis}" | ||||||||||||||||||||||||||||||||||||||||||||||||
mv run.log nok.log | ||||||||||||||||||||||||||||||||||||||||||||||||
[[ ${verbose:-} == true ]] && cat git-test.log | ||||||||||||||||||||||||||||||||||||||||||||||||
global_exit_code=2 | ||||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+55
to
61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Potential false-negative when - if diff -w git-test.log git-reference.log ; then
+ diff -w git-test.log git-reference.log
+ rc=$?
+ if [[ $rc -eq 0 ]]; then
…
+ elif [[ $rc -eq 1 ]]; then # files differ – expected branch
+ …
+ else # diff crashed
+ echo "Test $test : ERROR (diff failed, rc=$rc)"
+ global_exit_code=2
+ fi 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||
cd "${root_folder}" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo | ||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
function generate_base_repo() { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -70,7 +82,10 @@ function generate_base_repo() { | |||||||||||||||||||||||||||||||||||||||||||||||
cd .. | ||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
echo "Running testcases; You can find run details for each test in <test>/run.log" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "Running testcases; You can find run details for each test in:" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo " - <test>/run.log(unknown)" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo " - <test>/ok.log(all good)" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo " - <test>/nok.log(failed tests)" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
export test="1" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -197,3 +212,30 @@ testcase_header | |||||||||||||||||||||||||||||||||||||||||||||||
git artifact fetch-tags --sha1 "$sha1" | ||||||||||||||||||||||||||||||||||||||||||||||||
} > ${test}/run.log 2>&1 || cat ../${test}/run.log | ||||||||||||||||||||||||||||||||||||||||||||||||
eval_testcase | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
echo | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "########################################" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "All tests completed. Checking results..." | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "########################################" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
if [[ ${global_exit_code:-0} -eq 0 ]]; then | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "All tests passed successfully." | ||||||||||||||||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||||||||||||||||
echo | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "Contents of failed test logs:" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "-----------------------------" | ||||||||||||||||||||||||||||||||||||||||||||||||
for log in $( find . -name run.log -o -name nok.log | sort ); do | ||||||||||||||||||||||||||||||||||||||||||||||||
echo | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "--- $log start ------------------------" | ||||||||||||||||||||||||||||||||||||||||||||||||
cat $log | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "--- $log end ------------------------" | ||||||||||||||||||||||||||||||||||||||||||||||||
echo | ||||||||||||||||||||||||||||||||||||||||||||||||
done | ||||||||||||||||||||||||||||||||||||||||||||||||
echo | ||||||||||||||||||||||||||||||||||||||||||||||||
echo "Some tests failed. - List of logs:" | ||||||||||||||||||||||||||||||||||||||||||||||||
find . -name run.log -o -name nok.log | sort | ||||||||||||||||||||||||||||||||||||||||||||||||
echo | ||||||||||||||||||||||||||||||||||||||||||||||||
fi | ||||||||||||||||||||||||||||||||||||||||||||||||
# Exit with the global exit code | ||||||||||||||||||||||||||||||||||||||||||||||||
exit $global_exit_code |
Uh oh!
There was an error while loading. Please reload this page.