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.

Signed-off-by: Lukas Wunner <lu...@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!

 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

Reply via email to