Giter Site home page Giter Site logo

Error: UnbornBranch about dura HOT 6 OPEN

tkellogg avatar tkellogg commented on June 23, 2024
Error: UnbornBranch

from dura.

Comments (6)

Amanse avatar Amanse commented on June 23, 2024

I am not as familiar with the code base, but as far as i understand, changing in src/snapshots.rs for branch name to be something else should work, but how would you want the parent commit handled? it could be made into an Option<> or maybe error handled when it is needed some other way

from dura.

tkellogg avatar tkellogg commented on June 23, 2024

Ah! Git trivia time! The parent commit is a plain list of commit hashes.

  • 0 commits = first commit
  • 1 commit = the normal case
  • 2 commits = merge commit
  • 3+ commits = octopus merge

So yeah, it's as simple as giving it an empty slice.

from dura.

Amanse avatar Amanse commented on June 23, 2024

love your style haha
i will try this tomorrow(in about ~12 hours)
have really taken a liking to this project πŸ˜„

from dura.

Amanse avatar Amanse commented on June 23, 2024

If dura makes the first commit would that set the dura_unborn as the default branch?
also i am thinking something like this to error handle the head, but it doesn't seem elegant

let head = match repo.head() {
        Ok(v) => peel_to_commit(v)?,
        Err(e) => if e.code() == git2::UnbornBranch {
            // handle unborn branch
        } else {
            return Err(e);
        }
    }
}

from dura.

tkellogg avatar tkellogg commented on June 23, 2024

I don't know. Write a test and find out!

from dura.

Amanse avatar Amanse commented on June 23, 2024

I went the way of making head: Option<git2::Commit> which seemed logical as it can None when there is no head
but this has an adverse effect that all the statements in the capture function need to be if let Some(h) = head and it then extends to parent_commit being an option because git2 doesn't support empty slice as a parent, and the if let Some hell extends to it too.

I am thinking that once we check if head exists or not, it can be divided into 2 capture functions. Once dura makes the commit in the unborn_capture function it will have a head to use and will no longer fall back on that function.

from dura.

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.