diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-12 18:09:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-12 18:09:17 +0300 |
commit | 901ecdbf5cccc7f40a4e959835389af19ddd87ee (patch) | |
tree | e882146114a6cc2c009d4e1c4229aaeccc226cc4 /doc/user/project/repository | |
parent | a99c04f0185d6a6b398c37630c392ca84494c0a5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/user/project/repository')
-rw-r--r-- | doc/user/project/repository/index.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/doc/user/project/repository/index.md b/doc/user/project/repository/index.md index 7d83800659b..bcdb626d0f2 100644 --- a/doc/user/project/repository/index.md +++ b/doc/user/project/repository/index.md @@ -306,3 +306,33 @@ The same approach should also allow misidentified file types to be fixed. ``` `*.txt` files have an entry in the heuristics file. This example prevents parsing of these files. + +### Search sequence of pushes to a repository + +If it seems that a commit has gone "missing", search the sequence of pushes to a repository. +[This StackOverflow article](https://stackoverflow.com/questions/13468027/the-mystery-of-the-missing-commit-across-merges) +describes how you can end up in this state without a force push. Another cause can be a misconfigured [server hook](../../../administration/server_hooks.md) that changes a HEAD ref in a `git reset` operation. + +If you look at the output from the sample code below for the target branch, you +see a discontinuity in the from/to commits as you step through the output. +The `commit_from` of each new push should equal the `commit_to` of the previous push. +A break in that sequence indicates one or more commits have been "lost" from the repository history. + +Using the [rails console](../../../administration/operations/rails_console.md#starting-a-rails-console-session), the following example checks the last 100 pushes and prints the `commit_from` and `commit_to` entries: + +```ruby +p = Project.find_by_full_path('project/path') +p.events.pushed_action.last(100).each do |e| + puts "%-20.20s %8s...%8s (%s)", e.push_event_payload[:ref], e.push_event_payload[:commit_from], e.push_event_payload[:commit_to], e.author.try(:username) +end ; nil +``` + +Example output showing break in sequence at line 4: + +```plaintext +master f21b07713251e04575908149bdc8ac1f105aabc3...6bc56c1f46244792222f6c85b11606933af171de root +master 6bc56c1f46244792222f6c85b11606933af171de...132da6064f5d3453d445fd7cb452b148705bdc1b root +master 132da6064f5d3453d445fd7cb452b148705bdc1b...a62e1e693150a2e46ace0ce696cd4a52856dfa65 root +master 58b07b719a4b0039fec810efa52f479ba1b84756...f05321a5b5728bd8a89b7bf530aa44043c951dce root +master f05321a5b5728bd8a89b7bf530aa44043c951dce...7d02e575fd790e76a3284ee435368279a5eb3773 root +``` |