Skip to content

Conversation

@zeripath
Copy link
Contributor

This PR adds a doctor command to write the commit-graphs for the repositories:

gitea doctor --run check-commit-graphs --fix

Signed-off-by: Andrew Thornton [email protected]

This PR adds a doctor command to write the commit-graphs for the repositories:

`gitea doctor --run check-commit-graphs --fix`

Signed-off-by: Andrew Thornton <[email protected]>
@zeripath zeripath added the type/enhancement An improvement of existing functionality label Jun 17, 2022
@zeripath zeripath added this to the 1.18.0 milestone Jun 17, 2022
@zeripath
Copy link
Contributor Author

could be moved to 1.17

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 17, 2022

if !isExist {
commitGraphsDir := path.Join(repo.RepoPath(), `objects/info/commit-graphs`)
isExist, err = util.IsExist(commitGraphsDir)
Copy link
Member

@delvh delvh Jun 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a case missing that this directory is not empty?
Or what is the file format inside this directory?
Shouldn't this be checked as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think its worth checking for the format of the directory and/or file at this point.

If you are really interested in how commit graphs are created you are welcome to peruse:

https://github.com/git/git/blob/master/Documentation/technical/commit-graph.txt

and

https://github.com/git/git/blob/master/Documentation/technical/commit-graph-format.txt

Here is the salient points for the contents of commit-graphs

A commit-graph chain uses multiple files, and we use a fixed naming convention
to organize these files. Each commit-graph file has a name
`$OBJDIR/info/commit-graphs/graph-{hash}.graph` where `{hash}` is the hex-
valued hash stored in the footer of that file (which is a hash of the file's
contents before that hash). For a chain of commit-graph files, a plain-text
file at `$OBJDIR/info/commit-graphs/commit-graph-chain` contains the
hashes for the files in order from "lowest" to "highest".

We could assert that the chain file exists instead of the directory I guess.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 23, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 23, 2022
@zeripath zeripath merged commit 2111741 into go-gitea:main Jun 25, 2022
@zeripath zeripath deleted the doctor-commitgraph branch June 25, 2022 19:02
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants