Git Product home page Git Product logo

Comments (8)

nulltoken avatar nulltoken commented on May 22, 2024

Hello,

thanks for this report. However, I'm not sure I follow you.

I think this is not what you want.

Could you be a bit more descriptive about the issue you're encountering? A failing test would be even better :)

from libgit2sharp.

fbezdeka avatar fbezdeka commented on May 22, 2024

Hi again ;-)

I have currently no code or tests available, so I will try to explain again.
(Maybe I can post some code tomorrow)

What I did:

  1. Added a new file to git Git index using Index.Stage()
  2. Commit
  3. Tried to remove the file added in 1. from the git index using Index.Unstage() (not sure if this is the right way)
  4. Commit

The result: The second commit did not contain any changes, the file was still indexed.

I looked into the code and detected a Unstage --> Restore... --> AddToIndex() loop.
Without the ResotrePotentialPreviousVersionOf() method it works for me.

from libgit2sharp.

nulltoken avatar nulltoken commented on May 22, 2024

Ok. I got it, now :)

I'm working on something and will let you know about the results.

from libgit2sharp.

nulltoken avatar nulltoken commented on May 22, 2024

Formally you should be allowed to Unstage the removal of a file. This doesn't work yet. I've added a failing test as a reminder of this.

However, I've added a shortcut method (Index.Remove()) which should act as a very basic replacement for git rm. This will remove the file from the working directory and the Index.

I've pushed a fix in the vNext branch of the nulltoken remote. Could you please check that it actually fits your need?

from libgit2sharp.

fbezdeka avatar fbezdeka commented on May 22, 2024

Thanks so far!

I will test it tomorrow. But it looks good so far.

from libgit2sharp.

fbezdeka avatar fbezdeka commented on May 22, 2024

My tests finished successfully!

Thanks a lot!

from libgit2sharp.

nulltoken avatar nulltoken commented on May 22, 2024

My tests finished successfully!

Glad your issue was fixed. The fix has been pushed up to libgit2sharp/vNext.
I'll keep this issue opened until Unstage behavior is fixed.

from libgit2sharp.

nulltoken avatar nulltoken commented on May 22, 2024

Released as part of LibGit2Sharp v0.6.0

from libgit2sharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.