Skip to content

Conversation

ilya-nurullin
Copy link
Contributor

@ilya-nurullin ilya-nurullin commented Jul 28, 2025

Closes #19403, and makes it possible to use any remote name in code snippets for an empty repository and pull request.
This change is very helpful to me, because I always use different name for my gitea remote.

Uses setting config module to store the value. Default is origin for backward compatibility.

Screenshots

Empty repo image
Pull Request image
Settings page image

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 28, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files labels Jul 28, 2025
@lunny
Copy link
Member

lunny commented Jul 28, 2025

Maybe it should be a per repository setting but not a global one.

@ilya-nurullin
Copy link
Contributor Author

Maybe it should be a per repository setting but not a global one.

I think we can get started with a global one, and then if needed, make it more precise.
At least, the global one works well for me, and I don't need more granular settings here.

@lunny
Copy link
Member

lunny commented Jul 28, 2025

Even if you intend to add a global configuration, please store it in the database rather than in app.ini.

@ilya-nurullin
Copy link
Contributor Author

ilya-nurullin commented Jul 29, 2025

Even if you intend to add a global configuration, please store it in the database rather than in app.ini.

Done!

@silverwind silverwind added the docs-update-needed The document needs to be updated synchronously label Jul 30, 2025
@lunny lunny added this to the 1.25.0 milestone Jul 30, 2025
@lunny
Copy link
Member

lunny commented Aug 1, 2025

Does the title “Repository Snippets” in the configuration accurately reflect its purpose? It might be more appropriate under the Pull Request Settings section.

@ilya-nurullin
Copy link
Contributor Author

Does the title “Repository Snippets” in the configuration accurately reflect its purpose? It might be more appropriate under the Pull Request Settings section.

This setting affects two pages at once:

  1. Empty repo page - I believe this is the most frequent use case for the setting
  2. Pull Request page - you can do a merge using the button on the page, so snippets are hidden by default

Therefore, I would choose a more general name. I am open to any suggestions.

@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 Aug 3, 2025
@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 Aug 4, 2025
@lunny lunny added reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. and removed docs-update-needed The document needs to be updated synchronously labels Aug 4, 2025
@wxiaoguang wxiaoguang removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Aug 4, 2025
@wxiaoguang wxiaoguang marked this pull request as draft August 4, 2025 03:33
@ilya-nurullin
Copy link
Contributor Author

ilya-nurullin commented Aug 8, 2025

Added new config section setting.Config().Template - the setting works with templates and not with repo itself.

I think Empty Repo Page makes more sense on settings page:
image

@ilya-nurullin ilya-nurullin marked this pull request as ready for review August 8, 2025 15:32
@wxiaoguang
Copy link
Contributor

I think Empty Repo Page makes more sense on settings page:

But it is also for "templates/repo/issue/view_content/pull_merge_instruction.tmpl", it is a guide for end users to checkout the repo into their local clone. So I think it is for "git guide for users", but no idea how to express in English.

@ilya-nurullin
Copy link
Contributor Author

ilya-nurullin commented Aug 15, 2025

Okay,

  1. I've removed val.Def()
  2. changed parse function to return a default value if it is null in db
  3. changed translation to Git Guide
image

@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Aug 21, 2025
@wxiaoguang wxiaoguang marked this pull request as draft August 21, 2025 04:03
@wxiaoguang wxiaoguang marked this pull request as ready for review August 21, 2025 04:59
@wxiaoguang wxiaoguang added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Aug 21, 2025
@wxiaoguang wxiaoguang changed the title Use configurable remote name in snippets Use configurable remote name for git commands Aug 21, 2025
@lunny lunny merged commit e844a41 into go-gitea:main Aug 21, 2025
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Aug 21, 2025
zjjhot added a commit to zjjhot/gitea that referenced this pull request Aug 25, 2025
* giteaofficial/main:
  Prevent duplicate actions email (go-gitea#35215)
  rename nightly docker tag for main branch (go-gitea#35344)
  Fix atom/rss mixed error (go-gitea#35345)
  Remove deprecated auth sources (go-gitea#35272)
  Always return the relevant status information, even if no status exists. (go-gitea#35335)
  [skip ci] Updated translations via Crowdin
  Upgrade mermaid from 11.9.0 to 11.10.0 (go-gitea#35329)
  Use configurable remote name for git commands (go-gitea#35172)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/translation type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change default remote name
6 participants