Skip to content

Conversation

yash-atreya
Copy link
Member

@yash-atreya yash-atreya commented Aug 22, 2025

Motivation

Currently, forge update owner/repo@branch doesn't work correctly, as it fails to sync the branch with the remote and only updates it to the latest local commit of that branch.

Solution

  • If we're updating the lib to a branch, then we should fetch it from remote to make sure it has the latest commits, and then checkout the submodule.
  • Update lockfile accordingly

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@yash-atreya yash-atreya marked this pull request as ready for review August 22, 2025 08:50
@yash-atreya yash-atreya added C-forge Command: forge Cmd-forge-pm Command: forge install/update/remove labels Aug 22, 2025
@yash-atreya yash-atreya self-assigned this Aug 22, 2025
@yash-atreya yash-atreya moved this to Ready For Review in Foundry Aug 22, 2025
@yash-atreya yash-atreya added the T-bug Type: bug label Aug 22, 2025
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

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

makes sense. left a comment, optionally to add it here but I think it's really useful - that is use git log -1 --oneline to show rev that you updated to

assert!(git.head().unwrap() == forge_std.rev(), "Forge std should be at the release tag");

let expected_output = format!(
r#"Updated dep at 'lib/forge-std', (from: tag={}@{}, to: branch=master@{})
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think could be really nice and useful to call git log -1 --oneline for showing the new commit / comment that you updated to

Copy link
Member Author

@yash-atreya yash-atreya Aug 25, 2025

Choose a reason for hiding this comment

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

We are displaying the rev it updated to after the @

Copy link
Collaborator

@grandizzy grandizzy Aug 25, 2025

Choose a reason for hiding this comment

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

yeah, but git log -1 --oneline displays more details, as for example

8bbcf6e (HEAD, tag: v1.10.0) feat: release 1.10.0 (#701)

@yash-atreya yash-atreya merged commit e3a122a into master Aug 25, 2025
22 checks passed
@yash-atreya yash-atreya deleted the yash/sync-on-update branch August 25, 2025 09:23
@github-project-automation github-project-automation bot moved this from Ready For Review to Done in Foundry Aug 25, 2025
@grandizzy grandizzy moved this from Done to Completed in Foundry Aug 25, 2025
MerkleBoy pushed a commit to MerkleBoy/foundry that referenced this pull request Sep 17, 2025
* fix(`forge`): sync branch with remote on update

* nit

* use any
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-pm Command: forge install/update/remove T-bug Type: bug
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

2 participants