commit - e27a7222faaa171dcb086ea0b566dc7bebb74a0b
commit + 7ef28ff8dd61cbf38f88784ea8c11e373757985f
blob - 892916e7b1e35425bc8bd687190937dfbe0c047c
blob + 6aaab256399b6996c57b843dcf33ab27058b640b
--- got/got.c
+++ got/got.c
struct blame_cb_args {
struct blame_line *lines;
int nlines;
+ int nlines_prec;
int lineno_cur;
off_t *line_offsets;
FILE *f;
nl = strchr(line, '\n');
if (nl)
*nl = '\0';
- printf("%.8s %s\n", bline->id_str, line);
+ printf("%.*d) %.8s %s\n", a->nlines_prec, a->lineno_cur,
+ bline->id_str, line);
a->lineno_cur++;
bline = &a->lines[a->lineno_cur - 1];
}
error = got_object_blob_dump_to_file(NULL, &bca.nlines,
&bca.line_offsets, bca.f, blob);
- if (error)
+ if (error || bca.nlines == 0)
goto done;
bca.lines = calloc(bca.nlines, sizeof(*bca.lines));
bca.lineno_cur = 1;
+ bca.nlines_prec = 0;
+ i = bca.nlines;
+ while (i > 0) {
+ i /= 10;
+ bca.nlines_prec++;
+ }
+
error = got_blame_incremental(in_repo_path, commit_id, repo,
blame_cb, &bca);
if (error)
blob - bd295cf08b277cac199f4c1fc887139d66aecd2f
blob + b3f34a68bb9a7524660dc7ba0f73911918e96c8b
--- regress/cmdline/blame.sh
+++ regress/cmdline/blame.sh
local short_commit2=`trim_obj_id 32 $commit2`
local short_commit3=`trim_obj_id 32 $commit3`
- echo "$short_commit1 1" > $testroot/stdout.expected
- echo "$short_commit2 2" >> $testroot/stdout.expected
- echo "$short_commit3 3" >> $testroot/stdout.expected
+ echo "1) $short_commit1 1" > $testroot/stdout.expected
+ echo "2) $short_commit2 2" >> $testroot/stdout.expected
+ echo "3) $short_commit3 3" >> $testroot/stdout.expected
cmp -s $testroot/stdout.expected $testroot/stdout
ret="$?"
local short_commit1=`trim_obj_id 32 $commit1`
local short_commit2=`trim_obj_id 32 $commit2`
- echo "$short_commit1 1" > $testroot/stdout.expected
- echo "$short_commit2 2" >> $testroot/stdout.expected
+ echo "1) $short_commit1 1" > $testroot/stdout.expected
+ echo "2) $short_commit2 2" >> $testroot/stdout.expected
cmp -s $testroot/stdout.expected $testroot/stdout
ret="$?"
local short_commit1=`trim_obj_id 32 $commit1`
- echo "$short_commit1 1" > $testroot/stdout.expected
+ echo "1) $short_commit1 1" > $testroot/stdout.expected
cmp -s $testroot/stdout.expected $testroot/stdout
ret="$?"
local short_commit1=`trim_obj_id 32 $commit1`
- echo "$short_commit1 1" > $testroot/stdout.expected
+ echo "1) $short_commit1 1" > $testroot/stdout.expected
cmp -s $testroot/stdout.expected $testroot/stdout
ret="$?"