-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite GitGraph.js #12137
Rewrite GitGraph.js #12137
Conversation
Although this is a rewrite it may be appropriate to backport to 1.12 as the gitgraph is broken there. Otherwise we could backport a simple hacky fix that will prevent the graph from disappearing by just assigning a '#000' flow whenever a flow is missing e.g. for 1.12 apply the below patch: diff --git a/web_src/js/vendor/gitgraph.js b/web_src/js/vendor/gitgraph.js
index 0cf5d0f75..7a5777598 100644
--- a/web_src/js/vendor/gitgraph.js
+++ b/web_src/js/vendor/gitgraph.js
@@ -376,7 +376,18 @@ export default function gitGraph(canvas, rawGraphList, config) {
flows.splice(colomnIndex, 0, genNewFlow());
}
- color = flows[colomnIndex].color;
+ if (colomnIndex < flows.length) {
+ color = flows[colomnIndex].color;
+ } else {
+ console.error({
+ message: "Missing flow!",
+ colomnIndex,
+ colomn,
+ prevColomn,
+ flowSwapPos,
+ });
+ color = "#000";
+ }
switch (colomn) {
case '-': |
Good example graphs to test this can be found in #11981: https://try.gitea.io/ahaha/glu/graph |
The current vendored gitgraph.js is no longer maintained and is difficult to understand, fix and maintain. This PR completely rewrites its logic - hopefully in a clearer fashion and easier to maintain. It also includes @silverwind's improvements of coloring the commit dots and preventing the flash of incorrect content. Further changes to contemplate in future will be abstracting out of the flows to an object, storing the involved commit references on the flows etc. However, this is probably a required step for this. Replaces go-gitea#12131 Fixes go-gitea#11981 (part 3) Signed-off-by: Andrew Thornton <art27@cantab.net>
fd31d11
to
8c55116
Compare
🚀 |
The current vendored gitgraph.js is no longer maintained and is difficult to understand, fix and maintain. This PR completely rewrites its logic - hopefully in a clearer fashion and easier to maintain. It also includes @silverwind's improvements of coloring the commit dots and preventing the flash of incorrect content. Further changes to contemplate in future will be abstracting out of the flows to an object, storing the involved commit references on the flows etc. However, this is probably a required step for this. Replaces go-gitea#12131 Fixes go-gitea#11981 (part 3) Signed-off-by: Andrew Thornton <art27@cantab.net>
The current vendored gitgraph.js is no longer maintained and is
difficult to understand, fix and maintain.
This PR completely rewrites its logic - hopefully in a clearer fashion
and easier to maintain.
It also includes @silverwind's improvements of coloring the commit dots
and preventing the flash of incorrect content.
Further changes to contemplate in future will be abstracting out of the
flows to an object, storing the involved commit references on the flows
etc. However, this is probably a required step for this.
Replaces #12131
Fixes #11981 (part 3)
Signed-off-by: Andrew Thornton art27@cantab.net