summaryrefslogtreecommitdiff
path: root/sys/src/cmd/git/query.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2021-09-11 17:46:26 +0000
committerOri Bernstein <ori@eigenstate.org>2021-09-11 17:46:26 +0000
commitc7dcc82b0be805717efbe77c98eaadf3ee1e31af (patch)
tree939430f07438b7f88749cb9680ba97df09ca6c14 /sys/src/cmd/git/query.c
parent546f8cfeca6fca0b6b246c8dbf035027e3f15f8c (diff)
git/query: fix spurious merge requests
Due to the way LCA is defined, a using a strict LCA on a graph like this: <--a--b--c--d--e--f--g \ / +-----h------- can lead to spurious requests to merge. This happens because 'lca(b, g)' would return 'a', since it can be reached in one step from 'b', and 2 steps from 'g', while reaching 'b' from 'a' would be a longer path. As a result, we need to implement an lca variant that returns the starting node if one is reachable from the other, even if it's already found the technically correct least common ancestor. This replaces our LCA algorithm with one based on the painting we do while finding a twixt, making it give the resutls we want. git/query: fix spurious merge requests Due to the way LCA is defined, a using a strict LCA on a graph like this: <--a--b--c--d--e--f--g \ / +-----h------- can lead to spurious requests to merge. This happens because 'lca(b, g)' would return 'a', since it can be reached in one step from 'b', and 2 steps from 'g', while reaching 'b' from 'a' would be a longer path. As a result, we need to implement an lca variant that returns the starting node if one is reachable from the other, even if it's already found the technically correct least common ancestor. This replaces our LCA algorithm with one based on the painting we do while finding a twixt.
Diffstat (limited to 'sys/src/cmd/git/query.c')
-rw-r--r--sys/src/cmd/git/query.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/src/cmd/git/query.c b/sys/src/cmd/git/query.c
index cb0f243df..40020eafc 100644
--- a/sys/src/cmd/git/query.c
+++ b/sys/src/cmd/git/query.c
@@ -158,6 +158,7 @@ main(int argc, char **argv)
char query[2048], repo[512];
ARGBEGIN{
+ case 'd': chattygit++; break;
case 'p': fullpath++; break;
case 'c': changes++; break;
case 'r': reverse ^= 1; break;