swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.01k stars 10.32k forks source link

[SR-13505] utils/update-checkout errors when the local repository is a cloned fork #55947

Open WowbaggersLiquidLunch opened 3 years ago

WowbaggersLiquidLunch commented 3 years ago
Previous ID SR-13505
Radar rdar://problem/68367275
Original Reporter @WowbaggersLiquidLunch
Type Bug
Environment macOS 10.15.6 (19G2021) Xcode 12.0 beta 6 (12A8189n) Git 2.24.3 (Apple Git-128)
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Project Infrastructure | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: b5c7a1659c40614952a7c5db1bdb11e6

Issue Description:

This might be related to SR-13476, but I'm not entirely sure.

The fork: https://github.com/WowbaggersLiquidLunch/swift

It was at first forked and cloned between 2020-07-03 and 2020-07-05 EST.

In addition to the remote origin pointing to this fork, there is also an upstream pointing to apple/swift:

$ git remote -v
origin  https://github.com/WowbaggersLiquidLunch/swift.git (fetch)
origin  https://github.com/WowbaggersLiquidLunch/swift.git (push)
upstream    https://github.com/apple/swift (fetch)
upstream    https://github.com/apple/swift (push)

utils/update-checkout was first run some time around 2020-07-03 and 2020-07-05 EST, too, with no errors.

The local master was fast-tracked to upstream/master, and pushed to origin/master, both on 2020-09-04. Then utils/update-checkout started showing errors of uncommitted changes:

$ utils/update-checkout
Running ``update_single_repository`` with up to 32 processes.
Updating '/path/to/swift/project/sourcekit-lsp'
Updating '/path/to/swift/project/indexstore-db'
Updating '/path/to/swift/project/llbuild'
Updating '/path/to/swift/project/swift-xcode-playground-support'
Updating '/path/to/swift/project/swift-syntax'
Updating '/path/to/swift/project/swift-corelibs-xctest'
Updating '/path/to/swift/project/swiftpm'
Updating '/path/to/swift/project/swift-tools-support-core'
Updating '/path/to/swift/project/swift-driver'
Updating '/path/to/swift/project/yams'
Updating '/path/to/swift/project/swift-corelibs-foundation'
Updating '/path/to/swift/project/llvm-project'
Updating '/path/to/swift/project/swift-argument-parser'
Updating '/path/to/swift/project/ninja'
Updating '/path/to/swift/project/swift-integration-tests'
Updating '/path/to/swift/project/swift'
Updating '/path/to/swift/project/swift-stress-tester'
Updating '/path/to/swift/project/cmark'
Updating '/path/to/swift/project/swift-format'
Updating '/path/to/swift/project/swift-corelibs-libdispatch'
/path/to/swift/project/swift-format
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-tools-support-core
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-format
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/swift-driver
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-argument-parser
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-tools-support-core
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/yams
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-argument-parser 
Detached HEAD; probably checked out a tag. No need to rebase./path/to/swift/project/yams 
Detached HEAD; probably checked out a tag. No need to rebase./path/to/swift/project/swift-syntax
/path/to/swift/project/ninja
+ git fetch --recurse-submodules=yes --tags+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-driver
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/ninja
+ git rebase FETCH_HEAD
Current branch release is up to date.
/path/to/swift/project/swift-syntax+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/sourcekit-lsp
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/indexstore-db
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-format
+ git submodule update --recursive/path/to/swift/project/swift-tools-support-core
+ git submodule update --recursive/path/to/swift/project/swift-stress-tester
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-argument-parser
+ git submodule update --recursive/path/to/swift/project/yams
+ git submodule update --recursive/path/to/swift/project/sourcekit-lsp
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/indexstore-db
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/swift-driver
+ git submodule update --recursive/path/to/swift/project/swift-stress-tester
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/ninja
/path/to/swift/project/swift-syntax
+ git submodule update --recursive+ git submodule update --recursive/path/to/swift/project/swift-integration-tests
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/llbuild
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/sourcekit-lsp
+ git submodule update --recursive/path/to/swift/project/indexstore-db
+ git submodule update --recursive/path/to/swift/project/swift-integration-tests
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/swift-corelibs-xctest
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-stress-tester
+ git submodule update --recursive/path/to/swift/project/llbuild
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/swift-corelibs-xctest
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/swift-xcode-playground-support
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-corelibs-libdispatch
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/cmark
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swiftpm
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-xcode-playground-support
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/cmark
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/swift-corelibs-libdispatch
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/swift-corelibs-foundation
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift-integration-tests
+ git submodule update --recursive/path/to/swift/project/swiftpm
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/llbuild
+ git submodule update --recursive/path/to/swift/project/swift-corelibs-foundation
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/swift-corelibs-xctest
+ git submodule update --recursive/path/to/swift/project/swift-xcode-playground-support
+ git submodule update --recursive/path/to/swift/project/swift-corelibs-libdispatch
+ git submodule update --recursive/path/to/swift/project/cmark
+ git submodule update --recursive/path/to/swift/project/swiftpm
+ git submodule update --recursive/path/to/swift/project/swift-corelibs-foundation
+ git submodule update --recursive/path/to/swift/project/swift
+ git fetch --recurse-submodules=yes --tags/path/to/swift/project/swift
+ git rebase FETCH_HEAD
Current branch master is up to date./path/to/swift/project/swift
+ git submodule update --recursive/path/to/swift/project/llvm-project
+ git fetch --recurse-submodules=yes --tags
From https://github.com/apple/llvm-project
   0876e6645876..7044d3d140e8  apple/master          -> origin/apple/master
   b9a43b46a7f5..0bc1208d0fb7  apple/stable/20200714 -> origin/apple/stable/20200714
   061a7d04e0ea..5161f883cf92  dl/lldb-delete-unused-code -> origin/dl/lldb-delete-unused-code
   97866b8de81c..b3e139444f41  llvm.org/master       -> origin/llvm.org/master/path/to/swift/project/llvm-project
+ git rebase FETCH_HEAD
error: cannot rebase: You have unstaged changes.
error: Please commit or stash them.Error on repo "/path/to/swift/project/llvm-project": Traceback (most recent call last):
  File "/path/to/swift/project/swift/utils/update_checkout/update_checkout/update_checkout.py", line 209, in update_single_repository
    shell.run(["git", "rebase", "FETCH_HEAD"], echo=True)
  File "/path/to/swift/project/swift/utils/swift_build_support/swift_build_support/shell.py", line 244, in run
    raise eout
Exception: ['git', 'rebase', 'FETCH_HEAD']======UPDATE FAILURES======
/path/to/swift/project/llvm-project failed (ret=1): ['git', 'rebase', 'FETCH_HEAD']
error: cannot rebase: You have unstaged changes.
error: Please commit or stash them.update-checkout failed, fix errors and try again

There are no uncommitted changes, and there is no space or non-ASCII characters in the path:

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
$ git stash
No local changes to save

Git hashes of all repositories being tracked:

$ utils/update-checkout --dump-hashes
{
    "https-clone-pattern": "https://github.com/%s.git", 
    "ssh-clone-pattern": "git@github.com:%s.git", 
    "repos": {
        "sourcekit-lsp": {
            "remote": {
                "id": "apple/sourcekit-lsp"
            }
        }, 
        "indexstore-db": {
            "remote": {
                "id": "apple/indexstore-db"
            }
        }, 
        "llbuild": {
            "remote": {
                "id": "apple/swift-llbuild"
            }
        }, 
        "swift-xcode-playground-support": {
            "remote": {
                "id": "apple/swift-xcode-playground-support"
            }
        }, 
        "swift-syntax": {
            "remote": {
                "id": "apple/swift-syntax"
            }
        }, 
        "swift-corelibs-xctest": {
            "remote": {
                "id": "apple/swift-corelibs-xctest"
            }
        }, 
        "swiftpm": {
            "remote": {
                "id": "apple/swift-package-manager"
            }
        }, 
        "swift-tools-support-core": {
            "remote": {
                "id": "apple/swift-tools-support-core"
            }
        }, 
        "cmake": {
            "platforms": [
                "Linux"
            ], 
            "remote": {
                "id": "KitWare/CMake"
            }
        }, 
        "swift-driver": {
            "remote": {
                "id": "apple/swift-driver"
            }
        }, 
        "yams": {
            "remote": {
                "id": "jpsim/Yams"
            }
        }, 
        "icu": {
            "platforms": [
                "Linux"
            ], 
            "remote": {
                "id": "unicode-org/icu"
            }
        }, 
        "swift-corelibs-foundation": {
            "remote": {
                "id": "apple/swift-corelibs-foundation"
            }
        }, 
        "llvm-project": {
            "remote": {
                "id": "apple/llvm-project"
            }
        }, 
        "swift-argument-parser": {
            "remote": {
                "id": "apple/swift-argument-parser"
            }
        }, 
        "ninja": {
            "remote": {
                "id": "ninja-build/ninja"
            }
        }, 
        "swift-integration-tests": {
            "remote": {
                "id": "apple/swift-integration-tests"
            }
        }, 
        "swift": {
            "remote": {
                "id": "apple/swift"
            }
        }, 
        "swift-stress-tester": {
            "remote": {
                "id": "apple/swift-stress-tester"
            }
        }, 
        "cmark": {
            "remote": {
                "id": "apple/swift-cmark"
            }
        }, 
        "swift-format": {
            "remote": {
                "id": "apple/swift-format"
            }
        }, 
        "swift-corelibs-libdispatch": {
            "remote": {
                "id": "apple/swift-corelibs-libdispatch"
            }
        }
    }, 
    "branch-schemes": {
        "repro": {
            "repos": {
                "sourcekit-lsp": "738a001fc5f0191f68a63d9e6876bdcc63bef862", 
                "swift-syntax": "3fbed3ad7cdd185827e2c2459d3f4542e1656310", 
                "llbuild": "83dd3a8715b5108dab3d3046b1185a5ade6d8899", 
                "swift-xcode-playground-support": "88043d7d320f92598efb39408c3f4b1903a4fff6", 
                "indexstore-db": "e093926dd78a64ae48329397d99d2c72b7443c5f", 
                "swift-corelibs-xctest": "fffe073707908e46338c37686d58f4b9f9a4520c", 
                "swiftpm": "8392988f42cc9236eff7ad31689a5abbfe3ff9ef", 
                "swift-tools-support-core": "f81e9021132036982a4887232a4010affc1d99c9", 
                "cmake": "skip", 
                "swift-driver": "5d80fe476effd5477472de33f5d6e946e37fc282", 
                "yams": "81a65c4069c28011ee432f2858ba0de49b086677", 
                "icu": "skip", 
                "swift-corelibs-foundation": "20ee0e105721550dc0dc779accce59315dbaab87", 
                "llvm-project": "609d16e6ecd05b0be6eaf4c7de6c14bfc1be64cd", 
                "swift-argument-parser": "15351c1cd009eba0b6e438bfef55ea9847a8dc4a", 
                "ninja": "a1f879b29c9aafe6a2bc0ba885701f8f4f19f772", 
                "swift-integration-tests": "11f0f6e8b34ba9782b5841dbeaa207d0b4620152", 
                "swift": "309cb93043ea5287130258aa0b789c503b71e58f", 
                "swift-stress-tester": "4d8f8a790d32a3ced310c6b68c46ca8e6f71f52c", 
                "cmark": "9c8096a23f44794bde297452d87c455fc4f76d42", 
                "swift-format": "4af1af9a0bae7ffef0bf0f604d61346d23f92a7b", 
                "swift-corelibs-libdispatch": "f13ea5dcc055e5d2d7c02e90d8c9907ca9dc72e1"
            }, 
            "aliases": [
                "repro"
            ]
        }
    }
}
WowbaggersLiquidLunch commented 3 years ago

Sorry, the description is quite long. I'm not sure if there is a way to collapse some of the text into disclosures.

WowbaggersLiquidLunch commented 3 years ago

cc theindigamer (JIRA User)

typesanitizer commented 3 years ago

Thanks for the comprehensive info. I suspect this one is unrelated to the other issue (esp. because it is during update-checkout and not building), but I could be wrong.

typesanitizer commented 3 years ago

@swift-ci create