All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Pranit Bauva <pranit.bauva@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Christian Couder <christian.couder@gmail.com>,
	Christian Couder <chriscool@tuxfamily.org>,
	Lars Schneider <larsxschneider@gmail.com>
Subject: Re: [PATCH 1/2] bisect--helper: `bisect_log` shell function in C
Date: Mon, 16 May 2016 03:36:42 -0400	[thread overview]
Message-ID: <CAPig+cTfZ1hWXZcx5OLNRRqJ7FkTigizpMB9E1xzv1Tv+8YY2w@mail.gmail.com> (raw)
In-Reply-To: <1463169737-12701-1-git-send-email-pranit.bauva@gmail.com>

On Fri, May 13, 2016 at 4:02 PM, Pranit Bauva <pranit.bauva@gmail.com> wrote:
> bisect--helper: `bisect_log` shell function in C

Do you need to insert "rewrite" or "reimplement" in the subject?

> Reimplement the `bisect_log` shell function in C and add a
> `--bisect-log` subcommand to `git bisect--helper` to call it from
> git-bisect.sh .
>
> Using `--bisect-log` subcommand is a temporary measure to port shell
> function to C so as to use the existing test suite. As more functions
> are ported, this subcommand will be retired and will be called by some
> other method.
>
> Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
> ---
> diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
> @@ -79,11 +80,26 @@ int write_terms(const char *bad, const char *good)
> +int bisect_log(void)

s/^/static/

> +{
> +       struct strbuf buf = STRBUF_INIT;
> +
> +       if (strbuf_read_file(&buf, ".git/BISECT_LOG", 256) < 0)

As mentioned in my review of the "write-terms" rewrite, hardcoding
".git/" here is wrong for a variety of reasons. See get_git_dir(),
get_git_common_dir(), etc. in cache.h instead.

> +               return error(_("We are not bisecting."));
> +
> +       printf("%s", buf.buf);
> +       strbuf_release(&buf);
> +
> +       return 0;
> +}
> +
>  int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
>  {
> @@ -109,6 +127,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
>                 if (argc != 2)
>                         die(_("--write-terms requires two arguments"));
>                 return write_terms(argv[0], argv[1]);
> +       case BISECT_LOG:

Shouldn't you be die()ing here with an appropriate error message if
argc is not 0?

> +               return bisect_log();
>         default:
>                 die("BUG: unknown subcommand '%d'", cmdmode);
>         }

  parent reply	other threads:[~2016-05-16  7:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-13 20:02 [PATCH 1/2] bisect--helper: `bisect_log` shell function in C Pranit Bauva
2016-05-13 20:02 ` [PATCH 2/2] bisect--helper: `bisect_voc` " Pranit Bauva
2016-05-13 20:07   ` Pranit Bauva
2016-05-16  6:40   ` Johannes Schindelin
2016-05-20  7:23     ` Pranit Bauva
2016-05-22 19:49       ` Pranit Bauva
2016-05-23 11:09       ` Johannes Schindelin
2016-05-16  7:49   ` Matthieu Moy
2016-05-16  7:36 ` Eric Sunshine [this message]
2016-05-20  7:28   ` [PATCH 1/2] bisect--helper: `bisect_log` " Pranit Bauva

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=CAPig+cTfZ1hWXZcx5OLNRRqJ7FkTigizpMB9E1xzv1Tv+8YY2w@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=chriscool@tuxfamily.org \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=larsxschneider@gmail.com \
    --cc=pranit.bauva@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.