-
Notifications
You must be signed in to change notification settings - Fork 907
Unstage adds on an empty repository #265
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
Out of curiosity, is there a (maybe optional) behavior of the underlying |
Yes. I'd like this very much. However, I'd prefer to have #257 fixed first with plain C# and decide what would be the nice options we'd like to see dealt with (Current implementation blindly assumes Then, if that's ok with you, I'll try to port it in libgit2. |
@nulltoken - I looked at making As it is, this PR is updated to include your changes (but is still tolerent to files not part of the index). If you think that the strict option is still useful, I can add it back Thoughts? |
@jamill Hmm.. While working on #270, I just (re)discovered that trying to Is it ok to stage/unstage/remove or even move a file which doesn't exist? I would lean toward letting the user decide about whether the operation is lenient (ie. silently ignores unmatched pathspecs). Below a proposal for an exhaustive ruleset regarding this. Please review it carefully as I may have had made mistakes: Staging deals with moving the state of a file from the Working Directory toward the Index
Unstaging deals with moving the state of a file from the Head toward the Index. If the Head is orphaned (ie. the current Head "contains" no commit), then the file will be considered as "non existing is the Head"
Removing deals with clearing an entry from the Index and, optionally, from the Working Directory as well
Note: I haven't dealt with /cc @dahlbyk, @yishaigalatzer |
Question: What is the expectation when an end user goes through the following process
I'm expecting that file state 2 is the one captured in the repository, from reading the table above i'm not 100% clear that is the case. |
It seems clear to me. |
@yishaigalatzer A Commit is made of the content of the Index. Staging is the process which updates the Index from the working directory. In other words, if nothing is staged, there's nothing to commit. Considering your scenario, below are the state of the "three trees of git" after each of the step has been performed
If only file state 1 has been staged, only file state 1 will be committed. |
Yes - I missed the behavior of the other operations, I completly agree. How would you feel about handling the API consistency in a seperate issue - I can open one and bring over your table. I would like to tackle unstaging adds on an empty repository first as there is not currently another workaround here (and, the fix is available now). /cc @dahlbyk, @yishaigalatzer , @ethomson |
Sounds reasonable 😉 It's now merged.
👍 |
Fix to allow unstaging adds in an empty repository. This should resolve issue #257.
/cc @phkelley, @yishaigalatzer