summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 37c4c38)
raw | patch | inline | side by side (parent: 37c4c38)
author | Christian Couder <chriscool@tuxfamily.org> | |
Mon, 30 Mar 2009 04:59:59 +0000 (06:59 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 5 Apr 2009 08:29:45 +0000 (01:29 -0700) |
When doing:
eval "git bisect--helper --next-vars" | {
while read line
do
echo "$line &&"
done
echo ':'
}
the result code comes from the last "echo ':'", not from running
"git bisect--helper --next-vars".
This patch gets rid of the need to string together the line from
the output of "git bisect--helper" with "&&" in the calling script
by making "git bisect--helper --next-vars" return output variables
already in that format.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
eval "git bisect--helper --next-vars" | {
while read line
do
echo "$line &&"
done
echo ':'
}
the result code comes from the last "echo ':'", not from running
"git bisect--helper --next-vars".
This patch gets rid of the need to string together the line from
the output of "git bisect--helper" with "&&" in the calling script
by making "git bisect--helper --next-vars" return output variables
already in that format.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c | patch | blob | history | |
bisect.h | patch | blob | history | |
builtin-rev-list.c | patch | blob | history | |
git-bisect.sh | patch | blob | history |
diff --git a/bisect.c b/bisect.c
index 285bf146c13c8be387c7254ec756c0a78c89239e..69f8860ca1ac54ed4bc135017bce8e3ab6d9cbe2 100644 (file)
--- a/bisect.c
+++ b/bisect.c
revs.commits = find_bisection(revs.commits, &reaches, &all,
!!skipped_sha1_nr);
- return show_bisect_vars(&revs, reaches, all, BISECT_SHOW_TRIED);
+ return show_bisect_vars(&revs, reaches, all,
+ BISECT_SHOW_TRIED | BISECT_SHOW_STRINGED);
}
diff --git a/bisect.h b/bisect.h
index b9aa88482eea7b797d978b58b99aba9a4f059ccc..f5d106735c41f9657b5d568ae3453386c9a64c08 100644 (file)
--- a/bisect.h
+++ b/bisect.h
/* show_bisect_vars flags */
#define BISECT_SHOW_ALL (1<<0)
#define BISECT_SHOW_TRIED (1<<1)
+#define BISECT_SHOW_STRINGED (1<<2)
/*
* The flag BISECT_SHOW_ALL should not be set if this function is called
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 69dca631d9fe2480af544acfb3a2b1880dedb934..eb341477caa47ff11f969761d4a528444453a6ae 100644 (file)
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
return (e < 3 * x) ? n : n - 1;
}
-static void show_tried_revs(struct commit_list *tried)
+static void show_tried_revs(struct commit_list *tried, int stringed)
{
printf("bisect_tried='");
for (;tried; tried = tried->next) {
char *format = tried->next ? "%s|" : "%s";
printf(format, sha1_to_hex(tried->item->object.sha1));
}
- printf("'\n");
+ printf(stringed ? "' &&\n" : "'\n");
}
int show_bisect_vars(struct rev_info *revs, int reaches, int all, int flags)
{
int cnt;
- char hex[41] = "";
+ char hex[41] = "", *format;
struct commit_list *tried;
if (!revs->commits && !(flags & BISECT_SHOW_TRIED))
}
if (flags & BISECT_SHOW_TRIED)
- show_tried_revs(tried);
- printf("bisect_rev=%s\n"
- "bisect_nr=%d\n"
- "bisect_good=%d\n"
- "bisect_bad=%d\n"
- "bisect_all=%d\n"
- "bisect_steps=%d\n",
+ show_tried_revs(tried, flags & BISECT_SHOW_STRINGED);
+ format = (flags & BISECT_SHOW_STRINGED) ?
+ "bisect_rev=%s &&\n"
+ "bisect_nr=%d &&\n"
+ "bisect_good=%d &&\n"
+ "bisect_bad=%d &&\n"
+ "bisect_all=%d &&\n"
+ "bisect_steps=%d\n"
+ :
+ "bisect_rev=%s\n"
+ "bisect_nr=%d\n"
+ "bisect_good=%d\n"
+ "bisect_bad=%d\n"
+ "bisect_all=%d\n"
+ "bisect_steps=%d\n";
+ printf(format,
hex,
cnt - 1,
all - reaches - 1,
diff --git a/git-bisect.sh b/git-bisect.sh
index 0f7590dfc2294d93b774f2ba4eed84d3e776625f..5074dda45164791a5273dc0b94ea2037922aee87 100755 (executable)
--- a/git-bisect.sh
+++ b/git-bisect.sh
bisect_next_check && bisect_next || :
}
-eval_and_string_together() {
- _eval="$1"
-
- eval "$_eval" | {
- while read line
- do
- echo "$line &&"
- done
- echo ':'
- }
-}
-
exit_if_skipped_commits () {
_tried=$1
_bad=$2
test "$?" -eq "1" && return
# Get bisection information
- eval="git bisect--helper --next-vars" &&
- eval=$(eval_and_string_together "$eval") &&
+ eval=$(eval "git bisect--helper --next-vars") &&
eval "$eval" || exit
if [ -z "$bisect_rev" ]; then