From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
John Tapsell <johnflux@gmail.com>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: [PATCH 8/7] rev-list: make "--bisect-skip" read skipped revisions from stdin
Date: Fri, 13 Mar 2009 06:29:46 +0100 [thread overview]
Message-ID: <20090313062946.440e2ed7.chriscool@tuxfamily.org> (raw)
Previously, skipped revisions should be passed like this:
$ git rev-list --bisect-skip=<rev1>,<rev2>,<rev3> ...
but there could be problems on systems where there is a tight limit
on command line lenght.
As the "--bisect-skip" option will be mostly used by porcelain
commands, and as the current "git-bisect.sh" porcelain does not use
stdin to pass good or bad revisions, it is acceptable to have
"--bisect-skip" now read skipped commits from stdin.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
bisect-skip.c | 19 +++++++++++++++++--
bisect.h | 2 +-
builtin-rev-list.c | 11 ++++++++---
git-bisect.sh | 4 ++--
4 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/bisect-skip.c b/bisect-skip.c
index 789ee09..079e787 100644
--- a/bisect-skip.c
+++ b/bisect-skip.c
@@ -7,7 +7,8 @@ static unsigned char (*skipped_sha1)[20];
static int skipped_sha1_nr;
static int skipped_sha1_alloc;
-void register_skipped(const char *skipped)
+
+static void register_skipped(const char *skipped)
{
struct strbuf sb, **list, **it, *cur;
int len = strlen(skipped);
@@ -15,7 +16,7 @@ void register_skipped(const char *skipped)
strbuf_init(&sb, len);
strbuf_add(&sb, skipped, len);
- list = strbuf_split(&sb, ',', 0);
+ list = strbuf_split(&sb, ' ', 0);
for (it = list; (cur = *it); it++) {
ALLOC_GROW(skipped_sha1, skipped_sha1_nr + 1,
@@ -28,6 +29,20 @@ void register_skipped(const char *skipped)
strbuf_release(&sb);
}
+void read_skipped_revisions_from_stdin(void)
+{
+ char line[1000];
+
+ while (fgets(line, sizeof(line), stdin) != NULL) {
+ int len = strlen(line);
+ if (len && line[len - 1] == '\n')
+ line[--len] = '\0';
+ if (!len)
+ break;
+ register_skipped(line);
+ }
+}
+
int skipped_nr(void)
{
return skipped_sha1_nr;
diff --git a/bisect.h b/bisect.h
index ff9c781..c41b568 100644
--- a/bisect.h
+++ b/bisect.h
@@ -1,7 +1,7 @@
#ifndef BISECT_H
#define BISECT_H
-void register_skipped(const char *skipped);
+void read_skipped_revisions_from_stdin(void);
int skipped_nr(void);
struct commit_list *filter_skipped(struct commit_list *list,
struct commit_list **tried,
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 4af70d7..bf16197 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -334,16 +334,21 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
bisect_show_vars = 1;
continue;
}
- if (!prefixcmp(arg, "--bisect-skip=")) {
+ if (!prefixcmp(arg, "--bisect-skip")) {
bisect_list = 1;
bisect_show_vars = 1;
- bisect_skip = 1;
- register_skipped(arg + 14);
+ if (bisect_skip++)
+ die("--bisect-skip given twice?");
+ if (read_from_stdin)
+ die("--bisect-skip cannot work with --stdin");
+ read_skipped_revisions_from_stdin();
continue;
}
if (!strcmp(arg, "--stdin")) {
if (read_from_stdin++)
die("--stdin given twice?");
+ if (bisect_skip)
+ die("--stdin cannot work with --bisect-skip");
read_revisions_from_stdin(&revs);
continue;
}
diff --git a/git-bisect.sh b/git-bisect.sh
index 31e7cff..da3c077 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -429,8 +429,8 @@ bisect_next() {
test "$?" -eq "1" && return
# Get bisection information
- skip=$(echo $skip | tr ' ' ',')
- eval="git rev-list --bisect-skip=$skip $good $bad --" &&
+ eval="echo $skip | tr ' ' '\012'" &&
+ eval="$eval | git rev-list --bisect-skip $good $bad --" &&
eval="$eval $(cat "$GIT_DIR/BISECT_NAMES")" &&
eval=$(eval_and_string_together "$eval") &&
eval "$eval" || exit
--
1.6.2.84.gcd0b4.dirty
reply other threads:[~2009-03-13 5:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20090313062946.440e2ed7.chriscool@tuxfamily.org \
--to=chriscool@tuxfamily.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johnflux@gmail.com \
--cc=mingo@elte.hu \
/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