Skip to content
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

Fix commit status icon when in subdirectory #20285

Merged
merged 2 commits into from
Jul 15, 2022

Conversation

silverwind
Copy link
Member

When viewing a subdirectory and the latest commit to that directory in the table, the commit status icon incorrectly showed the status of the HEAD commit instead of the latest for that directory.

Showcase of the difference:

HEAD commit:

Screen Shot 2022-07-07 at 22 30 48

Latest commit to directory, this was previously also yellow circle:

Screen Shot 2022-07-07 at 22 30 41

@silverwind silverwind added the backport/done All backports for this PR have been created label Jul 7, 2022
routers/web/repo/view.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 8, 2022
@lunny lunny added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Jul 8, 2022
@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 Jul 9, 2022
routers/web/repo/view.go Outdated Show resolved Hide resolved
@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 Jul 10, 2022
@silverwind
Copy link
Member Author

silverwind commented Jul 11, 2022

@lunny yeah, I think you are right, latestCommit should always be non-nil at this point, making the if block unnecessary. I've removed it. Pretty sure this is correct as a empty repo will probably either not reach renderDirectoryFiles or bail out on GetCommitsInfo.

routers/web/repo/view.go Outdated Show resolved Hide resolved
When viewing a subdirectory and the latest commit to that directory in
the table, the commit status icon incorrectly showed the status of the
HEAD commit instead of the latest for that directory.
@silverwind
Copy link
Member Author

silverwind commented Jul 14, 2022

Okay i've restored the if clause and moved everything that depends on latestCommit inside it. From what I can tell, the template code can deal with ctx.Data LatestCommitStatus and LatestCommitStatus being not defined, so it should be fine.

@zeripath
Copy link
Contributor

make lgtm work

@zeripath zeripath merged commit 7d20c83 into go-gitea:main Jul 15, 2022
@zeripath zeripath removed the backport/done All backports for this PR have been created label Jul 15, 2022
@zeripath
Copy link
Contributor

please send backport

zjjhot added a commit to zjjhot/gitea that referenced this pull request Jul 15, 2022
* upstream/main:
  Fix commit status icon when in subdirectory (go-gitea#20285)
  Fix eslint parsing errors, remove eslint-plugin-html (go-gitea#20323)
  Include login_name in adminCreateUser response (go-gitea#20283)
  Add allow_rebase_update, default_delete_branch_after_merge to repository api response (go-gitea#20079)
  Allow to specify colors for text in markup (go-gitea#20363)
  [skip ci] Updated translations via Crowdin
  update xorm.io/xorm v1.3.2-0.20220714055524-c3bce556200f (go-gitea#20371)
  Add order by for assignee no sort issue (go-gitea#20053)
  Make sure `repo_dir` is an empty directory or doesn't exist before 'dump-repo' (go-gitea#20205)
  Fix English mistakes in some Markdown documents (go-gitea#20274)
  Fix versions check for busybox `sh` (go-gitea#20358)
@silverwind silverwind deleted the commit-status branch July 15, 2022 15:21
silverwind added a commit to silverwind/gitea that referenced this pull request Jul 15, 2022
When viewing a subdirectory and the latest commit to that directory in
the table, the commit status icon incorrectly showed the status of the
HEAD commit instead of the latest for that directory.
dineshsalunke pushed a commit to dineshsalunke/gitea that referenced this pull request Jul 15, 2022
When viewing a subdirectory and the latest commit to that directory in
the table, the commit status icon incorrectly showed the status of the
HEAD commit instead of the latest for that directory.
@6543 6543 added this to the 1.18.0 milestone Jul 16, 2022
6543 pushed a commit that referenced this pull request Jul 16, 2022
When viewing a subdirectory and the latest commit to that directory in
the table, the commit status icon incorrectly showed the status of the
HEAD commit instead of the latest for that directory.
@zeripath zeripath added the backport/done All backports for this PR have been created label Jul 17, 2022
vsysoev pushed a commit to IntegraSDL/gitea that referenced this pull request Aug 10, 2022
When viewing a subdirectory and the latest commit to that directory in
the table, the commit status icon incorrectly showed the status of the
HEAD commit instead of the latest for that directory.
@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
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants