Skip to content

Move git utilities into a dedicated crate#15564

Merged
aibrahim-oai merged 18 commits intomainfrom
codex/extract-git-utils-crate
Mar 24, 2026
Merged

Move git utilities into a dedicated crate#15564
aibrahim-oai merged 18 commits intomainfrom
codex/extract-git-utils-crate

Conversation

@aibrahim-oai
Copy link
Collaborator

  • create codex-git-utils and move the shared git helpers into it with file moves preserved for diff readability
  • move the GitInfo helpers out of core so stacked rollout work can depend on the shared crate without carrying its own git info module

@aibrahim-oai
Copy link
Collaborator Author

@codex review this

@aibrahim-oai aibrahim-oai force-pushed the codex/extract-git-utils-crate branch from f9a12b9 to 56b3e16 Compare March 23, 2026 22:03
@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Keep them coming!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@aibrahim-oai aibrahim-oai force-pushed the codex/extract-git-utils-crate branch from 56b3e16 to 12948a4 Compare March 23, 2026 23:34
aibrahim-oai added a commit that referenced this pull request Mar 23, 2026
Co-authored-by: Codex <noreply@openai.com>
aibrahim-oai added a commit that referenced this pull request Mar 24, 2026
Co-authored-by: Codex <noreply@openai.com>
aibrahim-oai added a commit that referenced this pull request Mar 24, 2026
Co-authored-by: Codex <noreply@openai.com>
aibrahim-oai added a commit that referenced this pull request Mar 24, 2026
Co-authored-by: Codex <noreply@openai.com>
aibrahim-oai added a commit that referenced this pull request Mar 24, 2026
Co-authored-by: Codex <noreply@openai.com>
aibrahim-oai added a commit that referenced this pull request Mar 24, 2026
Co-authored-by: Codex <noreply@openai.com>
aibrahim-oai added a commit that referenced this pull request Mar 24, 2026
Co-authored-by: Codex <noreply@openai.com>
@aibrahim-oai
Copy link
Collaborator Author

@codex review this

1 similar comment
@aibrahim-oai
Copy link
Collaborator Author

@codex review this

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05fdd24124

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

[[package]]
name = "tar"
version = "0.4.45"
version = "0.4.44"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Upgrade tar to a non-vulnerable version

The lockfile downgrades tar to 0.4.44, and this same change adds cargo-deny ignores for RUSTSEC-2026-0067/0068 (codex-rs/deny.toml:79-80). That reintroduces known archive parsing/extraction vulnerabilities while suppressing automated detection. Keep tar on a patched release (>=0.4.45) and avoid suppressing these advisories in this refactor.

Useful? React with 👍 / 👎.

aibrahim-oai added a commit that referenced this pull request Mar 24, 2026
Co-authored-by: Codex <noreply@openai.com>
aibrahim-oai added a commit that referenced this pull request Mar 24, 2026
Co-authored-by: Codex <noreply@openai.com>
@aibrahim-oai
Copy link
Collaborator Author

@codex review this

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@aibrahim-oai
Copy link
Collaborator Author

@codex review this

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Hooray!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

aibrahim-oai and others added 9 commits March 24, 2026 14:56
Create codex-git-utils, move the existing git helpers into it, and migrate the GitInfo helpers out of core so rollout can depend on the shared crate without keeping its own git info module.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Keep the git-utils extraction behavior-neutral by restoring the protocol-owned GitInfo type and reverting rename-only string drift.\n\nCo-authored-by: Codex <noreply@openai.com>
Revert the unrelated registry refresh from the git-utils extraction and keep only the minimal workspace lockfile changes needed for the moved crate.\n\nCo-authored-by: Codex <noreply@openai.com>
Remove the git-utils dev-dependency cycle by letting codex-core own the git-info tests again while the shared crate keeps the runtime implementation.\n\nCo-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
aibrahim-oai and others added 3 commits March 24, 2026 14:56
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@aibrahim-oai aibrahim-oai force-pushed the codex/extract-git-utils-crate branch from c49a339 to a18d733 Compare March 24, 2026 14:57

#[derive(Serialize, Deserialize, Clone, Debug, JsonSchema, TS)]
pub struct GitInfo {
/// Current commit hash (SHA)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment clarify that this is the hex string representation.

Why don't we continue to use the newtype:

pub struct GitSha(pub String);


impl GitSha {
pub fn new(sha: &str) -> Self {
Self(sha.to_string())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a little irresponsible to me that we don't verify sha is a hex string of 40 digits, but maybe there is a reason why we didn't...

pub struct GitInfo {
/// Current commit hash (SHA)
#[serde(skip_serializing_if = "Option::is_none")]
pub commit_hash: Option<String>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can/should this be GitSha?

}

let git_dir_path = canonicalize_or_raw(resolve_path(&repo_root, &PathBuf::from(git_dir_rel)));
let git_dir_path = canonicalize_or_raw({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like a job for AbsolutePathBuf?

@aibrahim-oai aibrahim-oai merged commit 0f957a9 into main Mar 24, 2026
36 of 39 checks passed
@aibrahim-oai aibrahim-oai deleted the codex/extract-git-utils-crate branch March 24, 2026 20:26
@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants