Skip to content

Upgrade binaries to current LibGit2 HEAD. (5d91bea) #722

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

Merged
merged 0 commits into from
May 30, 2014

Conversation

Therzok
Copy link
Member

@Therzok Therzok commented May 28, 2014

Okay so this is the bump itself. I split it into binary update then API usage update.

A few things which I will handle later on:

  • There are now callbacks for ssh_interactive
  • There is new remote API and diff stats API.
  • There is a config snapshot API.
  • There is cherry-pick API.

@carlosmn
Copy link
Member

The default config getter needs to grab the snapshot version.

@Therzok
Copy link
Member Author

Therzok commented May 28, 2014

Perfect, I'll do that, thanks.

@Therzok
Copy link
Member Author

Therzok commented May 28, 2014

@carlosmn So, instead of getter being 'config.Value', you mean adding a config_snapshot call before-hand, right?

@Therzok
Copy link
Member Author

Therzok commented May 28, 2014

Oh, I understood what you meant now.

@Therzok
Copy link
Member Author

Therzok commented May 28, 2014

@nulltoken Any insight on the unit tests that are failing? Also on the MergePreference approach.

@@ -88,7 +88,7 @@ public Configuration(string globalConfigurationFileLocation = null, string xdgCo
/// </summary>
public virtual bool HasConfig(ConfigurationLevel level)
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm unsure whether this would require a snapshot or not.

Copy link
Member

Choose a reason for hiding this comment

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

We should favour using a snapshot unless we need to write into it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@Therzok
Copy link
Member Author

Therzok commented May 28, 2014

Update on failing tests: The RetrieveStatus function apparently has lots of +0/-0, which either means lineendings changed or filemodes, but I don't see them changed either. I'm currently at a loss and I'd like someone to give some insight over this.

@@ -72,6 +72,28 @@ internal enum GitMergeAnalysis
}

[Flags]
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need the Flags attribute - I think these are all exclusive values, even if the C representation treats these as combinable values...

/cc @ethomson ?

Copy link
Member

Choose a reason for hiding this comment

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

That's correct.

Copy link
Member Author

Choose a reason for hiding this comment

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

Other than not being able to safely use them in a switch, what could be the issue here?

Copy link
Member

Choose a reason for hiding this comment

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

I feel marking an enum as flag when the enum is not a flag will be confusing to people who work with this. We can do direct comparisons on the value, instead of seeing using the HasFlag(..) method to see if a value contains a flag.

Copy link
Member Author

Choose a reason for hiding this comment

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

(off-topic: HasFlag is slower than (x & flag) != 0)

@jamill
Copy link
Member

jamill commented May 28, 2014

This new MergePreference thing should be exposed, right? So, how do I handle it? Move the result to a ref parameter or make the return value a Tuple/KeyValuePair?

I think there are a couple of ways this could be done. My initial thoughts would be to move GitMergePreference and the GitMergeAnalysis to ref parameters. Then we could add some logic that would take these two parameters as input and decide how to handle the merge...

Either way, I would suggest doing the changes for the MergePreference handling in a separate commit.

@Therzok
Copy link
Member Author

Therzok commented May 28, 2014

@jamill Obviously, the same way I handled Configuration changes. I'm only rebasing where necessary so I keep commits atomic.

@Therzok
Copy link
Member Author

Therzok commented May 29, 2014

Removed the Flags attribute as per @jamill 's request. Also added a commit in which we keep track of MergePreference (it's still unused, all I know about it is that it's the value of the user's config for merge.ff and I don't know how that changes a call to Merge.)

@carlosmn
Copy link
Member

It doesn't change the call to Merge, just like the analysis of the possibilities doesn't. It lets the tool writer know what the user preference is so it can decide whether to call Merge or not.

@nulltoken
Copy link
Member

@Therzok I've started to look at the failing tests.

CanCleanWorkingDirectory() is actually a false positive. It looks like it was wrongly passing before.

Below the output of git status for the test repo on my box:

$ git status
warning: LF will be replaced by CRLF in modified_staged_file.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in new_tracked_file.txt.
The file will have its original line endings in your working directory.
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 2 and 2 different commits each, respectively.
#   (use "git pull" to merge the remote branch into yours)
#
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    deleted_staged_file.txt
#       modified:   modified_staged_file.txt
#       new file:   new_tracked_file.txt
#
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   1/branch_file.txt
#       modified:   README
#       modified:   branch_file.txt
#       deleted:    deleted_unstaged_file.txt
#       modified:   modified_unstaged_file.txt
#       modified:   new.txt
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       new_untracked_file.txt

Following patch makes it pass:

diff --git a/LibGit2Sharp.Tests/CleanFixture.cs b/LibGit2Sharp.Tests/CleanFixture.cs
index 9613a2c..8ca9972 100644
--- a/LibGit2Sharp.Tests/CleanFixture.cs
+++ b/LibGit2Sharp.Tests/CleanFixture.cs
@@ -13,14 +13,16 @@ public void CanCleanWorkingDirectory()
             using (var repo = new Repository(path))
             {
                 // Verify that there are the expected number of entries and untracked files
-                Assert.Equal(6, repo.Index.RetrieveStatus().Count());
-                Assert.Equal(1, repo.Index.RetrieveStatus().Untracked.Count());
+                var status = repo.Index.RetrieveStatus();
+                Assert.Equal(10, status.Count());
+                Assert.Equal(1, status.Untracked.Count());

                 repo.RemoveUntrackedFiles();

                 // Verify that there are the expected number of entries and 0 untracked files
-                Assert.Equal(5, repo.Index.RetrieveStatus().Count());
-                Assert.Equal(0, repo.Index.RetrieveStatus().Untracked.Count());
+                var newStatus = repo.Index.RetrieveStatus();
+                Assert.Equal(9, newStatus.Count());
+                Assert.Equal(0, newStatus.Untracked.Count());
             }
         }

@nulltoken
Copy link
Member

@Therzok Hmmm. Hold on to the previous comment. I need to dig a little deeper.

@Therzok
Copy link
Member Author

Therzok commented May 30, 2014

@nulltoken there are 44 tests failing, and I don't know what changed. It's the index behaving differently.

@nulltoken
Copy link
Member

@nulltoken there are 44 tests failing, and I don't know what changed. It's the index behaving differently.

Actually, I think this is because libgit2 has been tuned to behave more like git.git. (Kudos to @arrbee!).

#727 updates the test repo so that they're no longer expose a dirty status. Before I merge it, could you please give a try and rebase your PR on top of it. My local tests show that it fixes most of the issues.

@Therzok
Copy link
Member Author

Therzok commented May 30, 2014

Sure thing! Will do that in a jiffy.

@Therzok
Copy link
Member Author

Therzok commented May 30, 2014

Yes, all tests pass now, thanks @nulltoken . Merge your PR, then this build can be redone.

@Therzok
Copy link
Member Author

Therzok commented May 30, 2014

Wait, one still failed. LibGit2Sharp.Tests.StatusFixture.RetrievingTheStatusOfTheRepositoryHonorsTheGitIgnoreDirectivesThroughoutDirectories.

@nulltoken
Copy link
Member

RetrievingTheStatusOfTheRepositoryHonorsTheGitIgnoreDirectivesThroughoutDirectories

I've seen this as well. @carlosmn is trying to reproduce this through a libgit2 unit test.

@nulltoken
Copy link
Member

Yes, all tests pass now, thanks @nulltoken . Merge your PR, then this build can be redone.

It's currently being run through TeamCity CI server (http://teamcity.codebetter.com/project.html?projectId=LibGit2Sharp). Will be merged shortly after.

@nulltoken
Copy link
Member

Yes, all tests pass now, thanks @nulltoken . Merge your PR, then this build can be redone.

It's currently being run through TeamCity CI server (http://teamcity.codebetter.com/project.html?projectId=LibGit2Sharp). Will be merged shortly after.

@Therzok #727 has been merged.

@Therzok
Copy link
Member Author

Therzok commented May 30, 2014

I'll rebase on top of master and repush.

@Therzok
Copy link
Member Author

Therzok commented May 30, 2014

Done.

@Therzok
Copy link
Member Author

Therzok commented May 30, 2014

So, do I wait for a fix in libgit2 and amend e869a8e?

@carlosmn
Copy link
Member

The fix is in two parts, I'm going to send PRs for them.

@Therzok
Copy link
Member Author

Therzok commented May 30, 2014

Updated to new tip of libgit2 and cherry-picked @carlosmn 's fix. This should be good to go.

@nulltoken
Copy link
Member

@Therzok When the build passes, could you please squash all the commits together into 542e6f0 and add a line to the commit message with the link to the libgit2 github compare (As it's done in fb3c4f0 for instance)?

@nulltoken nulltoken added this to the v0.18.0 milestone May 30, 2014
@Therzok
Copy link
Member Author

Therzok commented May 30, 2014

All the outstanding fixes have been applied and the commits have been squashed. When it goes green, I think this can be merged.

@nulltoken nulltoken merged commit 40ac869 into libgit2:vNext May 30, 2014
@nulltoken
Copy link
Member

@Therzok Amazing work! Thanks: ✨ ✨ ✨ ✨ ✨

@Therzok Therzok deleted the upgradeBinaries branch May 30, 2014 14:57
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.

5 participants