aboutsummaryrefslogtreecommitdiff
path: root/builtin-rev-list.c
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2009-03-30 06:59:59 +0200
committerJunio C Hamano <gitster@pobox.com>2009-04-05 01:29:45 -0700
commite89aa6d2f546b2d4f2d88c15ce7e343751d6922f (patch)
treef387a8765ef8469baf6e047ca856bd428d20ff4f /builtin-rev-list.c
parent37c4c38d7356bf256d0297fdbac78ef8b6807fac (diff)
downloadgit-e89aa6d2f546b2d4f2d88c15ce7e343751d6922f.tar.gz
git-e89aa6d2f546b2d4f2d88c15ce7e343751d6922f.tar.xz
bisect--helper: string output variables together with "&&"
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>
Diffstat (limited to 'builtin-rev-list.c')
-rw-r--r--builtin-rev-list.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index 69dca631d..eb341477c 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -226,20 +226,20 @@ static int estimate_bisect_steps(int all)
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))
@@ -269,13 +269,22 @@ int show_bisect_vars(struct rev_info *revs, int reaches, int all, int flags)
}
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,