From: Junio C Hamano Date: Wed, 17 Nov 2010 22:59:33 +0000 (-0800) Subject: Merge branch 'jk/maint-rev-list-nul' X-Git-Tag: v1.7.4-rc0~143 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/07e0a8314d69986d368b08f8b602ac573fa7d9b6?ds=sidebyside;hp=-c Merge branch 'jk/maint-rev-list-nul' * jk/maint-rev-list-nul: rev-list: handle %x00 NUL in user format --- 07e0a8314d69986d368b08f8b602ac573fa7d9b6 diff --combined builtin/rev-list.c index 158ce1111a,3b2dca0809..ba27d39f97 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@@ -11,9 -11,9 +11,9 @@@ static const char rev_list_usage[] = "git rev-list [OPTION] ... [ -- paths... ]\n" " limiting output:\n" -" --max-count=nr\n" -" --max-age=epoch\n" -" --min-age=epoch\n" +" --max-count=\n" +" --max-age=\n" +" --min-age=\n" " --sparse\n" " --no-merges\n" " --remove-empty\n" @@@ -33,7 -33,7 +33,7 @@@ " --objects | --objects-edge\n" " --unpacked\n" " --header | --pretty\n" -" --abbrev=nr | --no-abbrev\n" +" --abbrev= | --no-abbrev\n" " --abbrev-commit\n" " --left-right\n" " special purpose:\n" @@@ -147,8 -147,10 +147,10 @@@ static void show_commit(struct commit * } } else { if (revs->commit_format != CMIT_FMT_USERFORMAT || - buf.len) - printf("%s%c", buf.buf, info->hdr_termination); + buf.len) { + fwrite(buf.buf, 1, buf.len, stdout); + putchar(info->hdr_termination); + } } strbuf_release(&buf); } else { diff --combined t/test-lib.sh index 2af8f10c83,25f8bf95cd..bbe79e0fcb --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -248,6 -248,10 +248,10 @@@ test_decode_color () -e 's/.\[m//g' } + nul_to_q () { + perl -pe 'y/\000/Q/' + } + q_to_nul () { perl -pe 'y/Q/\000/' } @@@ -970,13 -974,11 +974,13 @@@ case $(uname -s) i # no POSIX permissions # backslashes in pathspec are converted to '/' # exec does not inherit the PID + test_set_prereq MINGW ;; *) test_set_prereq POSIXPERM test_set_prereq BSLASHPSPEC test_set_prereq EXECKEEPSPID + test_set_prereq NOT_MINGW ;; esac