-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Support .git-blame-ignore-revs
file
#26395
Merged
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
1aeb8f2
Add ability to ignore revs.
KN4CK3R b2d9961
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R e1a0ade
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R 734048b
Handle faulty .git-blame-ignore-revs files.
KN4CK3R 4125e33
Add docs.
KN4CK3R c482da4
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R ac922ee
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R 276e11b
Merge branch 'main' into feature-blame-ignore-revs
KN4CK3R 61b079b
Merge branch 'main' into feature-blame-ignore-revs
KN4CK3R 2da7857
Update modules/git/blame.go
KN4CK3R d01b712
Apply suggestions.
KN4CK3R b4a1ab7
Merge branch 'main' of https://github.com/go-gitea/gitea into feature…
KN4CK3R 833c640
Merge branch 'feature-blame-ignore-revs' of https://github.com/KN4CK3…
KN4CK3R 8d9e575
Merge branch 'main' into feature-blame-ignore-revs
KN4CK3R File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
date: "2023-08-14T00:00:00+00:00" | ||
title: "Blame File View" | ||
slug: "blame" | ||
sidebar_position: 13 | ||
toc: false | ||
draft: false | ||
aliases: | ||
- /en-us/blame | ||
menu: | ||
sidebar: | ||
parent: "usage" | ||
name: "Blame" | ||
sidebar_position: 13 | ||
identifier: "blame" | ||
--- | ||
|
||
# Blame File View | ||
|
||
Gitea supports viewing the line-by-line revision history for a file also known as blame view. | ||
You can also use [`git blame`](https://git-scm.com/docs/git-blame) on the command line to view the revision history of lines within a file. | ||
|
||
1. Navigate to and open the file whose line history you want to view. | ||
1. Click the `Blame` button in the file header bar. | ||
1. The new view shows the line-by-line revision history for a file with author and commit information on the left side. | ||
1. To navigate to an older commit, click the ![versions](/octicon-versions.svg) icon. | ||
|
||
## Ignore commits in the blame view | ||
|
||
All revisions specified in the `.git-blame-ignore-revs` file are hidden from the blame view. | ||
This is especially useful to hide reformatting changes and keep the benefits of `git blame`. | ||
Lines that were changed or added by an ignored commit will be blamed on the previous commit that changed that line or nearby lines. | ||
The `.git-blame-ignore-revs` file must be located in the root directory of the repository. | ||
For more information like the file format, see [the `git blame --ignore-revs-file` documentation](https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt). | ||
|
||
### Bypassing `.git-blame-ignore-revs` in the blame view | ||
|
||
If the blame view for a file shows a message about ignored revisions, you can see the normal blame view by appending the url parameter `?bypass-blame-ignore=true`. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ref: refs/heads/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[core] | ||
repositoryformatversion = 0 | ||
filemode = true | ||
bare = true |
Binary file added
BIN
+98 Bytes
modules/git/tests/repos/repo6_blame/objects/31/bb4b42cecf0a98fc9a32fc5aaeaf53ec52643c
Binary file not shown.
Binary file added
BIN
+35 Bytes
modules/git/tests/repos/repo6_blame/objects/3b/0f66d8b065f8adbf2fef7d986528c655b98cb1
Binary file not shown.
Binary file added
BIN
+167 Bytes
modules/git/tests/repos/repo6_blame/objects/45/fb6cbc12f970b04eacd5cd4165edd11c8d7376
Binary file not shown.
Binary file added
BIN
+24 Bytes
modules/git/tests/repos/repo6_blame/objects/49/7701e5bb8676e419b93875d8f0808c7b31aed9
Binary file not shown.
Binary file added
BIN
+175 Bytes
modules/git/tests/repos/repo6_blame/objects/54/4d8f7a3b15927cddf2299b4b562d6ebd71b6a7
Binary file not shown.
Binary file added
BIN
+57 Bytes
modules/git/tests/repos/repo6_blame/objects/a8/9199e8dea077e4a8ba0bc01bc155275cfdd044
Binary file not shown.
Binary file added
BIN
+134 Bytes
modules/git/tests/repos/repo6_blame/objects/af/7486bd54cfc39eea97207ca666aa69c9d6df93
Binary file not shown.
Binary file added
BIN
+54 Bytes
modules/git/tests/repos/repo6_blame/objects/b8/d1ba1ccb58ee3744b3d1434aae7d26ce2d9421
Binary file not shown.
Binary file added
BIN
+54 Bytes
modules/git/tests/repos/repo6_blame/objects/ca/411a3b842c3caec045772da42de16b3ffdafe8
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
544d8f7a3b15927cddf2299b4b562d6ebd71b6a7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems strange to store a closed
File
here. Maybe usingignoreRevsFileName string
is good enough?Otherwise it's not easy to understand when the file should be closed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used
os.File
here to have an explicitnil
check. Sure a!= ""
check works too but my intent was to have a real file linked to the object. How about changing this member toos.FileInfo
? That should be the best of both worlds.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the file has been closed, the object itself can't do other things except accessing the
f.Name()
, which is simply{ return f.name }