[PATCH dim-tools] dim: Avoid hardcoding remote name for linux-upstream
Rodrigo Vivi
rodrigo.vivi at intel.com
Tue Jul 8 21:19:52 UTC 2025
On Sat, Jul 05, 2025 at 10:51:36AM +0200, Lukas Wunner wrote:
> dim hardcodes "origin" as remote name for linux-upstream in a number of
> places. This (only) works if "origin" is indeed Torvalds' repo.
>
> Resolve the remote name for linux-upstream at runtime to make dim work
> with local repos that lack an "origin" remote or use it for something
> else.
I'm afraid this doesn't 'resolve the name' but instead force everyone
else to use linux-upstream as the name for Linus branch. I know that
origin might not be ideal for everyone, but imho is better then
forcing everyone to stick with a non-standard name.
Just an example here as I tried to apply your patch and then created
a function in my .dimrc:
dim_blah()
{
echo $(repo_to_remote linux-upstream)/master
}
rdvivi at rdvivi-mobl1:~/linux/maintainer-tools$ dim blah
dim: Adding remote for linux-upstream repo from URLs:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux.git
Enter a name to auto-add this remote, leave blank to abort: linux-upstream
I know, you might say that I could then come here and type 'origin' and
we would both be covered, but besides the inconvenience, it is not that
straight forward:
rdvivi at rdvivi-mobl1:~/linux/maintainer-tools$ dim blah
dim: Adding remote for linux-upstream repo from URLs:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux.git
Enter a name to auto-add this remote, leave blank to abort: origin
error: remote origin already exists.
origin/master
I mean, I support the idea to find some flexible way, just please make it
straightforward to everyone and without forcing your naming on everybody.
another comment below:
>
> Signed-off-by: Lukas Wunner <lukas at wunner.de>
> ---
> Somebody please consider applying this. It looks like I cannot push to
> the maintainer-tools repo despite being allowed to push to drm-misc.
> Or I'm doing something wrong. Thanks!
Please take a look at:
https://gitlab.freedesktop.org/drm/maintainer-tools
We are now sending merge requests there instead of patches in this mailing list.
Thanks a lot,
Rodrigo.
>
> dim | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/dim b/dim
> index 81e46f7990f7..9df23992188d 100755
> --- a/dim
> +++ b/dim
> @@ -1352,7 +1352,7 @@ function dim_apply_pull
> fi
>
> check_merge_baseline FETCH_HEAD $branch $(branch_to_remote drm-fixes)/drm-fixes
> - check_merge_baseline FETCH_HEAD $branch origin/master
> + check_merge_baseline FETCH_HEAD $branch $(repo_to_remote linux-upstream)/master
>
> repo=$(branch_to_repo $branch)
> checkpatch_commit_push_range 0 $repo "HEAD..FETCH_HEAD"
> @@ -2404,7 +2404,7 @@ function dim_pull_request_next
>
> function dim_pull_request_fixes
> {
> - upstream=${1:-origin/master}
> + upstream=${1:-$(repo_to_remote linux-upstream)/master}
> dim_pull_request drm-intel-fixes $upstream
> }
>
> @@ -2419,7 +2419,7 @@ function dim_list_upstreams
> {
> cd $DIM_PREFIX/$DIM_REPO
>
> - echo origin/master
> + echo $(repo_to_remote linux-upstream)/master
> echo $(branch_to_remote drm-next)/drm-next
> echo $(branch_to_remote drm-fixes)/drm-fixes
> }
> @@ -2478,7 +2478,7 @@ function dim_status
> drm_next_upstream=$(branch_to_remote drm-fixes)/drm-fixes
> drm_fixes_upstream=$(branch_to_remote drm-next)/drm-next
>
> - patches=$(git log --oneline $remote/$branch ^origin/master \
> + patches=$(git log --oneline $remote/$branch ^$(repo_to_remote linux-upstream)/master \
> ^$drm_next_upstream ^$drm_fixes_upstream | wc -l)
>
> if [[ $patches -ne 0 ]] ; then
> @@ -2706,7 +2706,7 @@ function dim_tc
> fi
>
> # not in a tagged release, show upstream branches
> - remote_branches="origin/master"
> + remote_branches="$(repo_to_remote linux-upstream)/master"
> for conf in "${drm_tip_config[@]}"; do
> local repo branch override remote
>
> --
> 2.47.2
>
More information about the dim-tools
mailing list