Skip to content

Commit 0bd4d30

Browse files
committed
fix: resolve merge conflicts with main
2 parents 368e967 + 3857349 commit 0bd4d30

4 files changed

Lines changed: 252 additions & 144 deletions

File tree

.claude/hooks/guard-git.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ fi
3333
# the opening `"` of a quoted path (which would leave a trailing `path"` in
3434
# NCOMMAND). The pattern re-anchors on `git`, so multi-`-C` chains (e.g.
3535
# `git -C /a -C /b push`) need a second pass to collapse the residual `-C`.
36-
NCOMMAND=$(echo "$COMMAND" | sed -E 's/(^|\s|&&\s*)git[[:space:]]+-C[[:space:]]+"[^"]+"/\1git/g; s/(^|\s|&&\s*)git[[:space:]]+-C[[:space:]]+[^"[:space:]][^[:space:]]*/\1git/g')
37-
NCOMMAND=$(echo "$NCOMMAND" | sed -E 's/(^|\s|&&\s*)git[[:space:]]+-C[[:space:]]+"[^"]+"/\1git/g; s/(^|\s|&&\s*)git[[:space:]]+-C[[:space:]]+[^"[:space:]][^[:space:]]*/\1git/g')
36+
NCOMMAND=$(echo "$COMMAND" | sed -E 's/(^|[[:space:]]|&&[[:space:]]*)git[[:space:]]+-C[[:space:]]+"[^"]+"/\1git/g; s/(^|[[:space:]]|&&[[:space:]]*)git[[:space:]]+-C[[:space:]]+[^"[:space:]][^[:space:]]*/\1git/g')
37+
NCOMMAND=$(echo "$NCOMMAND" | sed -E 's/(^|[[:space:]]|&&[[:space:]]*)git[[:space:]]+-C[[:space:]]+"[^"]+"/\1git/g; s/(^|[[:space:]]|&&[[:space:]]*)git[[:space:]]+-C[[:space:]]+[^"[:space:]][^[:space:]]*/\1git/g')
3838

3939
deny() {
4040
local reason="$1"
@@ -117,11 +117,16 @@ detect_work_dir() {
117117
# `git -C` is the explicit git-level override and wins over any ambient cd prefix,
118118
# so check it first (e.g. `cd /tmp && git -C /worktree push` targets /worktree).
119119
# Greedy `.*-C` anchors on the LAST `-C` in the chosen segment.
120-
if echo "$search_str" | grep -qE 'git\s+([^&|;]*\s)?-C\s+'; then
121-
work_dir=$(echo "$search_str" | sed -nE 's/.*-C[[:space:]]+"([^"]+)".*/\1/p;t;s/.*-C[[:space:]]+([^[:space:]]+).*/\1/p')
120+
# Two separate sed invocations (quoted path first, then unquoted fallback) instead
121+
# of a single `;t;s` chain — BSD sed parses chained s/// after `t` as a label.
122+
if echo "$search_str" | grep -qE 'git[[:space:]]+([^&|;]*[[:space:]])?-C[[:space:]]+'; then
123+
work_dir=$(echo "$search_str" | sed -nE 's/.*-C[[:space:]]+"([^"]+)".*/\1/p')
124+
if [ -z "$work_dir" ]; then
125+
work_dir=$(echo "$search_str" | sed -nE 's/.*-C[[:space:]]+([^[:space:]]+).*/\1/p')
126+
fi
122127
fi
123-
if [ -z "$work_dir" ] && echo "$COMMAND" | grep -qE '^\s*cd\s+'; then
124-
work_dir=$(echo "$COMMAND" | sed -nE 's/^\s*cd\s+"?([^"&]+)"?\s*&&.*/\1/p')
128+
if [ -z "$work_dir" ] && echo "$COMMAND" | grep -qE '^[[:space:]]*cd[[:space:]]+'; then
129+
work_dir=$(echo "$COMMAND" | sed -nE 's/^[[:space:]]*cd[[:space:]]+"?([^"&]+)"?[[:space:]]*&&.*/\1/p')
125130
fi
126131
# Trim trailing whitespace
127132
work_dir="${work_dir%"${work_dir##*[![:space:]]}"}"

crates/codegraph-core/src/extractors/verilog.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@ fn find_class_name(node: &Node, source: &[u8]) -> Option<String> {
148148
return Some(text.to_string());
149149
}
150150
for i in 0..node.child_count() {
151-
let child = node.child(i)?;
152-
if child.kind() == "class_identifier" {
153-
return Some(extract_identifier_text(&child, source));
151+
if let Some(child) = node.child(i) {
152+
if child.kind() == "class_identifier" {
153+
return Some(extract_identifier_text(&child, source));
154+
}
154155
}
155156
}
156157
None
@@ -161,12 +162,13 @@ fn find_class_name(node: &Node, source: &[u8]) -> Option<String> {
161162
/// `class_identifier > simple_identifier`.
162163
fn find_class_superclass(node: &Node, source: &[u8]) -> Option<String> {
163164
for i in 0..node.child_count() {
164-
let child = node.child(i)?;
165-
if child.kind() == "class_type" {
166-
if let Some(id) = find_child(&child, "class_identifier") {
167-
return Some(extract_identifier_text(&id, source));
165+
if let Some(child) = node.child(i) {
166+
if child.kind() == "class_type" {
167+
if let Some(id) = find_child(&child, "class_identifier") {
168+
return Some(extract_identifier_text(&id, source));
169+
}
170+
return Some(node_text(&child, source).trim().to_string());
168171
}
169-
return Some(node_text(&child, source).trim().to_string());
170172
}
171173
}
172174
None

0 commit comments

Comments
 (0)