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

Git Synchronize Changes No Longer Gets Tags #48211

Closed
DavidGibsonNorth opened this issue Apr 19, 2018 · 14 comments
Closed

Git Synchronize Changes No Longer Gets Tags #48211

DavidGibsonNorth opened this issue Apr 19, 2018 · 14 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues verified Verification succeeded
Milestone

Comments

@DavidGibsonNorth
Copy link

Issue Type: Bug

Impact Summary
Git 'Synchronize Changes' in VSCode 1.22.1 & 1.22.2 no longer gets tags from the remote repository.

Get Tags again by:

  • Reverting to VSCode 1.21.1.
  • Enable setting "git.autofetch": true in 1.21.1, 1.22.1 or 1.22.2.
  • Manually run git fetch in the VSCode terminal.

Steps
Run code 1.22.2 with --disable-extensions

  • Click Synchronize Changes or Source Control pane, ..., Sync.
  • First git output line is git pull origin master, i.e in general git pull <repository> <refspec>
  • No git fetch command is output.

Run code 1.22.1 with --disable-extensions

  • Click Synchronize Changes or Source Control pane, ..., Sync.
  • First git output line is git pull.
  • No git fetch command is output.

Git Behaviour
My assumption is this is caused by a switch from using git pull to git pull <repository> <refspec> in 1.22.1+.

This assumption appears to be backed up by Git docs at https://git-scm.com/docs/git-pull
Incorporates changes from a remote repository into the current branch. In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD.

VS Code version: Code 1.22.2 (3aeede7, 2018-04-12T16:38:45.278Z)
OS version: Windows_NT x64 6.1.7601

System Info
Item Value
CPUs Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz (8 x 3392)
Memory (System) 7.89GB (0.24GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe --disable-extensions
Screen Reader no
VM 0%
Extensions disabled
@vscodebot
Copy link

vscodebot bot commented Apr 19, 2018

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the git GIT issues label Apr 19, 2018
@andrewducker
Copy link

Looks like this is indeed connected to #44802
"git pull origin master" does not pull down tags
"git pull" does.

Just tested this locally by creating a tag on a local repo, and then running both of them:
git pull origin master

From git.internal.company.com:team/testrepo
 * branch            master     -> FETCH_HEAD
Already up-to-date.

git pull

From git.internal.company.com:team/testrepo
 * [new tag]         Testing11  -> Testing11
Already up-to-date.

@andrewducker
Copy link

I checked my understanding on the Git mailing list (message here) and the reply makes it clear that "git pull origin master" will not fetch tags by default.

This is a regression - can we please revert?

@joaomoreno joaomoreno added the bug Issue identified by VS Code Team member as probable bug label Apr 20, 2018
@joaomoreno joaomoreno added this to the April 2018 milestone Apr 20, 2018
@joaomoreno
Copy link
Member

Oh that's a sad consequence. Workaround for now is to run Git: Fetch.


Using git pull remote branch is usually the best option because it avoids the weird semantics of what git pull does, since those semantics have changed between versions, so I still prefer we'd use it. I wonder if there's a way to still run git pull remote branch and bring in tags? Otherwise, we can always run git fetch beforehand as well.

@andrewducker
Copy link

"git pull origin master --tags" does it for me.

@DavidGibsonNorth
Copy link
Author

@andrewducker - me too. I'm using Git version 2.12.2.windows.2.

But, the --tags flag is not documented on my local docs or at https://git-scm.com/docs/git-pull. Which is probably the type fetch/pull consistency between versions that @joaomoreno mentions.

I don't see any documented flags in git pull that will pull tags without invoking fetch though.

@joaomoreno
Copy link
Member

Oh nice, I actually searched for it and also failed to see it documented. I'd just add it, what do you guys think?

@DavidGibsonNorth
Copy link
Author

Ideally the flag is just an omission from the docs, but is available on all platforms. I've only got access to Windows here. @andrewducker is a colleague - he's just asked the git mailing list this point.

@andrewducker
Copy link

I checked with the Git mailing list again and got this response.

Looks like it will work, because "git pull --tags" calls "git fetch" with the "--tags" parameter.

I think it's worth reading the discussion.

And I think that adding "--tags" will fix our use case. Although the people on the Git mailing list seem confused as to why you aren't just using "git pull" as VSCode used to.

@avar
Copy link

avar commented Apr 20, 2018

@andrewducker I posted that. To clarify I can guess what VSCode might be trying to do here, but am reluctant to give advice about what it should do without some context about why it made the switch.

But it's relevant to point out that --tags has certain pathological behaviors that IDEs may not want. In most repos (if all tags are on "master" anyway) it won't matter, but in some it can be really pathological. I.e. if you have wildly divergent branches or unrelated histories you'll end up pulling in a lot of refs you don't need, and which wouldn't have been fetched when it was just git pull.

@andrewducker
Copy link

andrewducker commented Apr 20, 2018

@avar The change was made in #44802 - (in case that wasn't entirely clear), where @joaomoreno said that it was to avoid situations like this.

Hopefully having both of you here will make it clear what the correct way forward is :-)

@andrewducker
Copy link

@joaomoreno Any thoughts on the solution here?

@joaomoreno
Copy link
Member

I'll just add --tags.

@DavidGibsonNorth
Copy link
Author

Thanks. Sounds like this is an improvement for minimal cost for most situations. With the odd pathological behaviors @avar situation no worse off than before version 1.22.1 (using just git pull).

@roblourens roblourens added the verified Verification succeeded label Apr 27, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jun 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants