Skip to content

Commit 22b6af3

Browse files
committed
WARP: Ignore function GUID merge conflicts
Fixes #8000
1 parent 9d9c230 commit 22b6af3

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

plugins/warp/src/plugin.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::cache::container::add_cached_container;
55
use crate::container::disk::DiskContainer;
66
use crate::container::network::{NetworkClient, NetworkContainer};
77
use crate::matcher::MatcherSettings;
8+
use crate::plugin::conflict_handler::ConflictHandler;
89
use crate::plugin::render_layer::HighlightRenderLayer;
910
use crate::plugin::settings::PluginSettings;
1011
use crate::{core_signature_dir, user_signature_dir};
@@ -13,6 +14,7 @@ use binaryninja::command::{register_command, register_command_for_function};
1314
use binaryninja::is_ui_enabled;
1415
use binaryninja::settings::{QueryOptions, Settings};
1516

17+
mod conflict_handler;
1618
mod ffi;
1719
mod function;
1820
mod load;
@@ -129,6 +131,11 @@ fn plugin_init() -> bool {
129131
// Register our highlight render layer.
130132
HighlightRenderLayer::register();
131133

134+
// Register the conflict handler
135+
if binaryninja::product() == "Binary Ninja Ultimate" {
136+
ConflictHandler::register();
137+
}
138+
132139
if workflow::insert_workflow().is_err() {
133140
tracing::error!("Failed to register WARP workflow");
134141
return false;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
use std::collections::HashMap;
2+
use binaryninja::collaboration::{register_conflict_splitter, ConflictSplitter, MergeConflict};
3+
use binaryninja::database::kvs::KeyValueStore;
4+
use binaryninja::rc::Ref;
5+
6+
pub struct ConflictHandler {}
7+
8+
impl ConflictHandler {
9+
pub fn register() {
10+
register_conflict_splitter(ConflictHandler {});
11+
}
12+
}
13+
14+
impl ConflictSplitter for ConflictHandler {
15+
fn name(&self) -> String {
16+
"WARPFunctionGUIDIgnorer".to_string()
17+
}
18+
19+
fn can_split(&mut self, key: &str, _conflict: &MergeConflict) -> bool {
20+
key.ends_with("/warp_function_guid")
21+
}
22+
23+
fn split(&mut self, _original_key: &str, original_conflict: &MergeConflict, _result: &KeyValueStore) -> Option<HashMap<String, Ref<MergeConflict>>> {
24+
// If there's a conflict on these, we should just delete them
25+
original_conflict.success(None).ok()?;
26+
Some(HashMap::new())
27+
}
28+
}

0 commit comments

Comments
 (0)