Code Monkey home page Code Monkey logo

Comments (6)

danreeves avatar danreeves commented on June 10, 2024 1

Sure! I'll try to take a look in the next few days

from changelog.

yoshuawuyts avatar yoshuawuyts commented on June 10, 2024

Whooops, looks like some of our traversal logic might have gone wrong, most likely somewhere here: https://github.com/yoshuawuyts/changelog/blob/master/src/git.rs#L78-L114.

@danreeves would you perhaps like to try and fix this?

from changelog.

yoshuawuyts avatar yoshuawuyts commented on June 10, 2024

@danreeves awesome! -- happy to help if you have any questions! ✨

from changelog.

danreeves avatar danreeves commented on June 10, 2024

Spent a little time investigating this morning and found two situations where the logic breaks down.

1. Lightweight tags

Created with git tag [name], a lightweight tag doesn't have it's own object, it just points to a commit.

2. Having a single (annotated) tag

In the case where you've only got a single tag the the end will be a commit object rather than a tag.

For example:

"Expected" output of get_commit_range:

start: Object { kind: Tag, id: ... } 
end: Object { kind: Tag, id: ... }

Output in case 1:

start: Object { kind: Commit, id: ... } 
end: Object { kind: Commit, id: ... }

Output in case 2:

start: Object { kind: Tag, id: ... } 
end: Object { kind: Commit, id: ... }

Solution

Unfortunately you can't just .as_tag() a commit object in the case of lightweight tags, and that wouldn't work in the case where an end tag doesn't even exist. Perhaps it might make sense to return something like this from get_commit_range:

struct CommitRange {
	latest_tag: Tag,
	start: git2::Commit,
	end: git2::Commit,
}

How does that sound?

from changelog.

yoshuawuyts avatar yoshuawuyts commented on June 10, 2024

@danreeves that sounds like a very reasonable solution; I like it!

from changelog.

danreeves avatar danreeves commented on June 10, 2024

Resolved by #13

from changelog.

Related Issues (14)

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.