Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add Stash first implementation #352

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

Closed
wants to merge 2 commits into from
Closed

Conversation

Saaman
Copy link
Contributor

@Saaman Saaman commented Feb 22, 2013

I added the management of stashes into LibGit2Sharp.
For now, you can add an list stashes, (with bindings to git_stash_save and git_stash_foreach).
I took Repository.Tags as an example to manage the stashes collection.

I'll push to you the implementation of Removea little while later.

namespace LibGit2Sharp.Core
{
///<summary>
/// the different options to create a new stash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about

/// <summary>
///   Options controlling Stash behavior.
/// </summary>

@nulltoken
Copy link
Member

Wow... Bringing Stash to LibGit2Sharp? Amazing! 💥

Few more tiny things:

  • It looks like Travis failed to build this PR. Could you please peek at the log?
  • The Stash is a complex object (cf. this helper). Maybe would it be useful to expose some additional properties to ease the access to the Worktree, Index, Untracked or Base commit? Or is it only an implementation detail that shoudn't be exposed? I'm not even sure there's a valid use case which requires direct access to those... Thoughts?

@Saaman
Copy link
Contributor Author

Saaman commented Feb 22, 2013

that's a lot of comments! 😄
Travis complains about the missing implementation of DebuggerDisplay. 😉
I'm about to push updated commited with most of your remarks taken into account, my code should now be more compliant with the coding guidelines.

Stash stash = repo.Stashes.Add(stasher);

Assert.NotNull(stash);
Assert.Equal("stash@{0}", stash.CanonicalName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could please assert, that the Message from the Tip is not empty nor null?

@jamill
Copy link
Member

jamill commented Feb 25, 2013

Awesome! I think the main thing I noticed was that message was not exposed on the Stash object (and not in tests, etc).

Also, do you want tests covering other StashOptions? This might be helpful in case the enumeration meaning changes in libgit2...

@nulltoken
Copy link
Member

Awesome!

@Saaman I concur with @jamill ‼️

Also, do you want tests covering other StashOptions? This might be helpful in case the enumeration meaning changes in libgit2...

👍 That makes perfect sense. @Saaman Could you please cover the including of Ignored files as well?

I noticed was that message was not exposed on the Stash object

Once again @jamill hit the 🎱 I completely overlooked this. How about a Message property returning the content of Stash.Target.Message?

@Saaman
Copy link
Contributor Author

Saaman commented Feb 26, 2013

I will push a new version of the stash, with :

  • The coverage of the different StashOptions
  • The Messageproperty
  • And renaming Tipas Targetthen

@Saaman
Copy link
Contributor Author

Saaman commented Feb 26, 2013

I just pushed my modifications. It turns out I saw something odd :
While testing the option StashOptions.IncludeIgnored, I was expecting any ignored file to be stashed but then deleted from the working directory. It is stashed correctly, but left in the working directory. Is it a bug or the normal behavior?

@nulltoken
Copy link
Member

While testing the option StashOptions.IncludeIgnored, I was expecting any ignored file to be stashed but then deleted from the working directory. It is stashed correctly, but left in the working directory. Is it a bug or the normal behavior?

That looks like a bug. However, after having thought a bit about this, I realize I don't really know how git.git does behave regarding the stashing of ignored files. Would this even make sense to remove them from the workdir?

I'm going to investigate this and will report about my findings.

Merged! 💥

@nulltoken nulltoken closed this Feb 28, 2013
@Saaman Saaman deleted the topic/stash-impl branch March 27, 2013 12:56
@Saaman Saaman mentioned this pull request Mar 27, 2013
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

Successfully merging this pull request may close these issues.

6 participants