Skip to content
This repository has been archived by the owner on Jul 13, 2024. It is now read-only.

Branch without commit doesn't show up #292

Closed
parmentelat opened this issue May 7, 2019 · 3 comments
Closed

Branch without commit doesn't show up #292

parmentelat opened this issue May 7, 2019 · 3 comments
Labels
📦 Archived Open issues when project was archived 🐛 Bug Unexpected behavior to be fixed 🎷 @gitgraph/core Specific to @gitgraph/core

Comments

@parmentelat
Copy link

Describe the bug

IMHO a branch that has no new commit yet should still show up

the following code creates 2 branches, but devel won't show up in the output image;
it is still a valid branch, as any git UI would show

To Reproduce

<!DOCTYPE html>
<html>
<head>
  <!-- Load the JS file -->
  <script src="./gitgraph.umd.min.js"></script>
</head>
<body>
  <!-- DOM element in which we'll mount our graph -->
  <div id="graph-container"></div>

  <!-- Use the `GitgraphJS` global variable to create your graph -->
  <script>
    // Get the graph container HTML element.
    const graphContainer = document.getElementById("graph-container");

    // Instantiate the graph.
    const gitgraph = GitgraphJS.createGitgraph(graphContainer);

    // Simulate git commands with Gitgraph API.
    const master = gitgraph.branch("master");
    master.commit("Initial commit");
    master.commit("Second commit");
    let devel = gitgraph.branch("devel");
    master.commit("Third commit");
    master.commit("Fourth commit");
  </script>
</body>
</html>

I do see this:

image

Expected behavior

I would expect something like this

image

@parmentelat parmentelat added the 🐛 Bug Unexpected behavior to be fixed label May 7, 2019
@nicoespeon nicoespeon added the 🎷 @gitgraph/core Specific to @gitgraph/core label May 9, 2019
@nicoespeon nicoespeon changed the title a branch without a commit won't show up Branch without commit doesn't show up May 9, 2019
@nicoespeon
Copy link
Owner

Thanks for raising it @parmentelat.

It's a known issue indeed, I thought we have an issue tracking it, but I can't find it so I guess we didn't. This need to be fixed indeed has the branch would show up in any git GUI / git log.

@addict3d
Copy link

It's a known issue indeed, I thought we have an issue tracking it, but I can't find it so I guess we didn't. This need to be fixed indeed has the branch would show up in any git GUI / git log.

Maybe you are thinking of #258 ? Seems similar IMO.

@levic
Copy link

levic commented Jul 31, 2019

As mentioned, only one label will show up per commit.

However the line between commits is also not drawn when you fork from the ignored branch -- this looks to be the same root cause

Demo: https://codepen.io/codepeon/pen/bXWLmo

const gitgraph = new GitGraph();

const currentrelease = gitgraph.branch("currentrelease");
currentrelease.commit("commit1");

// master and live refer to the same commit
const nextrelease = currentrelease.branch("nextrelease");

// If you uncomment this then it works as you would expect
// nextrelease.commit("commit2");

const branch = nextrelease.branch("branch1");
branch.commit("commit3")

branch.merge(nextrelease);

@nicoespeon nicoespeon added the 📦 Archived Open issues when project was archived label Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
📦 Archived Open issues when project was archived 🐛 Bug Unexpected behavior to be fixed 🎷 @gitgraph/core Specific to @gitgraph/core
Projects
None yet
Development

No branches or pull requests

4 participants