Skip to content

[update-checkout] Skip fetching tags when --skip-tags is passed #79814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hnrklssn
Copy link
Contributor

@hnrklssn hnrklssn commented Mar 6, 2025

The existing --skip-tags option only affects cloning new repos. This skips fetching tags in already cloned repos as well.

The existing --skip-tags option only affected cloning new repos. This
skips fetching tags in already cloned repos as well.
@hnrklssn hnrklssn added python Flag: Python source code update-checkout Area → utils: the `update-checkout` script labels Mar 6, 2025
@hnrklssn hnrklssn requested review from MaxDesiatov and gottesmm March 6, 2025 06:16
@hnrklssn hnrklssn requested a review from shahmishal as a code owner March 6, 2025 06:16
@hnrklssn
Copy link
Contributor Author

hnrklssn commented Mar 6, 2025

@swift-ci please test

@AnthonyLatsis AnthonyLatsis added the utils Area: the build system and other accessory scripts under the "utils" directory label Mar 6, 2025
@AnthonyLatsis
Copy link
Collaborator

@swift-ci python lint

Copy link
Collaborator

@AnthonyLatsis AnthonyLatsis left a comment

Choose a reason for hiding this comment

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

Thank you!

Comment on lines 219 to 221
shell.run(["git", "fetch", "--recurse-submodules=yes",
"--tags"],
f"{checkout_target}:{checkout_target}"],
echo=True, prefix=prefix)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The refspec will not work with hashes or tags, and I believe it is better not to proactively create local branches if the target is a branch. I also think we still want to respect skip_tags here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm yeah, this bit turned out to be trickier than I expected... The method for fetching a single tag is different from fetching a single branch, but it doesn't seem like the script knows whether checkout_target is a tag or a branch. Since this fetch is explicitly done because checkout_target wasn't found locally, it seems like simply skipping --tags here when --skip-tags is passed will lead to more errors than not. So it'd be good if we could fetch a just a single tag when needed.

@MaxDesiatov
Copy link
Contributor

Is this testable at all?

@AnthonyLatsis
Copy link
Collaborator

Totally is, we have the infrastructure. I even have a test for this exact case in a dusty worktree along with a bunch of others that I have been planning to stage in for a while.

@AnthonyLatsis AnthonyLatsis requested review from al45tair, edymtt and etcwilde and removed request for edymtt and al45tair March 6, 2025 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Flag: Python source code update-checkout Area → utils: the `update-checkout` script utils Area: the build system and other accessory scripts under the "utils" directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants