Skip to content

Fix bug in snippets updating only file_name or content

Francisco Javier López requested to merge fj-fix-single-param-update into master

What does this MR do?

This MR fixes the bug referenced in #219348 (closed)

The problem is that when only file_name is passed the content used to the repository action is nil. The multi_action method uses this value as the new content instead of ignoring it.

We also discovered another edge case when only the content params is passed.

Therefore, this MRs implements the following:

  • When the operation is a move operation, which means that the file_name value is different from the existing file_name in the repo, we set the param infer in the commit action. This is part of the rugged library and basically means that the operation has to use the existing content for the commit action.
  • When the operation is an update one:
    • If only the file_name param is passed and its value is the same as the one in the repo, we don't commit anything since it's basically what that operation represents.
    • If only the content param is passed we use the existing file_name in the repo as the file_name for the commit operation.

Refs #219348 (closed)

Does this MR meet the acceptance criteria?

Conformity

Edited by Francisco Javier López

Merge request reports

Loading