git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git mailing list <git@vger.kernel.org>
Subject: [PATCH v2 0/3] rebase: give precise error message
Date: Mon, 27 Nov 2017 22:51:01 +0530	[thread overview]
Message-ID: <20171127172104.5796-1-kaartic.sivaraam@gmail.com> (raw)
In-Reply-To: <xmqq60a3xdpw.fsf@gitster.mtv.corp.google.com>

Junio C Hamano <gitster@pobox.com> writes:
> Perhaps time to learn "git symbolic-ref HEAD" and use it instead of
> depending on the name?

Good point. Helped remove the assumption that there's no branch named HEAD.
(and indirectly led to 2 additional patches and the 3 questions found below ;-)


This started as a small fix to make 'git rebase' give a precise
error message when a rebase was done with a detached HEAD. Now it
includes a few cleanups that I caught while analysing the code.

There were a few weird observations when I was anlaysing the code.
They are listed below. Please give your thoughts about them.

The commands I use below were run on my local clone of 'git' and 'origin'
in this context refers to the git mirror at GitHub.

1. "git rebase <upstream> <remote_branch>" does nothing

I tried to play around with rebase by trying out various combinations while
analysing and found the following to have not effect even though the output
doesn't say anything about that,

$ git rebase origin/next origin/maint 
First, rewinding head to replay your work on top of it...
Fast-forwarded origin/maint to origin/next.

IOW, updating a remote branch with a remote upstream had no effect.
Though trying to update a remote branch with a remote upstream doesn't
seem to be very meaningful, the output says it HAS updated the remote
which seems to be misleading. What should be done about this?

2. It's possible to do "git rebase <upstream> <commit>"

$ git origin/next f926f18f3dda0c52e794b2de0911f1b046c7dadf"

This checks out the commit(detaches HEAD) tries to rebase origin/next
from there.

This behaviour doesn't seems to be documented. It says that only a 'branch'
can be specified. (The error message updated in 1/3 previously reported that
the 'branch' name is invalid rather than stating the 'ref (branch/commit) is
invlid')

 git rebase [...] [<upstream> [<branch>]]
 git rebase [...] --root [<branch>]
 ...

Shouldn't it have said that we can give any <ref> apart from <branch> instead of
saying we could give only a <branch>. If intentional, why?

3. "git rebase <upstream> <commit>" shows misleading message

$ git origin/next f926f18f3dda0c52e794b2de0911f1b046c7dadf"
Current branch f926f18f3dda0c52e794b2de0911f1b046c7dadf is up to date.

As it's clear the commit is not a branch. What should be done to fix this?


Kaartic Sivaraam (3):
  rebase: use a more appropriate variable name
  rebase: distinguish user input by quoting it
  rebase: rebasing can also be done when HEAD is detached

 git-rebase.sh | 46 +++++++++++++++++++++++++++++++---------------
 1 file changed, 31 insertions(+), 15 deletions(-)

-- 
2.15.0.345.gf926f18f3


  reply	other threads:[~2017-11-27 17:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-21 15:25 [PATCH] rebase: rebasing can also be done when HEAD is detached Kaartic Sivaraam
2017-11-22  2:13 ` Junio C Hamano
2017-11-27 17:21   ` Kaartic Sivaraam [this message]
2017-11-27 17:21     ` [PATCH v2 1/3] rebase: use a more appropriate variable name Kaartic Sivaraam
2017-11-27 17:21     ` [PATCH v2 2/3] rebase: distinguish user input by quoting it Kaartic Sivaraam
2017-11-27 17:21     ` [PATCH v2 3/3] rebase: rebasing can also be done when HEAD is detached Kaartic Sivaraam
2017-11-28  2:31       ` Junio C Hamano
2017-11-28 16:15         ` Kaartic Sivaraam
2017-12-01  6:09         ` [PATCH v3 " Kaartic Sivaraam
2017-11-28  2:25     ` [PATCH v2 0/3] rebase: give precise error message Junio C Hamano
2017-11-28 14:04       ` Kaartic Sivaraam
2017-11-29  0:10         ` Junio C Hamano
2017-11-29  3:11           ` Kaartic Sivaraam
2017-11-29  6:47             ` Junio C Hamano
2017-12-16  9:03     ` [PATCH v5 0/3] rebase: give precise error messages Kaartic Sivaraam
2017-12-16  9:03       ` [PATCH v5 1/3] rebase: consistently use branch_name variable Kaartic Sivaraam
2017-12-16  9:03       ` [PATCH v5 2/3] rebase: distinguish user input by quoting it Kaartic Sivaraam
2017-12-16  9:03       ` [PATCH v5 3/3] rebase: rebasing can also be done when HEAD is detached Kaartic Sivaraam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171127172104.5796-1-kaartic.sivaraam@gmail.com \
    --to=kaartic.sivaraam@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).