fix: replace broken SVG icons with official SDK versions and fix sync script bug
- Replace images/photo.svg with images/svg/send_image.svg - Replace images/file.svg with images/svg/send_file.svg - Fix critical bug in sync_from_upstream.sh: now correctly preserves protected paths by using pre-merge commit - Update LOCAL_CHANGES.md with detailed documentation
This commit is contained in:
parent
ae6d2f4b6a
commit
46142714c9
|
|
@ -26,6 +26,21 @@
|
|||
* `Positioned` 底部距离从 `20` 调整为 `50`。
|
||||
* `Positioned` 左右距离从 `20` 调整为 `10`。
|
||||
|
||||
### `lib/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_more_panel.dart`
|
||||
* **修改日期**: 2026-01-05
|
||||
* **修改目的**: 修复底部"照片"、"文件"图标显示为纯黑色的问题。
|
||||
* **详细改动**:
|
||||
* 将本地 `images/photo.svg` 替换为官方 SDK 的 `images/svg/send_image.svg`。
|
||||
* 将本地 `images/file.svg` 替换为官方 SDK 的 `images/svg/send_file.svg`。
|
||||
* **原因**: 在上游同步时,本地 SVG 文件被覆盖为缺少 `fill` 属性的版本,导致渲染为黑色。
|
||||
|
||||
### `scripts/sync_from_upstream.sh`
|
||||
* **修改日期**: 2026-01-05
|
||||
* **修改目的**: 修复同步脚本的关键 bug,确保 `images/` 真正被保护。
|
||||
* **详细改动**:
|
||||
* 在合并前保存 master 的 commit hash (`MASTER_BEFORE_MERGE`)。
|
||||
* 在恢复保护路径时使用保存的 commit,而非 `HEAD`(`HEAD` 在合并后已被污染)。
|
||||
|
||||
---
|
||||
|
||||
## 3. 维护指南 (Maintenance Guide)
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ class MorePanelItem {
|
|||
final Widget icon;
|
||||
final Function(BuildContext context)? onTap;
|
||||
|
||||
MorePanelItem({this.onTap, required this.icon, required this.id, required this.title});
|
||||
MorePanelItem(
|
||||
{this.onTap, required this.icon, required this.id, required this.title});
|
||||
}
|
||||
|
||||
class MorePanel extends StatefulWidget {
|
||||
|
|
@ -84,7 +85,11 @@ class MorePanel extends StatefulWidget {
|
|||
|
||||
final MorePanelConfig? morePanelConfig;
|
||||
|
||||
const MorePanel({required this.conversationID, required this.conversationType, Key? key, this.morePanelConfig})
|
||||
const MorePanel(
|
||||
{required this.conversationID,
|
||||
required this.conversationType,
|
||||
Key? key,
|
||||
this.morePanelConfig})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
|
|
@ -93,7 +98,8 @@ class MorePanel extends StatefulWidget {
|
|||
|
||||
class _MorePanelState extends TIMUIKitState<MorePanel> {
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
final TUISelfInfoViewModel _selfInfoViewModel = serviceLocator<TUISelfInfoViewModel>();
|
||||
final TUISelfInfoViewModel _selfInfoViewModel =
|
||||
serviceLocator<TUISelfInfoViewModel>();
|
||||
Uint8List? fileContent;
|
||||
String? fileName;
|
||||
File? tempFile;
|
||||
|
|
@ -114,7 +120,8 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
isInstallCallkit = value;
|
||||
});
|
||||
});
|
||||
_betterPlayerController = BetterPlayerController(const BetterPlayerConfiguration());
|
||||
_betterPlayerController =
|
||||
BetterPlayerController(const BetterPlayerConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -137,9 +144,11 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
height: 64,
|
||||
width: 64,
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: SvgPicture.asset(
|
||||
"images/photo.svg",
|
||||
"images/svg/send_image.svg",
|
||||
package: 'tencent_cloud_chat_uikit',
|
||||
height: 64,
|
||||
width: 64,
|
||||
|
|
@ -156,7 +165,9 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
height: 64,
|
||||
width: 64,
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: SvgPicture.asset(
|
||||
"images/screen.svg",
|
||||
package: 'tencent_cloud_chat_uikit',
|
||||
|
|
@ -175,7 +186,9 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
height: 64,
|
||||
width: 64,
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: Image.asset(
|
||||
"images/take_video.png",
|
||||
package: 'tencent_cloud_chat_uikit',
|
||||
|
|
@ -199,9 +212,11 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
height: 64,
|
||||
width: 64,
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: SvgPicture.asset(
|
||||
"images/photo.svg",
|
||||
"images/svg/send_image.svg",
|
||||
package: 'tencent_cloud_chat_uikit',
|
||||
height: 64,
|
||||
width: 64,
|
||||
|
|
@ -223,8 +238,11 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
height: 64,
|
||||
width: 64,
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: Icon(Icons.video_file, color: hexToColor("5c6168"), size: 26),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child:
|
||||
Icon(Icons.video_file, color: hexToColor("5c6168"), size: 26),
|
||||
)),
|
||||
MorePanelItem(
|
||||
id: "file",
|
||||
|
|
@ -241,9 +259,11 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
height: 64,
|
||||
width: 64,
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: SvgPicture.asset(
|
||||
"images/file.svg",
|
||||
"images/svg/send_file.svg",
|
||||
package: 'tencent_cloud_chat_uikit',
|
||||
height: 64,
|
||||
width: 64,
|
||||
|
|
@ -265,7 +285,9 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
height: 64,
|
||||
width: 64,
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: SvgPicture.asset(
|
||||
"images/video-call.svg",
|
||||
package: 'tencent_cloud_chat_uikit',
|
||||
|
|
@ -289,7 +311,9 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
height: 64,
|
||||
width: 64,
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
decoration: const BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: SvgPicture.asset(
|
||||
"images/voice-call.svg",
|
||||
package: 'tencent_cloud_chat_uikit',
|
||||
|
|
@ -328,9 +352,11 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
}).toList();
|
||||
}
|
||||
|
||||
_sendVideoMessage(String originFilePath, int duration, int size, TUIChatSeparateViewModel model) async {
|
||||
_sendVideoMessage(String originFilePath, int duration, int size,
|
||||
TUIChatSeparateViewModel model) async {
|
||||
if (size >= MorePanelConfig.VIDEO_MAX_SIZE) {
|
||||
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||
onTIMCallback(TIMCallback(
|
||||
type: TIMCallbackType.INFO, infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -339,7 +365,9 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
final convID = widget.conversationID;
|
||||
final convType = widget.conversationType;
|
||||
|
||||
String tempPath = (await getTemporaryDirectory()).path + p.basename(originFilePath) + ".jpeg";
|
||||
String tempPath = (await getTemporaryDirectory()).path +
|
||||
p.basename(originFilePath) +
|
||||
".jpeg";
|
||||
|
||||
await plugin.getVideoThumbnail(
|
||||
srcFile: originFilePath,
|
||||
|
|
@ -351,7 +379,11 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
);
|
||||
MessageUtils.handleMessageError(
|
||||
model.sendVideoMessage(
|
||||
videoPath: originFilePath, duration: duration, snapshotPath: tempPath, convID: convID, convType: convType),
|
||||
videoPath: originFilePath,
|
||||
duration: duration,
|
||||
snapshotPath: tempPath,
|
||||
convID: convID,
|
||||
convType: convType),
|
||||
context);
|
||||
}
|
||||
|
||||
|
|
@ -411,34 +443,47 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
if (filePath != null) {
|
||||
if (type == AssetType.image) {
|
||||
if (size >= MorePanelConfig.IMAGE_MAX_SIZE) {
|
||||
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||
onTIMCallback(TIMCallback(
|
||||
type: TIMCallbackType.INFO,
|
||||
infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||
return;
|
||||
}
|
||||
|
||||
MessageUtils.handleMessageError(
|
||||
model.sendImageMessage(imagePath: filePath, convID: convID, convType: convType), context);
|
||||
model.sendImageMessage(
|
||||
imagePath: filePath,
|
||||
convID: convID,
|
||||
convType: convType),
|
||||
context);
|
||||
}
|
||||
|
||||
if (type == AssetType.video) {
|
||||
_sendVideoMessage(originFile!.path, asset.videoDuration.inSeconds, size, model);
|
||||
_sendVideoMessage(originFile!.path,
|
||||
asset.videoDuration.inSeconds, size, model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FilePickerResult? result = await FilePicker.platform.pickFiles(type: FileType.media);
|
||||
FilePickerResult? result =
|
||||
await FilePicker.platform.pickFiles(type: FileType.media);
|
||||
if (result != null && result.files.isNotEmpty) {
|
||||
File file = File(result.files.single.path!);
|
||||
final String savePath = file.path;
|
||||
final String type =
|
||||
TencentUtils.getFileType(savePath.split(".")[savePath.split(".").length - 1]).split("/")[0];
|
||||
final String type = TencentUtils.getFileType(
|
||||
savePath.split(".")[savePath.split(".").length - 1])
|
||||
.split("/")[0];
|
||||
|
||||
if (type == "image") {
|
||||
MessageUtils.handleMessageError(
|
||||
model.sendImageMessage(imagePath: savePath, convID: convID, convType: convType), context);
|
||||
model.sendImageMessage(
|
||||
imagePath: savePath, convID: convID, convType: convType),
|
||||
context);
|
||||
} else if (type == "video") {
|
||||
MessageUtils.handleMessageError(
|
||||
model.sendVideoMessage(videoPath: savePath, convID: convID, convType: convType), context);
|
||||
model.sendVideoMessage(
|
||||
videoPath: savePath, convID: convID, convType: convType),
|
||||
context);
|
||||
}
|
||||
} else {
|
||||
throw TypeError();
|
||||
|
|
@ -449,7 +494,8 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
}
|
||||
}
|
||||
|
||||
_sendImageFromCamera(TUIChatSeparateViewModel model, TUITheme theme, {required isVideo}) async {
|
||||
_sendImageFromCamera(TUIChatSeparateViewModel model, TUITheme theme,
|
||||
{required isVideo}) async {
|
||||
try {
|
||||
if (!await Permissions.checkPermission(
|
||||
context,
|
||||
|
|
@ -476,18 +522,25 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
final size = await originFile!.length();
|
||||
if (!isVideo) {
|
||||
if (size >= MorePanelConfig.IMAGE_MAX_SIZE) {
|
||||
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||
onTIMCallback(TIMCallback(
|
||||
type: TIMCallbackType.INFO,
|
||||
infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||
return;
|
||||
}
|
||||
|
||||
MessageUtils.handleMessageError(
|
||||
model.sendImageMessage(imagePath: originFile.path, convID: convID, convType: convType), context);
|
||||
model.sendImageMessage(
|
||||
imagePath: originFile.path, convID: convID, convType: convType),
|
||||
context);
|
||||
} else {
|
||||
// 监听视频准备完成事件
|
||||
_betterPlayerController.addEventsListener((event) {
|
||||
if (event.betterPlayerEventType == BetterPlayerEventType.initialized) {
|
||||
if (event.betterPlayerEventType ==
|
||||
BetterPlayerEventType.initialized) {
|
||||
// 获取视频时长(单位:秒)
|
||||
int durationInSeconds = _betterPlayerController.videoPlayerController?.value.duration?.inSeconds ?? 0;
|
||||
int durationInSeconds = _betterPlayerController
|
||||
.videoPlayerController?.value.duration?.inSeconds ??
|
||||
0;
|
||||
_sendVideoMessage(originFile!.path, durationInSeconds, size, model);
|
||||
}
|
||||
});
|
||||
|
|
@ -514,12 +567,17 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
fileContent = imageContent;
|
||||
|
||||
html.Node? inputElem;
|
||||
inputElem = html.document.getElementById("__image_picker_web-file-input")?.querySelector("input");
|
||||
inputElem = html.document
|
||||
.getElementById("__image_picker_web-file-input")
|
||||
?.querySelector("input");
|
||||
final convID = widget.conversationID;
|
||||
final convType = widget.conversationType;
|
||||
MessageUtils.handleMessageError(
|
||||
model.sendImageMessage(
|
||||
inputElement: inputElem, imagePath: tempFile?.path, convID: convID, convType: convType),
|
||||
inputElement: inputElem,
|
||||
imagePath: tempFile?.path,
|
||||
convID: convID,
|
||||
convType: convType),
|
||||
context);
|
||||
} catch (e) {
|
||||
outputLogger.i("_sendFileErr: ${e.toString()}");
|
||||
|
|
@ -535,18 +593,25 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
fileContent = videoContent;
|
||||
|
||||
if (fileName!.split(".")[fileName!.split(".").length - 1] != "mp4") {
|
||||
onTIMCallback(
|
||||
TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("视频消息仅限 mp4 格式"), infoCode: 6660412));
|
||||
onTIMCallback(TIMCallback(
|
||||
type: TIMCallbackType.INFO,
|
||||
infoRecommendText: TIM_t("视频消息仅限 mp4 格式"),
|
||||
infoCode: 6660412));
|
||||
return;
|
||||
}
|
||||
|
||||
html.Node? inputElem;
|
||||
inputElem = html.document.getElementById("__image_picker_web-file-input")?.querySelector("input");
|
||||
inputElem = html.document
|
||||
.getElementById("__image_picker_web-file-input")
|
||||
?.querySelector("input");
|
||||
final convID = widget.conversationID;
|
||||
final convType = widget.conversationType;
|
||||
MessageUtils.handleMessageError(
|
||||
model.sendVideoMessage(
|
||||
inputElement: inputElem, videoPath: tempFile?.path, convID: convID, convType: convType),
|
||||
inputElement: inputElem,
|
||||
videoPath: tempFile?.path,
|
||||
convID: convID,
|
||||
convType: convType),
|
||||
context);
|
||||
} catch (e) {
|
||||
outputLogger.i("_sendFileErr: ${e.toString()}");
|
||||
|
|
@ -564,29 +629,43 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
if (result != null && result.files.isNotEmpty) {
|
||||
if (PlatformUtils().isWeb) {
|
||||
html.Node? inputElem;
|
||||
inputElem = html.document.getElementById("__file_picker_web-file-input")?.querySelector("input");
|
||||
inputElem = html.document
|
||||
.getElementById("__file_picker_web-file-input")
|
||||
?.querySelector("input");
|
||||
fileName = result.files.single.name;
|
||||
|
||||
MessageUtils.handleMessageError(
|
||||
model.sendFileMessage(inputElement: inputElem, fileName: fileName, convID: convID, convType: convType),
|
||||
model.sendFileMessage(
|
||||
inputElement: inputElem,
|
||||
fileName: fileName,
|
||||
convID: convID,
|
||||
convType: convType),
|
||||
context);
|
||||
return;
|
||||
}
|
||||
|
||||
String? option2 = result.files.single.path ?? "";
|
||||
outputLogger.i(TIM_t_para("选择成功{{option2}}", "选择成功$option2")(option2: option2));
|
||||
outputLogger
|
||||
.i(TIM_t_para("选择成功{{option2}}", "选择成功$option2")(option2: option2));
|
||||
|
||||
File file = File(result.files.single.path!);
|
||||
final int size = file.lengthSync();
|
||||
if (size >= MorePanelConfig.FILE_MAX_SIZE) {
|
||||
onTIMCallback(TIMCallback(type: TIMCallbackType.INFO, infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||
onTIMCallback(TIMCallback(
|
||||
type: TIMCallbackType.INFO,
|
||||
infoRecommendText: TIM_t("文件大小超出了限制")));
|
||||
return;
|
||||
}
|
||||
|
||||
final String savePath = file.path;
|
||||
|
||||
MessageUtils.handleMessageError(
|
||||
model.sendFileMessage(filePath: savePath, size: size, convID: convID, convType: convType), context);
|
||||
model.sendFileMessage(
|
||||
filePath: savePath,
|
||||
size: size,
|
||||
convID: convID,
|
||||
convType: convType),
|
||||
context);
|
||||
} else {
|
||||
throw TypeError();
|
||||
}
|
||||
|
|
@ -636,13 +715,16 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
bool hasCameraPermission = false;
|
||||
bool hasMicrophonePermission = false;
|
||||
if (type == TYPE_VIDEO) {
|
||||
hasCameraPermission = await Permissions.checkPermission(context, Permission.camera.value);
|
||||
hasMicrophonePermission = await Permissions.checkPermission(context, Permission.microphone.value);
|
||||
hasCameraPermission =
|
||||
await Permissions.checkPermission(context, Permission.camera.value);
|
||||
hasMicrophonePermission = await Permissions.checkPermission(
|
||||
context, Permission.microphone.value);
|
||||
if (!hasCameraPermission || !hasMicrophonePermission) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
hasMicrophonePermission = await Permissions.checkPermission(context, Permission.microphone.value);
|
||||
hasMicrophonePermission = await Permissions.checkPermission(
|
||||
context, Permission.microphone.value);
|
||||
if (!hasMicrophonePermission) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -664,7 +746,9 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
_tUICore.callService(TUICALLKIT_SERVICE_NAME, METHOD_NAME_CALL, {
|
||||
PARAM_NAME_TYPE: type,
|
||||
PARAM_NAME_USERIDS: inviteMember,
|
||||
PARAM_NAME_GROUPID: widget.conversationType == ConvType.group ? widget.conversationID : ""
|
||||
PARAM_NAME_GROUPID: widget.conversationType == ConvType.group
|
||||
? widget.conversationID
|
||||
: ""
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
|
@ -685,7 +769,8 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
@override
|
||||
Widget tuiBuild(BuildContext context, TUIKitBuildValue value) {
|
||||
final TUITheme theme = value.theme;
|
||||
final TUIChatSeparateViewModel model = Provider.of<TUIChatSeparateViewModel>(context);
|
||||
final TUIChatSeparateViewModel model =
|
||||
Provider.of<TUIChatSeparateViewModel>(context);
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
return Container(
|
||||
height: 248,
|
||||
|
|
@ -722,12 +807,15 @@ class _MorePanelState extends TIMUIKitState<MorePanel> {
|
|||
height: 64,
|
||||
width: 64,
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
decoration: const BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(5))),
|
||||
child: item.icon,
|
||||
),
|
||||
Text(
|
||||
item.title,
|
||||
style: TextStyle(fontSize: 12, color: theme.darkTextColor),
|
||||
style: TextStyle(
|
||||
fontSize: 12, color: theme.darkTextColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ fi
|
|||
echo -e "${BLUE}Switching to master...${NC}"
|
||||
git checkout master
|
||||
|
||||
# 5.1 Save the current master commit BEFORE merge (Critical Fix)
|
||||
MASTER_BEFORE_MERGE=$(git rev-parse HEAD)
|
||||
|
||||
# 6. Merge upstream-main into master
|
||||
echo -e "${BLUE}Merging upstream changes into master...${NC}"
|
||||
# We use --no-commit to allow us to check/restore images before finalizing
|
||||
|
|
@ -65,9 +68,9 @@ if git merge --no-commit upstream-main; then
|
|||
else
|
||||
echo -e "${RED}Merge conflict detected.${NC}"
|
||||
echo "Attempting to auto-resolve protected paths conflicts by keeping OURS..."
|
||||
# If conflict is in protected paths, we force checkout HEAD (ours) version
|
||||
# If conflict is in protected paths, we force checkout master's version (before merge)
|
||||
for path in $PROTECTED_PATHS; do
|
||||
git checkout HEAD -- "$path" || true
|
||||
git checkout "$MASTER_BEFORE_MERGE" -- "$path" || true
|
||||
done
|
||||
echo "Note: Manual resolution may still be required for non-protected files."
|
||||
fi
|
||||
|
|
@ -76,7 +79,7 @@ fi
|
|||
# Regardless of merge status, we ensure protected folders are exactly what we had before
|
||||
echo -e "${BLUE}Ensuring protected paths are preserved...${NC}"
|
||||
for path in $PROTECTED_PATHS; do
|
||||
git checkout HEAD -- "$path"
|
||||
git checkout "$MASTER_BEFORE_MERGE" -- "$path"
|
||||
done
|
||||
|
||||
# 8. Check for conflicts
|
||||
|
|
|
|||
Loading…
Reference in New Issue