dim: Disallow remote branch deletions with 'dim push'
PATCH 1/1 dim: Disallow remote branch deletions with 'dim push'
An inadvertent 'dim push -d' can delete remote branches. Disallow such remote branch deletions.
--- dim | 6 ++++++ 1 file changed, 6 insertions(+)
dim +6 -0
@@ -1029,6 +1029,12 @@ function dim_push_branch fi fi + # Disallow remote branch deletions, say with 'dim push -d' + if [[ "$@" == *"-d"* ]]; then + echoerr "Attempt to delete remote branch, aborting." + return 1 + fi + git_push $remote $branch "$@" update_linux_next $branch drm-intel-next drm-intel-next-fixes drm-intel-fixes
Signature · 1 line
2.38.0
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for dim: Disallow remote branch deletions with 'dim push'
== Series Details ==
== Series Details ==
Series: dim: Disallow remote branch deletions with 'dim push'
URL : https://patchwork.freedesktop.org/series/118744/
State : failure
== Summary ==
Error: patch https://patchwork.freedesktop.org/api/1.0/series/118744/revisions/1/mbox/ not applied
Applying: dim: Disallow remote branch deletions with 'dim push'
error: sha1 information is lacking or useless (dim).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 dim: Disallow remote branch deletions with 'dim push'
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Build failed, no error log produced
Quoted 2 lines · Ashutosh Dixit
An inadvertent 'dim push -d' can delete remote branches. Disallow such remote branch deletions.
Please see https://drm.pages.freedesktop.org/maintainer-tools/CONTRIBUTING.html
Quoted 11 lines
Signed-off-by Ashutosh Dixit <[email protected]>--- dim | 6 ++++++ 1 file changed, 6 insertions(+)dim +0
-0
dim function dim_push_branch · line 1036
Quoted 8 lines
dim +5
-0@@ -1029,6 +1029,12 @@ function dim_push_branch fi fi + # Disallow remote branch deletions, say with 'dim push -d' + if [[ "$@" == *"-d"* ]]; then + echoerr "Attempt to delete remote branch, aborting." + return 1 + fi
I'm working on adding a server side git pre-receive hook to tackle this too, but I guess there's no harm in adding this. The choice of -d for dry run was unfortunate, and this helps with the 'dim -d foo' vs 'dim foo -d' mistake.
BR,
Jani.
Quoted 4 lines
dim +1
-0+ git_push $remote $branch "$@" update_linux_next $branch drm-intel-next drm-intel-next-fixes drm-intel-fixes
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Quoted 21 lines · Jani Nikula
Quoted 2 lines · Ashutosh Dixit
An inadvertent 'dim push -d' can delete remote branches. Disallow such remote branch deletions.
Please see https://drm.pages.freedesktop.org/maintainer-tools/CONTRIBUTING.html
Quoted 14 lines
Signed-off-by Ashutosh Dixit <[email protected]>--- dim | 6 ++++++ 1 file changed, 6 insertions(+)dim +0
-0@@ -1029,6 +1029,12 @@ function dim_push_branch fi fi
Quoted 10 lines
dim function dim_push_branch · line 1036
Quoted 5 lines
dim +5
-0+ # Disallow remote branch deletions, say with 'dim push -d' + if [[ "$@" == *"-d"* ]]; then + echoerr "Attempt to delete remote branch, aborting." + return 1 + fiI'm working on adding a server side git pre-receive hook to tackle this too, but I guess there's no harm in adding this. The choice of -d for dry run was unfortunate, and this helps with the 'dim -d foo' vs 'dim foo -d' mistake.
Yup, understood. I thought I'd just send out the patch anyway in case it was useful.
I have created a merge request for the patch here:
https://gitlab.freedesktop.org/drm/maintainer-tools/-/merge_requests/21
Thanks.
--
Ashutosh
Quoted 7 lines
dim function dim_push_branch · line 1040
Quoted 4 lines
dim +1
-0+ git_push $remote $branch "$@" update_linux_next $branch drm-intel-next drm-intel-next-fixes drm-intel-fixes--
Jani Nikula, Intel Open Source Graphics Center