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

Source branch reference should probably be user/repo #20408

Closed
silverwind opened this issue Jul 19, 2022 · 15 comments
Closed

Source branch reference should probably be user/repo #20408

silverwind opened this issue Jul 19, 2022 · 15 comments
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@silverwind
Copy link
Member

silverwind commented Jul 19, 2022

Feature Description

There seem to be various ways that systems refer to the source branch of a PR:

  • user/repo:branch is used by gitea
  • user:branch is used by github
  • user/branch is used by gitlab and in git cli (if remote name is user name)

I'd argue we should go with the format of user/branch, because it lends itself for copy-paste with git cli when remote name equals username, where one can do git checkout -t user/branch. Anyone agree?

Screenshots

image

@silverwind silverwind added type/proposal The new feature has not been accepted yet but needs to be discussed first. type/feature Completely new functionality. Can only be merged if feature freeze is not active. issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail and removed type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels Jul 19, 2022
@noerw
Copy link
Member

noerw commented Jul 26, 2022

You're talking about changing the displayed string, not the way gitea parses these references (eg in compare page url), right?
I'm against changing the latter as that's public api used eg in tea.
If i remember correctly, the syntax supported by gitea for these values also includes the github syntax (user:branch), but not the gitlab syntax, but I'd need to check that again.

No opinion on changing the displayed string - you can also argue that copypasting this string into gitea's compare URL is a similar valid use case ;)

@silverwind
Copy link
Member Author

Yes, only the displayed and copied syntax. To me at least when I work with git cli, I prefer user/branch as my remote names are always the username, and branch names matches theirs of course.

@lunny lunny closed this as completed Mar 29, 2023
@wxiaoguang
Copy link
Contributor

ps: I prefer user/repo:branch, IIRC it can be used directly in URL as /compare/local...user/repo:branch

For command line .... there are 2 options now:

  1. Use tea ?
  2. After my Always show the command line instructions button even if there are conflicts #22909 , I guess the command line could also be copied directly now? Or show something more there?

@lunny
Copy link
Member

lunny commented Mar 29, 2023

I would like to keep this because when I want to review a pull request, I want to pull it. I can copy it to my command line and remove the : in the middle.

BTW: sorry to close this accidentally.

@lunny lunny reopened this Mar 29, 2023
@silverwind
Copy link
Member Author

Yes, same for me. user/branch sytnax is ideal for copy to git CLI.

@lunny
Copy link
Member

lunny commented Mar 29, 2023

As your local branch name? But how do you copy the remote address url?

@silverwind
Copy link
Member Author

silverwind commented Mar 29, 2023

git remote add <user> <url>
git fetch <user>
git checkout -t <user>/<branch>

url is obtained from clicking the branch link and copy from repo, the rest is copied from the PR page.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 29, 2023

After #22909 , I guess the command line could also be copied directly now? Or show something more there?

If the repo is a fork, the command line is also for the fork IIRC.

image

image

@lunny
Copy link
Member

lunny commented Mar 29, 2023

Yes, that's also my habit to follow the command line hint.

@silverwind
Copy link
Member Author

silverwind commented Mar 29, 2023

I actually don't scroll down so far, prefer to copy it from above and if I can use the simple git checkout -t syntax, that'd be even better. I this : separation currently in use is a quirk that was copied from github, / like gitlab does makes a lot more sense as it's much friendlier towards the git client.

@wxiaoguang
Copy link
Contributor

I would agree with noerw:

you can also argue that copypasting this string into gitea's compare URL is a similar valid use case ;)

I also copy the user/repo:banch pattern to construct compare URLs manually.

@silverwind
Copy link
Member Author

Hmm, maybe we need two copy buttons 😆, one for git and one for compare.

@silverwind
Copy link
Member Author

silverwind commented Apr 1, 2023

I suggest we update the PR checkout suggestion to something like this (copied from refined-github extension:

git remote add wxiaoguang [email protected]:wxiaoguang/gitea.git
git fetch wxiaoguang improve-action-log-line
git switch --track wxiaoguang/improve-action-log-line

If the user is the PR author, simplify instructions to

git fetch origin branchname
git switch branchname

Also I would move these instructions to a popup to top-right of the PR, also like the extension does:

image

@GiteaBot
Copy link
Collaborator

GiteaBot commented Sep 8, 2023

We close issues that need feedback from the author if there were no new comments for a month. 🍵

@GiteaBot GiteaBot closed this as completed Sep 8, 2023
@silverwind
Copy link
Member Author

silverwind commented Sep 8, 2023

Can keep closed I guess. I currently fetch and check out branches exclusively with git cli, and there it prints the format that git checkout -t expects.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants