diff mbox

[2/2] dim: really make the branch argument for dim retip optional

Message ID 20170321125824.14641-2-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter March 21, 2017, 12:58 p.m. UTC
Some didn't work, at least here.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 dim | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Jani Nikula March 21, 2017, 2:13 p.m. UTC | #1
On Tue, 21 Mar 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Some didn't work, at least here.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  dim | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/dim b/dim
> index e0c1909653b6..d7dcea625702 100755
> --- a/dim
> +++ b/dim
> @@ -388,7 +388,13 @@ function dim_retip
>  	local branch upstream remote
>  
>  	branch="$1"
> -	shift
> +
> +	if [ -n "$branch" ] ; then
> +		shift
> +	else
> +		branch=$(git symbolic-ref --short HEAD)
> +	fi

I guess this happens with worktrees? Ack if it works for you.

BR,
Jani.

> +
>  	remote=$(url_to_remote $drm_tip_ssh)
>  	upstream=$(git_find_tip "$branch")
Daniel Vetter March 21, 2017, 3:27 p.m. UTC | #2
On Tue, Mar 21, 2017 at 04:13:45PM +0200, Jani Nikula wrote:
> On Tue, 21 Mar 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > Some didn't work, at least here.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> >  dim | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/dim b/dim
> > index e0c1909653b6..d7dcea625702 100755
> > --- a/dim
> > +++ b/dim
> > @@ -388,7 +388,13 @@ function dim_retip
> >  	local branch upstream remote
> >  
> >  	branch="$1"
> > -	shift
> > +
> > +	if [ -n "$branch" ] ; then
> > +		shift
> > +	else
> > +		branch=$(git symbolic-ref --short HEAD)
> > +	fi
> 
> I guess this happens with worktrees? Ack if it works for you.

Nah, "dim retip" alone fails. The shift doesn't have anything to shift and
the cmd fails silently. This isn't on a worktree or anything, it's all
in the main checkout.
-Daniel
Jani Nikula March 22, 2017, 8:42 a.m. UTC | #3
On Tue, 21 Mar 2017, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Tue, Mar 21, 2017 at 04:13:45PM +0200, Jani Nikula wrote:
>> On Tue, 21 Mar 2017, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>> > Some didn't work, at least here.
>> >
>> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>> > ---
>> >  dim | 8 +++++++-
>> >  1 file changed, 7 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/dim b/dim
>> > index e0c1909653b6..d7dcea625702 100755
>> > --- a/dim
>> > +++ b/dim
>> > @@ -388,7 +388,13 @@ function dim_retip
>> >  	local branch upstream remote
>> >  
>> >  	branch="$1"
>> > -	shift
>> > +
>> > +	if [ -n "$branch" ] ; then
>> > +		shift
>> > +	else
>> > +		branch=$(git symbolic-ref --short HEAD)
>> > +	fi
>> 
>> I guess this happens with worktrees? Ack if it works for you.
>
> Nah, "dim retip" alone fails. The shift doesn't have anything to shift and
> the cmd fails silently. This isn't on a worktree or anything, it's all
> in the main checkout.

Right. I suck. *facepalm*.

J.
diff mbox

Patch

diff --git a/dim b/dim
index e0c1909653b6..d7dcea625702 100755
--- a/dim
+++ b/dim
@@ -388,7 +388,13 @@  function dim_retip
 	local branch upstream remote
 
 	branch="$1"
-	shift
+
+	if [ -n "$branch" ] ; then
+		shift
+	else
+		branch=$(git symbolic-ref --short HEAD)
+	fi
+
 	remote=$(url_to_remote $drm_tip_ssh)
 	upstream=$(git_find_tip "$branch")