Message ID | 20170731171553.30586-1-thierry.reding@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, 31 Jul 2017, Thierry Reding <thierry.reding@gmail.com> wrote: > From: Thierry Reding <treding@nvidia.com> > > The new apply and push commands are shorthands for applying patches to > and pushing the current branch, respectively. There's been some talk about moving further in the direction of using the current branch and current directory, like git does. I think the historical reason for having to explicitly specify the branch is to avoid shooting oneself in the foot. To avoid that oops from a quick apply and push. The safety catch. I'm not opposed, but this is the reason. One comment below. BR, Jani. > > v2: use git symbolic-ref to find current branch (Daniel Vetter) > > Signed-off-by: Thierry Reding <treding@nvidia.com> > --- > dim | 18 ++++++++++++++++++ > dim.rst | 8 ++++++++ > 2 files changed, 26 insertions(+) > > diff --git a/dim b/dim > index c0cbe352b165..1422b35e2471 100755 > --- a/dim > +++ b/dim > @@ -326,6 +326,11 @@ function git_fetch_helper # remote > fi > } > > +function git_current_branch > +{ > + git symbolic-ref -q --short HEAD > +} > + > function git_is_current_branch # branch > { > git branch --list $1 | grep -q '\*' > @@ -739,6 +744,11 @@ function dim_push_fixes > dim_push_branch drm-intel-fixes "$@" > } > > +function dim_push > +{ > + dim_push_branch $(git_current_branch) "$@" > +} > + > # ensure we're on branch $1, and apply patches. the rest of the arguments are > # passed to git am. > dim_alias_ab=apply-branch > @@ -930,6 +940,14 @@ function dim_apply_next_fixes > dim_apply_branch drm-intel-next-fixes "$@" > } > > +# apply patch to current branch, the rest of the arguments are passed to > +# git am > +dim_alias_am=apply > +function dim_apply > +{ > + dim_apply_branch $(git_current_branch) "$@" > +} > + > function commit_list_references > { > local commit remote log > diff --git a/dim.rst b/dim.rst > index c004c30ada17..fa9b587d73bb 100644 > --- a/dim.rst > +++ b/dim.rst > @@ -198,6 +198,10 @@ apply-queued [*git am arguments*] > **apply-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and > *drm-intel-next-queued* branches respectively. > > +apply [*git am arguments*] > +-------------------------- > +**apply-branch** shorthand for the current branch. > + > extract-tags *branch* [*git-rangeish*] > -------------------------------------- > This extracts various tags (e.g. Reviewed-by:) from emails and applies them to the > @@ -232,6 +236,10 @@ push-queued [*git push arguments*] > **push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and > *drm-intel-next-queued* branches respectively. > > +push [*git push arguments*] > +--------------------------- > +**push** shorthand for the current branch. I think you mean **push-branch** shorthand. > + > rebuild-tip > ----------- > Rebuild and push the integration tree.
On Thu, Aug 03, 2017 at 01:50:12PM +0300, Jani Nikula wrote: > On Mon, 31 Jul 2017, Thierry Reding <thierry.reding@gmail.com> wrote: > > From: Thierry Reding <treding@nvidia.com> > > > > The new apply and push commands are shorthands for applying patches to > > and pushing the current branch, respectively. > > There's been some talk about moving further in the direction of using > the current branch and current directory, like git does. I think the > historical reason for having to explicitly specify the branch is to > avoid shooting oneself in the foot. To avoid that oops from a quick > apply and push. The safety catch. > > I'm not opposed, but this is the reason. Yeah, I think with all the new committer the common use-case has shifted a bit, where applying to the current branch is a reasonable thing to do. Also, worktrees help a bunch with that too. If it causes more troubles than it helps we can always go back to forcing explicit branch names. > One comment below. > > BR, > Jani. > > > > > > v2: use git symbolic-ref to find current branch (Daniel Vetter) > > > > Signed-off-by: Thierry Reding <treding@nvidia.com> > > --- > > dim | 18 ++++++++++++++++++ > > dim.rst | 8 ++++++++ > > 2 files changed, 26 insertions(+) > > > > diff --git a/dim b/dim > > index c0cbe352b165..1422b35e2471 100755 > > --- a/dim > > +++ b/dim > > @@ -326,6 +326,11 @@ function git_fetch_helper # remote > > fi > > } > > > > +function git_current_branch > > +{ > > + git symbolic-ref -q --short HEAD > > +} > > + > > function git_is_current_branch # branch > > { > > git branch --list $1 | grep -q '\*' > > @@ -739,6 +744,11 @@ function dim_push_fixes > > dim_push_branch drm-intel-fixes "$@" > > } > > > > +function dim_push > > +{ > > + dim_push_branch $(git_current_branch) "$@" > > +} > > + > > # ensure we're on branch $1, and apply patches. the rest of the arguments are > > # passed to git am. > > dim_alias_ab=apply-branch > > @@ -930,6 +940,14 @@ function dim_apply_next_fixes > > dim_apply_branch drm-intel-next-fixes "$@" > > } > > > > +# apply patch to current branch, the rest of the arguments are passed to > > +# git am > > +dim_alias_am=apply > > +function dim_apply > > +{ > > + dim_apply_branch $(git_current_branch) "$@" > > +} > > + > > function commit_list_references > > { > > local commit remote log > > diff --git a/dim.rst b/dim.rst > > index c004c30ada17..fa9b587d73bb 100644 > > --- a/dim.rst > > +++ b/dim.rst > > @@ -198,6 +198,10 @@ apply-queued [*git am arguments*] > > **apply-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and > > *drm-intel-next-queued* branches respectively. > > > > +apply [*git am arguments*] > > +-------------------------- > > +**apply-branch** shorthand for the current branch. > > + > > extract-tags *branch* [*git-rangeish*] > > -------------------------------------- > > This extracts various tags (e.g. Reviewed-by:) from emails and applies them to the > > @@ -232,6 +236,10 @@ push-queued [*git push arguments*] > > **push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and > > *drm-intel-next-queued* branches respectively. > > > > +push [*git push arguments*] > > +--------------------------- > > +**push** shorthand for the current branch. > > I think you mean **push-branch** shorthand. I'll fix this while applying. -Daniel > > > + > > rebuild-tip > > ----------- > > Rebuild and push the integration tree. > > -- > Jani Nikula, Intel Open Source Technology Center > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff --git a/dim b/dim index c0cbe352b165..1422b35e2471 100755 --- a/dim +++ b/dim @@ -326,6 +326,11 @@ function git_fetch_helper # remote fi } +function git_current_branch +{ + git symbolic-ref -q --short HEAD +} + function git_is_current_branch # branch { git branch --list $1 | grep -q '\*' @@ -739,6 +744,11 @@ function dim_push_fixes dim_push_branch drm-intel-fixes "$@" } +function dim_push +{ + dim_push_branch $(git_current_branch) "$@" +} + # ensure we're on branch $1, and apply patches. the rest of the arguments are # passed to git am. dim_alias_ab=apply-branch @@ -930,6 +940,14 @@ function dim_apply_next_fixes dim_apply_branch drm-intel-next-fixes "$@" } +# apply patch to current branch, the rest of the arguments are passed to +# git am +dim_alias_am=apply +function dim_apply +{ + dim_apply_branch $(git_current_branch) "$@" +} + function commit_list_references { local commit remote log diff --git a/dim.rst b/dim.rst index c004c30ada17..fa9b587d73bb 100644 --- a/dim.rst +++ b/dim.rst @@ -198,6 +198,10 @@ apply-queued [*git am arguments*] **apply-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and *drm-intel-next-queued* branches respectively. +apply [*git am arguments*] +-------------------------- +**apply-branch** shorthand for the current branch. + extract-tags *branch* [*git-rangeish*] -------------------------------------- This extracts various tags (e.g. Reviewed-by:) from emails and applies them to the @@ -232,6 +236,10 @@ push-queued [*git push arguments*] **push-branch** shorthands for *drm-intel-fixes*, *drm-intel-next-fixes*, and *drm-intel-next-queued* branches respectively. +push [*git push arguments*] +--------------------------- +**push** shorthand for the current branch. + rebuild-tip ----------- Rebuild and push the integration tree.