Bug 10814 - exception when trying to switch to different branch
Summary: exception when trying to switch to different branch
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Version Control ()
Version: unspecified
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: 4.2.3 (from master)
Assignee: Marius Ungureanu
URL:
Depends on:
Blocks:
 
Reported: 2013-03-01 09:19 UTC by Jens
Modified: 2014-01-06 02:57 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Jens 2013-03-01 09:19:40 UTC
when I try to switch from one git branch to another, I get an "operation not supported" exception. In my case I try to switch from branch "jens" to branch "master"
It did work yesterday, not sure what changed since then. There were no updates...

git --version 
git version 1.7.9.6 (Apple Git-31.1)

Xamarin versions:
Xamarin Studio
Version 4.0 (build 2003)
Installation UUID: ef46ec6d-cbfa-4264-bb42-00cdaa25736e
Runtime:
	Mono 2.10.11 (mono-2-10/2baeee2)
	GTK 2.24.14
	GTK# (2.12.0.0)
	Package version: 210110000

Apple Developer Tools
Xcode 4.6 (2066)
Build 4H127

Xamarin.Mac
Xamarin.Mac: Not Installed

Xamarin.iOS
Version: 6.2.0.65 (Business Edition)

Xamarin.Android
Version: 4.6.0 (Business Edition)
Android SDK: /Users/jens-uwe/Downloads/Programme/android-sdk-macosx
	Supported Android versions:
		2.1 (API level 7)
		2.2 (API level 8)
		2.3 (API level 10)
		3.1 (API level 12)
		4.0 (API level 14)
		4.1 (API level 16)
		4.2 (API level 17)
Java SDK: /usr

Build Information
Git revision: Release ID: 400002003
a8219130080af6661ccd827d3ae2589bbfe8c2bb
Build date: 2013-02-20 00:32:59+0000
Xamarin addins: b7a7aff09b352c13ded8a27439fd6d2250361511

Operating System
Mac OS X 10.8.2
Darwin Jens-Uwes-MacBook-Pro.local 12.2.1 Darwin Kernel Version 12.2.1
    Thu Oct 18 16:32:48 PDT 2012
    root:xnu-2050.20.9~2/RELEASE_X86_64 x86_64


Exception:
An error has occured
Branch switch failed. Operation is not supported

System.NotSupportedException: Operation is not supported.
  at Sharpen.WrappedSystemStream.set_Position (Int64 value) [0x00057] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/external/ngit/Sharpen/Sharpen/WrappedSystemStream.cs:132 
  at System.IO.BufferedStream.Flush () [0x0001c] in /Users/builder/data/lanes/mono-mac-ui-refresh-2-10/2baeee2f/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.11/_build/mono-2.10.11.git/mcs/class/corlib/System.IO/BufferedStream.cs:130 
  at System.IO.BufferedStream.Dispose (Boolean disposing) [0x00017] in /Users/builder/data/lanes/mono-mac-ui-refresh-2-10/2baeee2f/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.11/_build/mono-2.10.11.git/mcs/class/corlib/System.IO/BufferedStream.cs:117 
  at System.IO.Stream.Close () [0x00000] in /Users/builder/data/lanes/mono-mac-ui-refresh-2-10/2baeee2f/source/bockbuild/profiles/mono-2-10/build-root/mono-2.10.11/_build/mono-2.10.11.git/mcs/class/corlib/System.IO/Stream.cs:107 
  at Sharpen.InputStream.Close () [0x0000b] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/external/ngit/Sharpen/Sharpen/InputStream.cs:33 
  at NGit.ObjectStream+Filter.Close () [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/external/ngit/NGit/NGit/ObjectStream.cs:246 
  at NGit.ObjectLoader.GetCachedBytes (Int32 sizeLimit) [0x00075] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/external/ngit/NGit/NGit/ObjectLoader.cs:249 
  at NGit.ObjectLoader.GetBytes (Int32 sizeLimit) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/external/ngit/NGit/NGit/ObjectLoader.cs:149 
  at NGit.Diff.DiffFormatter.Open (Side side, NGit.Diff.DiffEntry entry) [0x000d7] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/external/ngit/NGit/NGit.Diff/DiffFormatter.cs:1063 
  at NGit.Diff.DiffFormatter.CreateFormatResult (NGit.Diff.DiffEntry ent) [0x00057] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/external/ngit/NGit/NGit.Diff/DiffFormatter.cs:956 
  at NGit.Diff.DiffFormatter.Format (NGit.Diff.DiffEntry ent) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/external/ngit/NGit/NGit.Diff/DiffFormatter.cs:645 
  at NGit.Diff.DiffFormatter.Format[DiffEntry] (IList`1 entries) [0x00018] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/external/ngit/NGit/NGit.Diff/DiffFormatter.cs:632 
  at NGit.Api.DiffCommand.Call () [0x00195] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/external/ngit/NGit/NGit.Api/DiffCommand.cs:171 
  at MonoDevelop.VersionControl.Git.GitUtil.CompareCommits (NGit.Repository repo, NGit.AnyObjectId reference, NGit.ObjectId compared) [0x0006e] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs:122 
  at MonoDevelop.VersionControl.Git.GitUtil.CompareCommits (NGit.Repository repo, NGit.Revwalk.RevCommit reference, NGit.Revwalk.RevCommit compared) [0x0004c] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs:94 
  at MonoDevelop.VersionControl.Git.GitUtil.GetChangedFiles (NGit.Repository repo, System.String refRev) [0x0003c] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitUtil.cs:222 
  at MonoDevelop.VersionControl.Git.GitRepository.SwitchToBranch (IProgressMonitor monitor, System.String branch) [0x00022] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:1179 
  at MonoDevelop.VersionControl.Git.GitService+<SwitchToBranch>c__AnonStorey12.<>m__1E (System.Object ) [0x00000] in /Users/builder/data/lanes/monodevelop_private-lion-bigsplash/a8219130/source/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs:118
Comment 1 Jens 2013-03-01 09:38:24 UTC
ok, i think I have something:

git checkout master
error: The following untracked working tree files would be overwritten by checkout:
	xxxxxxxx
Please move or remove them before you can switch branches.
Aborting


Ok, seems this causes your strange output. 
So this is mostly a Usability problem: instead of showing a useful error report which would help a user to fix the problem you just claim that the operation is not supported

So the bug is more about a more useful error message. The best thing would probably to somehow print the git error message to the user, maybe formatted in a prettier way
Comment 2 Marius Ungureanu 2013-07-08 09:38:26 UTC
The switch to branch operation should stash/unstash local changes if we have the option ticked under Version Control > Git. So, the error is not related to https://bugzilla.xamarin.com/show_bug.cgi?id=10814#c1 .

I'll try and get a fix for this, I know what's going on.
Comment 3 Marius Ungureanu 2013-07-08 11:06:23 UTC
Correction to above: "once I know what's going on".

In case there are any steps for reproducing this, please tell.

Marking as NEEDINFO.
Comment 4 Marius Ungureanu 2013-09-16 18:06:30 UTC
Any update on this? Any way to trigger the issue?
Comment 5 Jens 2013-09-17 00:42:10 UTC
i haven't experienced that problem since ages. 
maybe it was fixed together with something else?
Comment 6 Marius Ungureanu 2013-09-17 04:52:38 UTC
Could be that it got fixed or it was a one-time bug. Closing it.
Comment 7 Jens 2013-12-27 14:41:32 UTC
another problem when switching to a different branch:

NGit.Api.Errors.CheckoutConflictException: Checkout conflict with files: 
LetMeTalk/CoreAndroid/CoreAndroid.csproj
LetMeTalk/CoreShared/CoreShared.csproj
LetMeTalk/CoreShared/dataClasses/Constants.cs ---> NGit.Errors.CheckoutConflictException: Checkout conflict with files: 
LetMeTalk/CoreAndroid/CoreAndroid.csproj
LetMeTalk/CoreShared/CoreShared.csproj
LetMeTalk/CoreShared/dataClasses/Constants.cs
  at NGit.Dircache.DirCacheCheckout.DoCheckout () [0x00076] in /Users/builder/data/lanes/monodevelop-lion-license-sync/c5f82958/source/monodevelop/main/external/ngit/NGit/NGit.Dircache/DirCacheCheckout.cs:442 
  at NGit.Dircache.DirCacheCheckout.Checkout () [0x00003] in /Users/builder/data/lanes/monodevelop-lion-license-sync/c5f82958/source/monodevelop/main/external/ngit/NGit/NGit.Dircache/DirCacheCheckout.cs:410 
  at NGit.Api.CheckoutCommand.Call () [0x0018c] in /Users/builder/data/lanes/monodevelop-lion-license-sync/c5f82958/source/monodevelop/main/external/ngit/NGit/NGit.Api/CheckoutCommand.cs:185 
  --- End of inner exception stack trace ---
  at NGit.Api.CheckoutCommand.Call () [0x001b7] in /Users/builder/data/lanes/monodevelop-lion-license-sync/c5f82958/source/monodevelop/main/external/ngit/NGit/NGit.Api/CheckoutCommand.cs:190 
  at MonoDevelop.VersionControl.Git.GitRepository.SwitchToBranch (IProgressMonitor monitor, System.String branch) [0x000b8] in /Users/builder/data/lanes/monodevelop-lion-license-sync/c5f82958/source/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs:1490 
  at MonoDevelop.VersionControl.Git.GitService+<SwitchToBranch>c__AnonStorey13.<>m__1B (System.Object ) [0x00014] in /Users/builder/data/lanes/monodevelop-lion-license-sync/c5f82958/source/monodevelop/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs:127 

not sure if I should open another bug for that?

I released a version a few weeks ago and since then the development branch changed a lot... But shouldn't switch to another branch "just work"?
Comment 8 Jens 2013-12-27 14:54:37 UTC
source tree also does not switch between the branches

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree reset -q --hard HEAD -- 


git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree checkout release/version1.0 
error: The following untracked working tree files would be overwritten by checkout:
	LetMeTalk/CoreAndroid/CoreAndroid.csproj
	LetMeTalk/CoreShared/CoreShared.csproj
	LetMeTalk/CoreShared/dataClasses/Constants.cs
Please move or remove them before you can switch branches.
Aborting
Completed with errors, see above
Comment 9 Prashant manu 2014-01-06 02:57:55 UTC
I have checked this issue with following builds:

All Mac
X.S 4.2.3(Build 24) - 32a91deef895c96ddf3cfdd5f3c8e18c6d54fcb9
Mono 3.2.6
X.Android 4.12.0-1
X.iOS 7.0.6-166

I am successfully able to switch to another branch. This is the screencast for the same: http://screencast.com/t/ZNj6VzDQ

Changing the status to Verified.