Skip to content

Fix submodule handling when the current branch is named after a tag #113371

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jul 6, 2023

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Jul 5, 2023

If:

  1. The current branch has the same name as git tag, and
  2. The current branch is set to track a remote other than origin, and
  3. We try to update a submodule

then we'll get the following error:

; x c
Updating submodule src/doc/reference
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: 'personal' does not appear to be a git repository
fatal: Could not read from remote repository.

The problem is that 1. causes git symbolic-ref --short HEAD to try and disambiguate the branch from the tag using heads/branch-name, which breaks a previous workaround for a bug in git submodule update that uses the wrong remote.

Adapt the workaround to strip heads/ from the output.

If:
1. The current branch has the same name as git tag, and
2. The current branch is set to track a remote other than `origin`, and
3. We try to update a submodule

then we'll get the following error:
```
; x c
Updating submodule src/doc/reference
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
fatal: 'personal' does not appear to be a git repository
fatal: Could not read from remote repository.
```

The problem is that 1. causes `git symbolic-ref --short HEAD` to try and disambiguate the branch
from the tag using `heads/branch-name`, which breaks a previous workaround for a bug in `git
submodule update` that uses the wrong remote.

Adapt the workaround to strip `heads/` from the output.
@rustbot
Copy link
Collaborator

rustbot commented Jul 5, 2023

r? @albertlarsan68

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 5, 2023
@jyn514 jyn514 added the A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust label Jul 5, 2023
@albertlarsan68
Copy link
Member

Thanks for the PR!
@bors r+ rollup
Changes don't apply to normal cases, hopefully?

@bors
Copy link
Collaborator

bors commented Jul 5, 2023

📌 Commit 6c7017f has been approved by albertlarsan68

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 5, 2023
@jyn514
Copy link
Member Author

jyn514 commented Jul 5, 2023

yup, this should have no effect at all if there's no tag - that's what unwrap_or(branch) is doing :)

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 6, 2023
…fee1-dead

Rollup of 9 pull requests

Successful merges:

 - rust-lang#111119 (style-guide: Add chapter about formatting for nightly-only syntax)
 - rust-lang#112791 (llvm ffi: Expose `CallInst->setTailCallKind`)
 - rust-lang#113145 (style-guide: Document newline rules for assignment operators)
 - rust-lang#113163 (Add a regression test for rust-lang#112895)
 - rust-lang#113332 (resolve: Use `Interned` for some interned structures)
 - rust-lang#113334 (Revert the lexing of `c"…"` string literals)
 - rust-lang#113350 (Fix the issue of wrong diagnosis for extern pub fn)
 - rust-lang#113371 (Fix submodule handling when the current branch is named after a tag)
 - rust-lang#113384 (style-guide: Clarify grammar for small patterns (not a semantic change))

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 70e8f9d into rust-lang:master Jul 6, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jul 6, 2023
@jyn514 jyn514 deleted the submodule-with-tags branch July 8, 2023 13:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants