git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] rebase -i: fix has_action

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 5, 2011, 16:59 UTC
Message-ID
<7v62mb4wwd.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAGdFq_j2wRw-gB109VypZkG1u=fm7yynkn2-Gu8AzNpVOrun8w@mail.gmail.com>
Sverre Rabbelier <srabbelier@gmail.com> writes:
Show 14 quoted lines
> Heya,
>
> On Thu, Aug 4, 2011 at 21:34, Junio C Hamano <gitster@pobox.com> wrote:
>>        has_action () {
>>          test -s "$1"
>>        }
>
>>        has_action () {
>>          sane_grep -v -e '^#' -e '^[   ]*$' "$1" >/dev/null
>>        }
>
> I think the former more correctly checks what the function name
> implies, is there any downside to that which makes you suggest this
> second approach?

I vaguely recall the original reason we didn't do the most straightforward thing was something like what J6t said already.

As we are not interested in _adding_ new feature, I would say that, strictly speaking, this *should* become a two-patch series whose first one uses

	sane_grep -v -e '^#' -e '^$' "$1" >/dev/null

that is, "do we have anything aside from comments and blanks?", which is the original semantics, with Noe's "safety" change as the second patch in the series that uses

	sane_grep -v -e '^#' -e '^[	 ]*$' "$1" >/dev/null

to say "let's count a line that solely consists of whitespaces also as a blank".

But of course in practice it can and should be just a single patch that squashes these two "conceptually separate" steps.

Previous: Johannes SixtNext: Andrew Wong
Message 6 of 9 in “rebase -i: fix has_action”
  1. rebase -i: fix has_actionNoe Rubinstein, Aug 4, 2011
  2. Sverre RabbelierAug 4, 2011
  3. Junio C HamanoAug 4, 2011
  4. Sverre RabbelierAug 5, 2011
  5. Johannes SixtAug 5, 2011
  6. Junio C HamanoAug 5, 2011
  7. Andrew WongAug 5, 2011
  8. Junio C HamanoAug 5, 2011
  9. What you can throw (on a Friday)Steffen Daode Nurpmeso, Aug 5, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.