author | Paul Mackerras <paulus@samba.org> | |
Sun, 24 Feb 2008 01:16:56 +0000 (12:16 +1100) | ||
committer | Paul Mackerras <paulus@samba.org> | |
Sun, 24 Feb 2008 01:16:56 +0000 (12:16 +1100) | ||
commit | f806f0fba8ce62f2c74f21419e2bd1e7ce9e565b | |
tree | aab92d97a3060f1a1be180aa05352ed9aa4e83da | tree | snapshot |
parent | 841ea8244913bd8953fdd43e54d9965f02bebae6 | commit | diff |
gitk: Handle updating with path limiting better
When updating the graph, gitk uses a git log command with commit
limiting in order to get just the new commits. When path limiting
is also in effect, git log rewrites the parents of the commits it
outputs in order to represent just the subgraph that modifies the
listed paths, but it doesn't rewrite the parents on the boundary
of the graph. The result is that when updating, git log does not
give gitk the information about where the new commits join in to
the existing graph.
This solves the problem by explicitly rewriting boundary parents
when updating. If we are updating and are doing path limiting,
then when gitk finds an unlisted commit (one where git log puts a
"-" in front of the commit ID to indicate that it isn't actually
part of the graph), then gitk will execute:
git rev-list --first-parent --max-count=1 $id -- paths...
which returns the first ancestor that affects the listed paths.
(Currently gitk executes this synchronously; it could do it
asynchronously, which would be more complex but would avoid the
possibility of the UI freezing up if git rev-list takes a long time.)
Then, if the result is a commit that we know about, we rewrite the
parents of the children of the original commit to point to the new
commit. That is mostly a matter of adjusting the parents and children
arrays and calling fix_reversal to fix up the graph.
Signed-off-by: Paul Mackerras <paulus@samba.org>
When updating the graph, gitk uses a git log command with commit
limiting in order to get just the new commits. When path limiting
is also in effect, git log rewrites the parents of the commits it
outputs in order to represent just the subgraph that modifies the
listed paths, but it doesn't rewrite the parents on the boundary
of the graph. The result is that when updating, git log does not
give gitk the information about where the new commits join in to
the existing graph.
This solves the problem by explicitly rewriting boundary parents
when updating. If we are updating and are doing path limiting,
then when gitk finds an unlisted commit (one where git log puts a
"-" in front of the commit ID to indicate that it isn't actually
part of the graph), then gitk will execute:
git rev-list --first-parent --max-count=1 $id -- paths...
which returns the first ancestor that affects the listed paths.
(Currently gitk executes this synchronously; it could do it
asynchronously, which would be more complex but would avoid the
possibility of the UI freezing up if git rev-list takes a long time.)
Then, if the result is a commit that we know about, we rewrite the
parents of the children of the original commit to point to the new
commit. That is mostly a matter of adjusting the parents and children
arrays and calling fix_reversal to fix up the graph.
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk | diff | blob | history |