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

Commit 06ab11e

Browse files
committed
Merge develop into master
2 parents e5f2521 + bc66516 commit 06ab11e

15 files changed

+337
-173
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gitgraph.js",
3-
"version": "1.8.0",
3+
"version": "1.8.1",
44
"main": ["./build/gitgraph.js", "./build/gitgraph.css"],
55
"ignore": [
66
"**/.*"

build/gitgraph.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ==========================================================
2-
* GitGraph v1.8.0
2+
* GitGraph v1.8.1
33
* https://github.com/nicoespeon/gitgraph.js
44
* ==========================================================
55
* Copyright (c) 2017 Nicolas CARLO (@nicoespeon) ٩(^‿^)۶
@@ -530,8 +530,8 @@
530530
this.offsetY = this.column * this.spacingY;
531531

532532
// Add start point
533-
if (this.parentBranch) {
534-
if (this.parentCommit === _getParentCommitFromBranch(this.parentBranch)) {
533+
if (this.parentBranch && this.parentCommit) {
534+
if (this.parentCommit === _getParentCommitFromBranch(this.parentBranch) && this.commits.length > 0) {
535535
this.startPoint = {
536536
x: this.parentBranch.offsetX - this.parent.commitOffsetX + this.template.commit.spacingX,
537537
y: this.parentBranch.offsetY - this.parent.commitOffsetY + this.template.commit.spacingY,
@@ -722,8 +722,7 @@
722722
var isFirstBranch = !(options.parentCommit instanceof Commit);
723723
var isPathBeginning = this.path.length === 0;
724724

725-
options.showLabel = (isPathBeginning && this.showLabel) ? true : false;
726-
725+
options.showLabel = (isPathBeginning && this.showLabel);
727726
if (options.showLabel) {
728727
options.x -= this.template.commit.spacingX;
729728
options.y -= this.template.commit.spacingY;
@@ -847,6 +846,12 @@
847846
return this;
848847
}
849848

849+
var firstBranchCommit = this.commits[0];
850+
if (!firstBranchCommit) {
851+
console.log(this.name + " is already up-to-date with " + targetBranch.name);
852+
return this;
853+
}
854+
850855
// Merge commit
851856
var defaultMessage = "Merge branch `" + this.name + "` into `" + targetBranch.name + "`";
852857
if (typeof commitOptions !== "object") {
@@ -859,9 +864,9 @@
859864
commitOptions.type = "mergeCommit";
860865
commitOptions.parentCommit = _getParentCommitFromBranch(this);
861866

862-
var branchParentCommit = this.commits[0].parentCommit;
863-
var parentBranchLastCommit = _getLast(targetBranch.commits);
864-
var isFastForwardPossible = (branchParentCommit.sha1 === parentBranchLastCommit.sha1);
867+
var branchParentCommit = firstBranchCommit.parentCommit;
868+
var targetBranchParentCommit = _getParentCommitFromBranch(targetBranch);
869+
var isFastForwardPossible = (branchParentCommit && branchParentCommit.sha1 === targetBranchParentCommit.sha1);
865870
if (commitOptions.fastForward && isFastForwardPossible) {
866871
var isGraphHorizontal  = _isHorizontal(this.parent);
867872
this.color = targetBranch.color;

build/gitgraph.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Branch.html

+7-7
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ <h5>This:</h5>
593593

594594
<dt class="tag-source">Source:</dt>
595595
<dd class="tag-source"><ul class="dummy"><li>
596-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line922">line 922</a>
596+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line927">line 927</a>
597597
</li></ul></dd>
598598

599599

@@ -665,7 +665,7 @@ <h5>This:</h5>
665665

666666
<dt class="tag-source">Source:</dt>
667667
<dd class="tag-source"><ul class="dummy"><li>
668-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line807">line 807</a>
668+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line806">line 806</a>
669669
</li></ul></dd>
670670

671671

@@ -939,7 +939,7 @@ <h5>This:</h5>
939939

940940
<dt class="tag-source">Source:</dt>
941941
<dd class="tag-source"><ul class="dummy"><li>
942-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line816">line 816</a>
942+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line815">line 815</a>
943943
</li></ul></dd>
944944

945945

@@ -1187,7 +1187,7 @@ <h6>Properties</h6>
11871187

11881188
<dt class="tag-source">Source:</dt>
11891189
<dd class="tag-source"><ul class="dummy"><li>
1190-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line831">line 831</a>
1190+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line830">line 830</a>
11911191
</li></ul></dd>
11921192

11931193

@@ -1282,7 +1282,7 @@ <h5>This:</h5>
12821282

12831283
<dt class="tag-source">Source:</dt>
12841284
<dd class="tag-source"><ul class="dummy"><li>
1285-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line947">line 947</a>
1285+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line952">line 952</a>
12861286
</li></ul></dd>
12871287

12881288

@@ -1648,7 +1648,7 @@ <h6>Properties</h6>
16481648

16491649
<dt class="tag-source">Source:</dt>
16501650
<dd class="tag-source"><ul class="dummy"><li>
1651-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line783">line 783</a>
1651+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line782">line 782</a>
16521652
</li></ul></dd>
16531653

16541654

@@ -1702,7 +1702,7 @@ <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Branch.h
17021702
<br clear="both">
17031703

17041704
<footer>
1705-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Fri Jan 06 2017 09:25:20 GMT+0100 (CET)
1705+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jan 09 2017 23:31:47 GMT+0100 (CET)
17061706
</footer>
17071707

17081708
<script> prettyPrint(); </script>

docs/Commit.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ <h6>Properties</h6>
13351335

13361336
<dt class="tag-source">Source:</dt>
13371337
<dd class="tag-source"><ul class="dummy"><li>
1338-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1021">line 1021</a>
1338+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1026">line 1026</a>
13391339
</li></ul></dd>
13401340

13411341

@@ -1425,7 +1425,7 @@ <h5>This:</h5>
14251425

14261426
<dt class="tag-source">Source:</dt>
14271427
<dd class="tag-source"><ul class="dummy"><li>
1428-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1168">line 1168</a>
1428+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1173">line 1173</a>
14291429
</li></ul></dd>
14301430

14311431

@@ -1497,7 +1497,7 @@ <h5>This:</h5>
14971497

14981498
<dt class="tag-source">Source:</dt>
14991499
<dd class="tag-source"><ul class="dummy"><li>
1500-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1069">line 1069</a>
1500+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1074">line 1074</a>
15011501
</li></ul></dd>
15021502

15031503

@@ -1544,7 +1544,7 @@ <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Branch.h
15441544
<br clear="both">
15451545

15461546
<footer>
1547-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Fri Jan 06 2017 09:25:20 GMT+0100 (CET)
1547+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jan 09 2017 23:31:47 GMT+0100 (CET)
15481548
</footer>
15491549

15501550
<script> prettyPrint(); </script>

docs/GitGraph.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Branch.h
18451845
<br clear="both">
18461846

18471847
<footer>
1848-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Fri Jan 06 2017 09:25:20 GMT+0100 (CET)
1848+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jan 09 2017 23:31:47 GMT+0100 (CET)
18491849
</footer>
18501850

18511851
<script> prettyPrint(); </script>

docs/Tag.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ <h6>Properties</h6>
281281

282282
<dt class="tag-source">Source:</dt>
283283
<dd class="tag-source"><ul class="dummy"><li>
284-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1256">line 1256</a>
284+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1261">line 1261</a>
285285
</li></ul></dd>
286286

287287

@@ -360,7 +360,7 @@ <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Branch.h
360360
<br clear="both">
361361

362362
<footer>
363-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Fri Jan 06 2017 09:25:20 GMT+0100 (CET)
363+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jan 09 2017 23:31:47 GMT+0100 (CET)
364364
</footer>
365365

366366
<script> prettyPrint(); </script>

docs/Template.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ <h6>Properties</h6>
10931093

10941094
<dt class="tag-source">Source:</dt>
10951095
<dd class="tag-source"><ul class="dummy"><li>
1096-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1330">line 1330</a>
1096+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1335">line 1335</a>
10971097
</li></ul></dd>
10981098

10991099

@@ -1228,7 +1228,7 @@ <h5>Parameters:</h5>
12281228

12291229
<dt class="tag-source">Source:</dt>
12301230
<dd class="tag-source"><ul class="dummy"><li>
1231-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1417">line 1417</a>
1231+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1422">line 1422</a>
12321232
</li></ul></dd>
12331233

12341234

@@ -1297,7 +1297,7 @@ <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Branch.h
12971297
<br clear="both">
12981298

12991299
<footer>
1300-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Fri Jan 06 2017 09:25:20 GMT+0100 (CET)
1300+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jan 09 2017 23:31:47 GMT+0100 (CET)
13011301
</footer>
13021302

13031303
<script> prettyPrint(); </script>

docs/gitgraph.js.html

+13-8
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ <h1 class="page-title">Source: gitgraph.js</h1>
547547
this.offsetY = this.column * this.spacingY;
548548

549549
// Add start point
550-
if (this.parentBranch) {
551-
if (this.parentCommit === _getParentCommitFromBranch(this.parentBranch)) {
550+
if (this.parentBranch && this.parentCommit) {
551+
if (this.parentCommit === _getParentCommitFromBranch(this.parentBranch) && this.commits.length > 0) {
552552
this.startPoint = {
553553
x: this.parentBranch.offsetX - this.parent.commitOffsetX + this.template.commit.spacingX,
554554
y: this.parentBranch.offsetY - this.parent.commitOffsetY + this.template.commit.spacingY,
@@ -739,8 +739,7 @@ <h1 class="page-title">Source: gitgraph.js</h1>
739739
var isFirstBranch = !(options.parentCommit instanceof Commit);
740740
var isPathBeginning = this.path.length === 0;
741741

742-
options.showLabel = (isPathBeginning && this.showLabel) ? true : false;
743-
742+
options.showLabel = (isPathBeginning && this.showLabel);
744743
if (options.showLabel) {
745744
options.x -= this.template.commit.spacingX;
746745
options.y -= this.template.commit.spacingY;
@@ -864,6 +863,12 @@ <h1 class="page-title">Source: gitgraph.js</h1>
864863
return this;
865864
}
866865

866+
var firstBranchCommit = this.commits[0];
867+
if (!firstBranchCommit) {
868+
console.log(this.name + " is already up-to-date with " + targetBranch.name);
869+
return this;
870+
}
871+
867872
// Merge commit
868873
var defaultMessage = "Merge branch `" + this.name + "` into `" + targetBranch.name + "`";
869874
if (typeof commitOptions !== "object") {
@@ -876,9 +881,9 @@ <h1 class="page-title">Source: gitgraph.js</h1>
876881
commitOptions.type = "mergeCommit";
877882
commitOptions.parentCommit = _getParentCommitFromBranch(this);
878883

879-
var branchParentCommit = this.commits[0].parentCommit;
880-
var parentBranchLastCommit = _getLast(targetBranch.commits);
881-
var isFastForwardPossible = (branchParentCommit.sha1 === parentBranchLastCommit.sha1);
884+
var branchParentCommit = firstBranchCommit.parentCommit;
885+
var targetBranchParentCommit = _getParentCommitFromBranch(targetBranch);
886+
var isFastForwardPossible = (branchParentCommit && branchParentCommit.sha1 === targetBranchParentCommit.sha1);
882887
if (commitOptions.fastForward && isFastForwardPossible) {
883888
var isGraphHorizontal  = _isHorizontal(this.parent);
884889
this.color = targetBranch.color;
@@ -1814,7 +1819,7 @@ <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Branch.h
18141819
<br clear="both">
18151820

18161821
<footer>
1817-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Fri Jan 06 2017 09:25:20 GMT+0100 (CET)
1822+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jan 09 2017 23:31:47 GMT+0100 (CET)
18181823
</footer>
18191824

18201825
<script> prettyPrint(); </script>

docs/global.html

+14-14
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ <h6>Properties</h6>
406406

407407
<dt class="tag-source">Source:</dt>
408408
<dd class="tag-source"><ul class="dummy"><li>
409-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1500">line 1500</a>
409+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1505">line 1505</a>
410410
</li></ul></dd>
411411

412412

@@ -546,7 +546,7 @@ <h5>Parameters:</h5>
546546

547547
<dt class="tag-source">Source:</dt>
548548
<dd class="tag-source"><ul class="dummy"><li>
549-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1564">line 1564</a>
549+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1569">line 1569</a>
550550
</li></ul></dd>
551551

552552

@@ -681,7 +681,7 @@ <h5>Parameters:</h5>
681681

682682
<dt class="tag-source">Source:</dt>
683683
<dd class="tag-source"><ul class="dummy"><li>
684-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1531">line 1531</a>
684+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1536">line 1536</a>
685685
</li></ul></dd>
686686

687687

@@ -977,7 +977,7 @@ <h5>Parameters:</h5>
977977

978978
<dt class="tag-source">Source:</dt>
979979
<dd class="tag-source"><ul class="dummy"><li>
980-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1581">line 1581</a>
980+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1586">line 1586</a>
981981
</li></ul></dd>
982982

983983

@@ -1184,7 +1184,7 @@ <h5>Parameters:</h5>
11841184

11851185
<dt class="tag-source">Source:</dt>
11861186
<dd class="tag-source"><ul class="dummy"><li>
1187-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1617">line 1617</a>
1187+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1622">line 1622</a>
11881188
</li></ul></dd>
11891189

11901190

@@ -1301,7 +1301,7 @@ <h5>Parameters:</h5>
13011301

13021302
<dt class="tag-source">Source:</dt>
13031303
<dd class="tag-source"><ul class="dummy"><li>
1304-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1542">line 1542</a>
1304+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1547">line 1547</a>
13051305
</li></ul></dd>
13061306

13071307

@@ -1436,7 +1436,7 @@ <h5>Parameters:</h5>
14361436

14371437
<dt class="tag-source">Source:</dt>
14381438
<dd class="tag-source"><ul class="dummy"><li>
1439-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1484">line 1484</a>
1439+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1489">line 1489</a>
14401440
</li></ul></dd>
14411441

14421442

@@ -1571,7 +1571,7 @@ <h5>Parameters:</h5>
15711571

15721572
<dt class="tag-source">Source:</dt>
15731573
<dd class="tag-source"><ul class="dummy"><li>
1574-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1514">line 1514</a>
1574+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1519">line 1519</a>
15751575
</li></ul></dd>
15761576

15771577

@@ -1707,7 +1707,7 @@ <h5>Parameters:</h5>
17071707

17081708
<dt class="tag-source">Source:</dt>
17091709
<dd class="tag-source"><ul class="dummy"><li>
1710-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1646">line 1646</a>
1710+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1651">line 1651</a>
17111711
</li></ul></dd>
17121712

17131713

@@ -1842,7 +1842,7 @@ <h5>Parameters:</h5>
18421842

18431843
<dt class="tag-source">Source:</dt>
18441844
<dd class="tag-source"><ul class="dummy"><li>
1845-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1684">line 1684</a>
1845+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1689">line 1689</a>
18461846
</li></ul></dd>
18471847

18481848

@@ -2001,7 +2001,7 @@ <h5>Parameters:</h5>
20012001

20022002
<dt class="tag-source">Source:</dt>
20032003
<dd class="tag-source"><ul class="dummy"><li>
2004-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1708">line 1708</a>
2004+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1713">line 1713</a>
20052005
</li></ul></dd>
20062006

20072007

@@ -2142,7 +2142,7 @@ <h5>Parameters:</h5>
21422142

21432143
<dt class="tag-source">Source:</dt>
21442144
<dd class="tag-source"><ul class="dummy"><li>
2145-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1695">line 1695</a>
2145+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1700">line 1700</a>
21462146
</li></ul></dd>
21472147

21482148

@@ -2277,7 +2277,7 @@ <h5>Parameters:</h5>
22772277

22782278
<dt class="tag-source">Source:</dt>
22792279
<dd class="tag-source"><ul class="dummy"><li>
2280-
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1673">line 1673</a>
2280+
<a href="gitgraph.js.html">gitgraph.js</a>, <a href="gitgraph.js.html#line1678">line 1678</a>
22812281
</li></ul></dd>
22822282

22832283

@@ -2626,7 +2626,7 @@ <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Branch.h
26262626
<br clear="both">
26272627

26282628
<footer>
2629-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Fri Jan 06 2017 09:25:20 GMT+0100 (CET)
2629+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Jan 09 2017 23:31:47 GMT+0100 (CET)
26302630
</footer>
26312631

26322632
<script> prettyPrint(); </script>

0 commit comments

Comments
 (0)