-
Notifications
You must be signed in to change notification settings - Fork 897
Move Repository.Reset(paths) into Index #959
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
Conversation
👍
That makes a lot of sense. Let's drop them from |
/// If set, the passed <paramref name="paths"/> will be treated as explicit paths. | ||
/// Use these options to determine how unmatched explicit paths should be handled. | ||
/// </param> | ||
public virtual void Reset(string committish = "HEAD", IEnumerable<string> paths = null, ExplicitPathsOptions explicitPathsOptions = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's drop this overload. Defaulting to HEAD
in the Index
type makes little sense, now. The user will have to pass in a previously selected commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also resolve the duplicate call to IsBare
😉
Ok, I'll go ahead and dump the One potential issue I see with dumping the |
One thing I noticed while changing the I couldn't see a reason why one of them would need the check and the other wouldn't, but maybe I've overlooked something? |
You're right. It's indeed missing. Could you please add it in a separate commit? |
@bording I must be missing something obvious. I only find 7 calls to it in the tests. Are we talking about the same method? |
That's the one I as talking about. I suppose "lots" might have been overstating things a bit, but those calls would all need to be changed to work with one of the other overloads. I guess I was just wanting to make sure you were ok with all of those calls needing to be changed before actually going through with removing the method. |
😄
I think |
Getting close to having everything done! As part of removing the I then went through and got the tests working without any warnings, though in the process I ended up with a test that is failing. I haven't had time yet to think about the best way to resolve that, so I figured I'd go ahead and get what I had pushed up. Would it make sense to add an I still need to add the I also noticed that there is some inconsistency in the xml doc comments (Index vs. staging area). Worth taking the time to clean that up? |
👍
Just thinking out loud. Would it make sense to actually just drop this test as there wouldn't be any way to call
I'm not sure. I don't see any issue with letting a user create an unborn branch and resetting the index from an existing commit. That may actually be a way to restart a "fresh" branch and dropping the commit history. Would that make sense?
That would be super nice of you!
You're doing a fantastic job ✨ Thanks a lot |
That sounds reasonable enough to me. I can't see that being used terribly often, but it seems like allowing it should be ok. It appears to be possible from the command line! I'll go ahead and drop that test then. |
So it turns out the existing I updated the xml docs, but let me know if there is anything in there you'd prefer that I hadn't changed, and I'll revert it. I did end up going a bit beyond just changing 'staging area' to 'Index'. Otherwise I think this is good to go now. Let me know and I'll squash it down and rebase to current vNext! |
👍 |
Per issue #805, the Repository.Reset() methods and extensions that take paths have been moved to Index. These methods have become additional Index.Replace() overloads. The old methods have been deprecated and have been changed to call the new Index.Replace() methods instead. The relevant tests have been updated to use the new methods. Tests that are no longer needed have been removed. Closes #805
Squashed and rebased! |
....and merged! 💖 |
Published in prerelease NuGet package |
Here is what I have so far. It's just about finished, but I had some questions, so I figured I'd go ahead and open the PR for changes I made for #805.
The two things I have left to do are add messages to the
Obsolete
attributes, and update the relevant tests so they aren't getting deprecation warnings. However, I wasn't sure which methods I should be using for the messages and the tests. Should they be pointing to the newRepository.ResetPaths()
methods or toIndex.Reset()
instead?To add the
ResetPaths()
methods I had to update theIRepository
interface also. While doing this, I did start to wonder about how useful these new methods actually were vs. just callingIndex.Reset()
directly. Are these really needed?Something else that I noticed while working on this is that the version of the method that takes a
committish
string has a couple of things I wanted to comment on.RepositoryExtensions
it was using a privateLookUpCommit()
method. I changed this to use the internalRepository.LookupCommit()
instead after verifying that it appeared to do the same thing.IsBare
check vs. relying on the one that's already in theReset()
it calls? Unless looking up the commit from thecommittish
is really expensive, it seems like there isn't a good reason for the duplicate check.