Skip to content

Conversation

@ethomson
Copy link
Member

@ethomson ethomson commented Nov 3, 2014

Updating libgit2 to 0a62918. The current version in HEAD (0383fa) had an unfortunate bug updating the tree cache (libgit2/libgit2#2629) that can cause some issues.

@Therzok
Copy link
Member

Therzok commented Nov 3, 2014

Also change the build scripts to not set DTHREADSAFE, since it's ON by default now.

@ethomson
Copy link
Member Author

ethomson commented Nov 3, 2014

Do we want Remotes.Rename to silently ignore when the source does not exist? This is the current behavior, which seems odd to me.

If we want to keep this behavior, I'll have to make some changes to libgit2.

/cc @nulltoken

@jamill
Copy link
Member

jamill commented Nov 3, 2014

I would expect an error if we tried to rename a non-existing remote. Maybe there is a specific use case this test is covering?

@nulltoken
Copy link
Member

I would expect an error if we tried to rename a non-existing remote. Maybe there is a specific use case this test is covering?

👍

@nulltoken nulltoken added this to the v0.20 milestone Nov 3, 2014
@ethomson
Copy link
Member Author

ethomson commented Nov 3, 2014

Whether we want to throw a reasonable error message or swallow that, we need a GIT_ENOTFOUND out of libgit2. See libgit2/libgit2#2686

@ethomson ethomson force-pushed the ed/libgit2_update branch 2 times, most recently from 5538ab6 to 1c4e13e Compare November 3, 2014 22:43
@ethomson
Copy link
Member Author

ethomson commented Nov 3, 2014

Okay, with the inclusion of libgit2/libgit2#2686, we can now throw a NotFoundException when trying to rename a nonexistent remote. I think this is ready for review.

ref array.Array,
remote,
new_name);
throw new NotFoundException("The given remote was not found");
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 string.Format("Remote '{0}' hasn't been renamed as it doesn't exist.", name)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure - I changed the text ever so slightly (to lead with the nonexistent
ref), but let me know if you prefer your text.

On Mon, Nov 3, 2014 at 6:35 PM, nulltoken [email protected] wrote:

In LibGit2Sharp/Core/Proxy.cs:

                 {
  •                    int res = NativeMethods.git_remote_rename(
    
  •                        ref array.Array,
    
  •                        remote,
    
  •                        new_name);
    
  •                    throw new NotFoundException("The given remote was not found");
    

How about string.Format("Remote '{0}' hasn't been renamed as it doesn't
exist.", name)?


Reply to this email directly or view it on GitHub
https://github.com/libgit2/libgit2sharp/pull/857/files#r19775923.

Copy link
Member

Choose a reason for hiding this comment

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

Well, the message proposal can surely be improved. But having the name of the missing remote in it would help 😉

Copy link
Member

Choose a reason for hiding this comment

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

My previous comment was referring to my proposal. Yours is just perfect!

@dahlbyk dahlbyk changed the title Update libgit2 to 0a62918 Update libgit2 to 3f8d005 Nov 3, 2014
/// </summary>
/// <param name="url">The URL to be checked.</param>
/// <returns>true if the url is supported; false otherwise.</returns>
public static bool IsSupportedUrl(string url)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this go through an [Obsolete] cycle?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's gone in libgit2, so we'd have to fake this in libgit2sharp to do that, or revert the change in libgit2 to keep it obsolete for a while.

Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately, it's no longer exposed by libgit2.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

[Obsolete] with a trivial implementation (e.g. url != null && url.IndexOf(':') > 0)?

Copy link
Member

Choose a reason for hiding this comment

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

This simple temporary implementation wouldn't be enough to cover the test cases

        [Theory]
        [InlineData("[email protected]:org/repo.git", false)]
        [InlineData("git://site.com:80/org/repo.git", true)]
        [InlineData("ssh://[email protected]:80/org/repo.git", false)]
        [InlineData("http://site.com:80/org/repo.git", true)]
        [InlineData("https://github.com:80/org/repo.git", true)]
        [InlineData("ftp://site.com:80/org/repo.git", false)]
        [InlineData("ftps://site.com:80/org/repo.git", false)]
        [InlineData("file:///path/repo.git", true)]
        [InlineData("protocol://blah.meh/whatever.git", false)]

...but I think it'd a waste of time to make it more complex for the sake of maintaining an obsolete for this function.

I'm 👍 to kill it

Copy link
Member

Choose a reason for hiding this comment

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

If it was deleted from lg2 in the first place because it was too restrictive, those test cases are wrong anyway. ¯(°_o)/¯

@ethomson ethomson force-pushed the ed/libgit2_update branch 2 times, most recently from 2597ae8 to 4d76d49 Compare November 3, 2014 23:56
@nulltoken nulltoken merged commit ed519c5 into libgit2:vNext Nov 4, 2014
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