From 159376f79d55aaa64cda7e3d262cd953d1e4aadd Mon Sep 17 00:00:00 2001 From: Chris Darroch Date: Fri, 31 Mar 2023 00:53:31 -0700 Subject: [PATCH 1/4] docs/man/git-lfs-migrate: clarify re remote refs When using the "git lfs migrate" command with its --everything option, all commits reachable from any refs, local or remote, are considered for migration; however, per PR #2559, only local refs are updated after the migration to avoid desynchronizing remote refs with the origin. We therefore clarify this distinction in the command's manual page, as well as clarifying that the "git push" command's --all option refers only to local branches. --- docs/man/git-lfs-migrate.adoc | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/docs/man/git-lfs-migrate.adoc b/docs/man/git-lfs-migrate.adoc index dcc4dc21..cdb1a799 100644 --- a/docs/man/git-lfs-migrate.adoc +++ b/docs/man/git-lfs-migrate.adoc @@ -98,14 +98,21 @@ pointers as files by using `--pointers=no-follow`. (The latter option is akin to how existing Git LFS pointers were handled by the `info` mode in prior versions of Git LFS). -When using the `--everything` option, take note that it means all refs -(local and remote) will be considered, but not necessarily all file -types. The `import` and `info` modes consider all file types by default, -although the `--include` and `--exclude` options constrain this -behavior. Also note that after importing across all branches with the -`--everything` option (and then checking to ensure the results are -satisfactory!) it may be convenient to update multiple branches on your -remotes by using the `--all` option to `git push`. +When using the `--everything` option, take note that it means all commits +reachable from all refs (local and remote) will be considered, but not +necessarily all file types. The `import` and `info` modes consider all file +types by default, although the `--include` and `--exclude` options constrain +this behavior. + +While the `--everything` option means all commits reachable from any +ref will be considered for migration, after migration only local refs will +be updated even when `--everything` is specified. This ensures remote +refs stay synchronized with their remote. In other words, `refs/heads/foo` +will be updated with the `--everything` option, but `refs/remotes/origin/foo` +will not, so it stays in sync with the remote until `git push origin foo` +is performed. After checking that the results of a migration with +`--everything` are satisfactory, it may be convenient to push all local +branches to your remotes by using the `--all` option to `git push`. Unless the `--skip-fetch` option is given, `git lfs migrate` always begins by fetching updated lists of refs from all the remotes returned @@ -369,8 +376,9 @@ commits F, E, D, C, and B, but exclude commit A: --exclude-ref=refs/remotes/origin/main .... -The presence of flag `--everything` indicates that all local and remote -references should be migrated. +The presence of flag `--everything` indicates that all commits reachable +from all local and remote references should be migrated (but note that +the remote refs themselves will not be updated). == EXAMPLES @@ -443,7 +451,7 @@ $ git lfs migrate import --everything --above=100Kb .... Note: This will require a force-push to any existing Git remotes. Using -the `--all` option when force-pushing may be convenient if many refs +the `--all` option when force-pushing may be convenient if many local refs were updated, e.g., after importing to Git LFS with the `--everything` option. @@ -490,7 +498,7 @@ $ git lfs migrate export --everything --include="*" .... Note: This will require a force-push to any existing Git remotes. Using -the `--all` option when force-pushing may be convenient if many refs +the `--all` option when force-pushing may be convenient if many local refs were updated, e.g., after exporting from Git LFS with the `--everything` option. From 10cbbe9becbeebdf49b0163597b4adbf89381012 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Apr 2023 04:58:33 +0000 Subject: [PATCH 2/4] build(deps): bump actions/setup-go from 3 to 4 Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4. - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-go dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 6 +++--- .github/workflows/release.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e42c92df..66c73fb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: # See https://github.com/actions/checkout/issues/882 for details. - uses: ruby/setup-ruby@v1 - run: gem install asciidoctor - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} - run: brew install gettext @@ -53,7 +53,7 @@ jobs: fetch-depth: 0 - run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}" if: ${{ github.ref_type == 'tag' }} - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} - run: script/cibuild @@ -72,7 +72,7 @@ jobs: - run: Rename-Item -Path C:\msys64 -NewName msys64-tmp -Force # We move the MSYS2 installed for Ruby aside to prevent use of its Git, # which does not honour the PATH we set to our built git-lfs binary. - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: '1.20.x' - run: mkdir -p "$HOME/go/bin" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d9d9f30..fab716d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,7 @@ jobs: - run: Rename-Item -Path C:\msys64 -NewName msys64-tmp -Force # We move the MSYS2 installed for Ruby aside to prevent use of its Git, # which does not honour the PATH we set to our built git-lfs binary. - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} - run: mkdir -p "$HOME/go/bin" @@ -81,7 +81,7 @@ jobs: - run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}" - uses: ruby/setup-ruby@v1 - run: gem install asciidoctor - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} - run: brew install gettext @@ -120,7 +120,7 @@ jobs: - run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}" - uses: ruby/setup-ruby@v1 - run: gem install asciidoctor - - uses: actions/setup-go@v3 + - uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} - run: sudo apt-get update && sudo apt-get -y install gettext libarchive-tools From 460701af843a6d6ef314ce376a46f664960e574d Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Wed, 26 Apr 2023 19:25:34 +0000 Subject: [PATCH 3/4] lfstest-gitserver: pass the protocol version to Git Some time back, Git added support for protocol version 2 over HTTP. This is announced by the `Git-Protocol` header, the value of which Git expects to see as the `GIT_PROTOCOL` environment variable. If it receives that value, then it switches into protocol v2 mode. While this is a nice to have in general, it's presently important to fix our testsuite in CI when testing in SHA-256 mode. In that mode, we set `GIT_DEFAULT_HASH=sha256` to specify the default hash algorithm. In protocols v0 and v1, Git does not send a capabilities line by default (although one is accepted) in an empty repository, and if no such line is present, it's not possible to discern the hash algorithm in use. Git recently (after 2.40) added a patch that resulted in empty repositories that are cloned not honouring `GIT_DEFAULT_HASH` in such a case, so if no refs are set, we end up with a SHA-1 repository, which makes our tests fail since they don't interoperate. This will likely be fixed upstream by both announcing a dummy capabilities line like for pushes and by restoring the use of `GIT_DEFAULT_HASH` when no hash algorithm can be explicitly determined. In any event, none of this matters with protocol v2, since in that case capabilities are sent as part of the initial refs request and we always know the hash algorithm. Since this will always work for affected Git versions, let's make sure we enable protocol v2 in the test server if the client supports it. --- t/cmd/lfstest-gitserver.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/t/cmd/lfstest-gitserver.go b/t/cmd/lfstest-gitserver.go index ea666acf..139a476f 100644 --- a/t/cmd/lfstest-gitserver.go +++ b/t/cmd/lfstest-gitserver.go @@ -967,6 +967,10 @@ func gitHandler(w http.ResponseWriter, r *http.Request) { fmt.Sprintf("CONTENT_TYPE=%s", r.Header.Get("Content-Type")), } + if vals := r.Header.Values("Git-Protocol"); len(vals) == 1 { + cmd.Env = append(cmd.Env, fmt.Sprintf("GIT_PROTOCOL=%s", vals[0])) + } + buffer := &bytes.Buffer{} cmd.Stdin = r.Body cmd.Stdout = buffer From 109e4f97ddb97bd87e2b67cb90cbc8d8b517a1e5 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Tue, 25 Apr 2023 19:36:07 +0000 Subject: [PATCH 4/4] locks: print warning about locking API to standard error This is a diagnostic and as such should go to standard error. Doing so it consistent with what Git does, so do so here as well. --- commands/lockverifier.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/lockverifier.go b/commands/lockverifier.go index ee0cf0ad..d7d2d386 100644 --- a/commands/lockverifier.go +++ b/commands/lockverifier.go @@ -69,16 +69,16 @@ func (lv *lockVerifier) Verify(ref *git.Ref) { Exit(tr.Tr.Get("error: Authentication error: %s", err)) } } else { - Print(tr.Tr.Get("Remote %q does not support the Git LFS locking API. Consider disabling it with:", cfg.PushRemote())) - Print(" $ git config lfs.%s.locksverify false", lv.endpoint.Url) + Error(tr.Tr.Get("Remote %q does not support the Git LFS locking API. Consider disabling it with:", cfg.PushRemote())) + Error(" $ git config lfs.%s.locksverify false", lv.endpoint.Url) if lv.verifyState == verifyStateEnabled { ExitWithError(err) } } } } else if lv.verifyState == verifyStateUnknown { - Print(tr.Tr.Get("Locking support detected on remote %q. Consider enabling it with:", cfg.PushRemote())) - Print(" $ git config lfs.%s.locksverify true", lv.endpoint.Url) + Error(tr.Tr.Get("Locking support detected on remote %q. Consider enabling it with:", cfg.PushRemote())) + Error(" $ git config lfs.%s.locksverify true", lv.endpoint.Url) } lv.addLocks(ref, ours, lv.ourLocks)