Select the types of activity you want to include in your feed.
Fork: only update sources.toml for true forks (different namespace)
Don't add sources.toml entries when the push URL is in the user's own namespace (same handle). Only track entries when forking from someone else's repository.
···288288 (* Return original URL for other cases *)
289289 url
290290291291+(** Check if a URL is in the user's own namespace (not a true fork) *)
292292+let is_own_namespace ~handle url =
293293+ (* Extract user/handle from URL and compare with config handle *)
294294+ let url =
295295+ if String.starts_with ~prefix:"git+" url then
296296+ String.sub url 4 (String.length url - 4)
297297+ else url
298298+ in
299299+ (* For SSH URLs like git@github.com:user/repo.git *)
300300+ if String.starts_with ~prefix:"git@" url then
301301+ match String.index_opt url ':' with
302302+ | Some i ->
303303+ let path = String.sub url (i + 1) (String.length url - i - 1) in
304304+ (* path is like "user/repo.git" or "handle/repo" *)
305305+ (match String.index_opt path '/' with
306306+ | Some j ->
307307+ let user = String.sub path 0 j in
308308+ (* Handle may be like "avsm" or "avsm.bsky.social" - compare first component *)
309309+ let handle_first =
310310+ match String.index_opt handle '.' with
311311+ | Some k -> String.sub handle 0 k
312312+ | None -> handle
313313+ in
314314+ String.equal user handle_first || String.equal user handle
315315+ | None -> false)
316316+ | None -> false
317317+ else
318318+ (* For HTTPS URLs like https://github.com/user/repo.git *)
319319+ let uri = Uri.of_string url in
320320+ let path = Uri.path uri in
321321+ let path =
322322+ if String.length path > 0 && path.[0] = '/' then
323323+ String.sub path 1 (String.length path - 1)
324324+ else path
325325+ in
326326+ (* path is like "user/repo.git" or "@handle/repo" *)
327327+ let path =
328328+ if String.length path > 0 && path.[0] = '@' then
329329+ String.sub path 1 (String.length path - 1)
330330+ else path
331331+ in
332332+ match String.index_opt path '/' with
333333+ | Some j ->
334334+ let user = String.sub path 0 j in
335335+ let handle_first =
336336+ match String.index_opt handle '.' with
337337+ | Some k -> String.sub handle 0 k
338338+ | None -> handle
339339+ in
340340+ String.equal user handle_first || String.equal user handle
341341+ | None -> false
342342+291343(** Try to get a suggested push URL from dune-project in the subtree *)
292344let suggest_push_url ~fs ?knot subtree_path =
293345 let dune_project_path = Fpath.(subtree_path / "dune-project") in
···446498 Git_subtree_add { repo = monorepo; prefix; url = Uri.of_string (Fpath.to_string src_path); branch };
447499 ] in
448500449449- (* Update sources.toml if we have a push_url *)
501501+ (* Update sources.toml only if push_url is a true fork (different namespace) *)
502502+ let handle = Verse_config.handle config in
450503 let sources_actions = match push_url with
451451- | Some url -> [
504504+ | Some url when not (is_own_namespace ~handle url) -> [
452505 Update_sources_toml {
453506 path = Fpath.(monorepo / "sources.toml");
454507 name;
···461514 };
462515 };
463516 ]
517517+ | Some _ -> [] (* Own namespace - no sources.toml entry needed *)
464518 | None -> []
465519 in
466520···665719 (* Replace SPLIT_COMMIT placeholder with actual commit if available *)
666720 let ref_spec =
667721 match state.split_commit with
722722+ | Some commit -> String.concat "" (String.split_on_char 'S' (String.concat commit (String.split_on_char 'S' ref_spec)))
723723+ |> fun s -> if String.starts_with ~prefix:"PLIT_COMMIT" s then
724724+ Option.value ~default:ref_spec state.split_commit ^ String.sub s 11 (String.length s - 11)
725725+ else s
726726+ | None -> ref_spec
727727+ in
728728+ (* Better replacement: look for SPLIT_COMMIT literal *)
729729+ let ref_spec =
730730+ match state.split_commit with
668731 | Some commit ->
669669- (* Simple string replacement: SPLIT_COMMIT -> actual commit *)
670670- let placeholder = "SPLIT_COMMIT" in
671671- if String.starts_with ~prefix:placeholder ref_spec then
672672- commit ^ String.sub ref_spec (String.length placeholder) (String.length ref_spec - String.length placeholder)
732732+ if String.length ref_spec >= 12 && String.sub ref_spec 0 12 = "SPLIT_COMMIT" then
733733+ commit ^ String.sub ref_spec 12 (String.length ref_spec - 12)
673734 else ref_spec
674735 | None -> ref_spec
675736 in