nchammas commented on PR #58207:
URL: https://github.com/apache/spark/pull/58207#issuecomment-5373090654

   I use VS Code with Copilot and a mix of models. When I made [this 
mistake][1], I was using Grok 4.5.
   
   [1]: https://github.com/apache/spark/pull/58136#issuecomment-5371893133
   
   This is what Grok 4.5 does when I ask it to create a new worktree so I can 
develop some doc fixes (formatted for clarity):
   
   ```sh
   git fetch upstream master
   git worktree add -b docs-spelling-grammar 
../spark.worktrees/docs-spelling-grammar upstream/master
   git -C ../spark.worktrees/docs-spelling-grammar status -sb
   git -C ../spark.worktrees/docs-spelling-grammar log -1 --oneline
   git worktree list
   ```
   
   If I then `cd` to the new worktree folder and inspect the push target, I see 
this:
   
   ```sh
   $ git status -sb
   ## docs-spelling-grammar...upstream/master
   ```
   
   I believe this is the problem. Normally, if you `git push` with this setup 
it will fail:
   
   ```
   fatal: The upstream branch of your current branch does not match
   the name of your current branch.
   ```
   
   However, I sometimes use VS Code's command palette to push. And this 
unfortunately has [different behavior][2].
   
   [2]: 
https://github.com/microsoft/vscode/blob/1.134.0/extensions/git/src/repository.ts#L2356-L2365
   
   `Git: Push` from the VS Code command palette constructs the equivalent of 
this command:
   
   ```
   git push upstream docs-spelling-grammar:master
   ```
   
   And this is exactly how I ended up pushing 
https://github.com/apache/spark/commit/3731453175d31125a8765f61d5df2e5936ffb28d 
directly to `master`.
   
   I believe this is a footgun that will eventually bite someone else, 
especially if they use VS Code and `Git: Push`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to