Skip to content
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

"local push" (updating a branch without switching to it) hangs with scalar #548

Closed
2 of 6 tasks
YehezkelShB opened this issue Nov 21, 2022 · 2 comments
Closed
2 of 6 tasks

Comments

@YehezkelShB
Copy link
Member

To fast-forward a local branch to its remote status without switching to it (reducing the checkout time and not triggering unrequired fetching), the best way is using git push . origin/main:main, for example. This is safer than just git branch -f main origin/main or git fetch . origin/main:main as it stops in case of non fast forward update. Unfortunately, while this method works correctly on other git repos, it doesn't work when using Scalar (at least in Office monorepo). Instead, it just hangs forever.
Unregistering scalar and running with --no-verify didn't help, so it doesn't look like some hook that interferes with the process. Running with --verbose just adds Pushing to . to the output, and nothing else.
Running in dry run mode seems to understand correctly what should be done, for example (actual SHA-1 redacted):

git push -n . origin/main:main
To .
   xxxx..yyyy  origin/main -> main

Setup

  • Which version of microsoft/git are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.38.1.vfs.0.0
cpu: x86_64
built from commit: 0de34d54680002380b4e1adad74db64a34e03053
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon

Are you using Scalar or VFS for Git?

Scalar

  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?

Win 11 22H2, 64-bit

$ cmd.exe /c ver

Microsoft Windows [Version 10.0.22621.819]
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

** insert your response here **

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

CMD (tested both using Windows Terminal and the default conhost)

git push . origin/main:main
  • What did you expect to occur after running these commands?

This command should fast-forward a local branch to its remote status without switching to it (reducing the checkout time and not triggering unrequired fetching).

  • What actually happened instead?

It hangs forever (forever == a few minutes, after that I just ^C it). Example for output (2 last lines are after ^C):

F:\src>git push . origin/main:main
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
  • If the problem was occurring with a specific repository, can you specify
    the repository?

    • Public repo: insert URL here
    • Windows monorepo
    • Office monorepo
    • Other Microsoft-internal repo: insert name here
    • Other internal repo.
@derrickstolee
Copy link
Collaborator

While I agree that this is confusing and not ideal, I think the fix here is to instead use git branch -f main origin/main to update local branches.

@YehezkelShB
Copy link
Member Author

As I mentioned, this isn't the same from safety perspective. But I understand if this bug is below the bar to get fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants