Skip to content

add ci script to ckeck for git unresolved conflicts#23961

Merged
cedric-anne merged 1 commit intoglpi-project:11.0/bugfixesfrom
SebSept:ci-unresolved-conflicts-10
Apr 29, 2026
Merged

add ci script to ckeck for git unresolved conflicts#23961
cedric-anne merged 1 commit intoglpi-project:11.0/bugfixesfrom
SebSept:ci-unresolved-conflicts-10

Conversation

@SebSept
Copy link
Copy Markdown
Contributor

@SebSept SebSept commented Apr 17, 2026

Description

Add a ci script to check for unresolved git conflicts.

To avoid pr like #23834 to be merged.

@SebSept SebSept self-assigned this Apr 17, 2026
Copy link
Copy Markdown
Contributor

@stonebuzz stonebuzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be added directly within a Rector rule (perhaps), so that we can also benefit from it across plugins as well?

@SebSept
Copy link
Copy Markdown
Contributor Author

SebSept commented Apr 21, 2026

Rector is not the appropriate tool, but the idea good.
I add this to my todolist.

if [[ -n $(grep "warning" extract.log) ]]; then exit 1; fi

echo "Check for unresolved git merge conflict markers..."
CONFLICT_MATCHES=$(grep -rn '<<<<<<<\|>>>>>>>' \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

======= should be detected too.

Suggested change
CONFLICT_MATCHES=$(grep -rn '<<<<<<<\|>>>>>>>' \
CONFLICT_MATCHES=$(grep -rn '<<<<<<<\|=======\|>>>>>>>' \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have suite of = signs in the code:

install/empty_data.php:                'content_text' => '======================================================================
install/empty_data.php:======================================================================',
tests/imap/MailCollectorTest.php:================================

Those should be changed to apply suggestion.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this === have a special meaning in glpi_notificationtemplatetranslations table ? @stonebuzz @trasher ? or can I just remove them ? (a quick search in code tells me there is nothing special with this =)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically, the chevrons alone are enough, but if you want, I'll add this @cedric-anne

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manual conflict resolution can result in having only the ======= line remaining, so if we want a complete detection, it is better to add it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I agree it should be detected.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this === have a special meaning in glpi_notificationtemplatetranslations table ?

Seems like it's just a kind of "visual separator"; I guess it can be replaced.

Copy link
Copy Markdown
Member

@AdrienClairembault AdrienClairembault Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this === have a special meaning in glpi_notificationtemplatetranslations table ? @stonebuzz @trasher ? or can I just remove them ? (a quick search in code tells me there is nothing special with this =)

It is part of the template text, isn't it? Not saying this template doesn't deserve to be changed, but it is completely unrelated to the scope of this PR.

My opinion is that the goal of this PR is to spot forgotten conflicts, which it does very well.
Spending time handling all possible cases where someone miss-edited a conflict is out of scope and probably not worth it (there are a lot more possibilities than just some "===" left over).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost everytime I have a conflict to handle, I do it manually. So there are the same risk to forgot a ======== line than to forgot a <<<<<<<< line.

Anyway, this can be done later.

@cedric-anne cedric-anne merged commit 84f9b3e into glpi-project:11.0/bugfixes Apr 29, 2026
11 checks passed
@SebSept SebSept deleted the ci-unresolved-conflicts-10 branch April 29, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants