From: "Omar Polo" Subject: Re: got diff vs file names with whitespaces To: Stefan Sperling Cc: gameoftrees@openbsd.org Date: Fri, 06 Nov 2026 13:00:51 +0100 Stefan Sperling wrote: > On Thu, Nov 05, 2026 at 09:56:20PM +0100, Omar Polo wrote: > > @@ -252,8 +253,9 @@ output_unidiff_chunk(struct diff_output_info *outinfo, > > } > > > > if (print_header && !(state->header_printed)) { > > - rc = fprintf(dest, "--- %s\n", > > - diff_output_get_label_left(info)); > > + label = diff_output_get_label_left(info); > > + rc = fprintf(dest, "--- %s%s\n", label, > > + strchr(label, ' ') != NULL ? "\t" : ""); > > 'svn diff' always writes a tab here, no matter what the pathname contains. > I suspect we could do the same? done =) what i was very close to forget is that we need to commit the diff part before in diff.git and then sync it, right? diff /home/op/w/got path + /home/op/w/got commit - fe66becbbe242300f7a2a5b9233dac96584839f004b922e11e6697ce705ed37f blob - fdfb062cfddc34893c731ea1265005e08393962bf15d34e260dd5f55be7d3c49 file + lib/diff_output_unidiff.c --- lib/diff_output_unidiff.c +++ lib/diff_output_unidiff.c @@ -252,7 +252,7 @@ output_unidiff_chunk(struct diff_output_info *outinfo, } if (print_header && !(state->header_printed)) { - rc = fprintf(dest, "--- %s\n", + rc = fprintf(dest, "--- %s\t\n", diff_output_get_label_left(info)); if (rc < 0) return errno; @@ -267,7 +267,7 @@ output_unidiff_chunk(struct diff_output_info *outinfo, return ENOMEM; *typep = DIFF_LINE_MINUS; } - rc = fprintf(dest, "+++ %s\n", + rc = fprintf(dest, "+++ %s\t\n", diff_output_get_label_right(info)); if (rc < 0) return errno; commit - fe66becbbe242300f7a2a5b9233dac96584839f004b922e11e6697ce705ed37f blob - da1f8cb88d39bff4014913b32ab25bfd944c3232b5e508a6ad4278747ca1eec8 file + regress/cmdline/blame.sh --- regress/cmdline/blame.sh +++ regress/cmdline/blame.sh @@ -580,8 +580,8 @@ EOF diff 63581804340e880bf611c6a4a59eda26c503799f 84451b3ef755f3226d0d79af367632e5f3a830e7 blob - b53ca469a18871cc2f6af334dab25028599c6488 blob + c787aadf05e2afab61bd34976f7349912252e6da ---- got_blame.h -+++ got_blame.h +--- got_blame.h$(printf '\t') ++++ got_blame.h$(printf '\t') @@ -14,5 +14,22 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ @@ -613,8 +613,8 @@ EOF diff 75b7a700d9d14ef8eb902961255212acbedef164 d68a0a7de13af722c55099582019c03240e13320 blob - c787aadf05e2afab61bd34976f7349912252e6da blob + 5255d076c915accf159940978b821d06803ff2f8 ---- got_blame.h -+++ got_blame.h +--- got_blame.h$(printf '\t') ++++ got_blame.h$(printf '\t') @@ -28,6 +28,15 @@ const struct got_error *got_blame(const char *, struct * The callback receives the provided void * argument, the total number * of lines of the annotated file, a line number, and the ID of the commit @@ -639,8 +639,8 @@ EOF diff 3f60a8ef49086101685260fcb829f578cdf6d320 3bf198ba335fa30c8d16efb5c8e496200ac99c05 blob - 5255d076c915accf159940978b821d06803ff2f8 blob + 39623c468e733ee08abb50eafe29202b2b0a04ef ---- got_blame.h -+++ got_blame.h +--- got_blame.h$(printf '\t') ++++ got_blame.h$(printf '\t') @@ -30,8 +30,8 @@ const struct got_error *got_blame(const char *, struct * which last changed this line. * @@ -660,8 +660,8 @@ EOF diff 28315671b93d195163b0468fcb3879e29b25759c e27a7222faaa171dcb086ea0b566dc7bebb74a0b blob - 39623c468e733ee08abb50eafe29202b2b0a04ef blob + 6075cadbd177e1802679c7353515bf4ceebb51d0 ---- got_blame.h -+++ got_blame.h +--- got_blame.h$(printf '\t') ++++ got_blame.h$(printf '\t') @@ -15,14 +15,7 @@ */ commit - fe66becbbe242300f7a2a5b9233dac96584839f004b922e11e6697ce705ed37f blob - 1d2fa7217f09745c242d8a780c73bfe12b322e7cf517f1ab91e7253d375ac8a5 file + regress/cmdline/cherrypick.sh --- regress/cmdline/cherrypick.sh +++ regress/cmdline/cherrypick.sh @@ -1363,8 +1363,8 @@ EOF fi cat > $testroot/diff.expected <> $testroot/stdout.expected got tree -r $testroot/repo -c $commit2 -i gamma | grep 'delta$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected - echo '--- gamma/delta' >> $testroot/stdout.expected - echo '+++ gamma/delta' >> $testroot/stdout.expected + printf '--- gamma/delta\t\n' >> $testroot/stdout.expected + printf '+++ gamma/delta\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-delta' >> $testroot/stdout.expected echo '+modified delta' >> $testroot/stdout.expected @@ -604,8 +604,8 @@ test_commit_path_prefix() { | cut -d' ' -f 1 | sed -e 's/$/ (mode 644)/' \ >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- gamma/delta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- gamma/delta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-modified delta' >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected @@ -613,8 +613,8 @@ test_commit_path_prefix() { got tree -r $testroot/repo -c $commit3 -i gamma | grep 'new$' | \ cut -d' ' -f 1 | sed -e 's/$/ (mode 644)/' \ >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ gamma/new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ gamma/new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new' >> $testroot/stdout.expected commit - fe66becbbe242300f7a2a5b9233dac96584839f004b922e11e6697ce705ed37f blob - 09831aa5aa9e78af4b633c17418c853cdf8d7464779b6aa36870149d9fdbae56 file + regress/cmdline/common.sh --- regress/cmdline/common.sh +++ regress/cmdline/common.sh @@ -305,6 +305,7 @@ test_done() if [ -z "$GOT_TEST_QUIET" ]; then echo "ok" fi + return 0 elif echo "$result" | grep -q "^xfail"; then # expected test failure; test reproduces an unfixed bug echo "$result" @@ -312,6 +313,7 @@ test_done() else echo "test failed; leaving test data in $testroot" fi + exit 1 } test_memleak_done() commit - fe66becbbe242300f7a2a5b9233dac96584839f004b922e11e6697ce705ed37f blob - 8e5fd4d433d4814d5a29051bd8e3c80e7cc89c7c5faffc4bde943cf8e172ba5b file + regress/cmdline/diff.sh --- regress/cmdline/diff.sh +++ regress/cmdline/diff.sh @@ -40,8 +40,8 @@ test_diff_basic() { got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + alpha' >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected @@ -50,15 +50,15 @@ test_diff_basic() { got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + new (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected @@ -127,8 +127,8 @@ test_diff_basic() { got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + alpha' >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected @@ -137,8 +137,8 @@ test_diff_basic() { got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo "commit - $head_rev" >> $testroot/stdout.expected @@ -146,16 +146,16 @@ test_diff_basic() { got tree -r $testroot/repo -i epsilon | grep 'zeta$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + epsilon/zeta' >> $testroot/stdout.expected - echo '--- epsilon/zeta' >> $testroot/stdout.expected - echo '+++ epsilon/zeta' >> $testroot/stdout.expected + printf '--- epsilon/zeta\t\n' >> $testroot/stdout.expected + printf '+++ epsilon/zeta\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-zeta' >> $testroot/stdout.expected echo '+modified zeta' >> $testroot/stdout.expected echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + new (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected @@ -275,15 +275,15 @@ test_diff_basic() { echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + master (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ master' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ master\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+master' >> $testroot/stdout.expected echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + new (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected cmp -s $testroot/stdout.expected $testroot/stdout @@ -318,8 +318,8 @@ test_diff_basic() { echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + new (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected (cd $testroot/wt && got diff new > $testroot/stdout) @@ -372,8 +372,8 @@ test_diff_basic() { echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + new (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected cmp -s $testroot/stdout.expected $testroot/stdout @@ -408,8 +408,8 @@ test_diff_basic() { cat <$testroot/diff.expected blob - $alpha_blobid blob + $alpha_new_blobid ---- $alpha_blobid -+++ $alpha_new_blobid +--- $alpha_blobid$(printf '\t') ++++ $alpha_new_blobid$(printf '\t') @@ -1 +1 @@ -alpha +modified alpha @@ -427,6 +427,80 @@ EOF test_done "$testroot" "$ret" } +test_diff_filename_with_whitespaces() { + local testroot=`test_init diff_filename_with_whitespaces` + local head_rev=`git_show_head $testroot/repo` + + got checkout $testroot/repo $testroot/wt > /dev/null + ret=$? + if [ $ret -ne 0 ]; then + test_done "$testroot" "$ret" + return 1 + fi + + # add a file with whitespaces in its name + (cd "$testroot/wt" && echo iota > 'iota file' && \ + got add 'iota file') >/dev/null + ret=$? + if [ $ret -ne 0 ]; then + echo "failed to add iota file" >&2 + test_done "$testroot" "$ret" + return 1 + fi + + cat < $testroot/stdout.expected +diff $testroot/wt +path + $testroot/wt +commit - $head_rev +blob - /dev/null +file + iota file (mode 644) +--- /dev/null$(printf '\t') ++++ iota file$(printf '\t') +@@ -0,0 +1 @@ ++iota +EOF + + (cd $testroot/wt && got diff > $testroot/stdout) + cmp -s $testroot/stdout.expected $testroot/stdout + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + (cd $testroot/wt && got ci -m 'checkpoint') >/dev/null + + head_rev=`git_show_head $testroot/repo` + local iota_blobid=`get_blob_id $testroot/repo "" "iota file"` + + (cd $testroot/wt && echo 'new iota' > 'iota file') + + cat < $testroot/stdout.expected +diff $testroot/wt +path + $testroot/wt +commit - $head_rev +blob - $iota_blobid +file + iota file +--- iota file$(printf '\t') ++++ iota file$(printf '\t') +@@ -1 +1 @@ +-iota ++new iota +EOF + + (cd $testroot/wt && got diff > $testroot/stdout) + cmp -s $testroot/stdout.expected $testroot/stdout + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done "$testroot" "$ret" + return 1 + fi + + test_done "$testroot" 0 +} + test_diff_shows_conflict() { local testroot=`test_init diff_shows_conflict 1` @@ -487,8 +561,8 @@ test_diff_shows_conflict() { got tree -r $testroot/repo -i | grep 'numbers$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + numbers' >> $testroot/stdout.expected - echo '--- numbers' >> $testroot/stdout.expected - echo '+++ numbers' >> $testroot/stdout.expected + printf '--- numbers\t\n' >> $testroot/stdout.expected + printf '+++ numbers\t\n' >> $testroot/stdout.expected echo '@@ -1,8 +1,20 @@' >> $testroot/stdout.expected echo ' 1' >> $testroot/stdout.expected echo "+<<<<<<< merged change: commit $head_rev" \ @@ -553,8 +627,8 @@ test_diff_tag() { echo -n 'blob + ' >> $testroot/stdout.expected got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected @@ -576,8 +650,8 @@ test_diff_tag() { got tree -r $testroot/repo -i -c $commit_id2 | grep 'new$' | \ cut -d' ' -f 1 | tr -d '\n' >> $testroot/stdout.expected echo " (mode 644)" >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected @@ -618,8 +692,8 @@ test_diff_lightweight_tag() { echo -n 'blob + ' >> $testroot/stdout.expected got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected @@ -641,8 +715,8 @@ test_diff_lightweight_tag() { got tree -r $testroot/repo -i -c $commit_id2 | grep 'new$' | \ cut -d' ' -f 1 | tr -d '\n' >> $testroot/stdout.expected echo " (mode 644)" >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected @@ -757,8 +831,8 @@ test_diff_symlinks_in_work_tree() { grep 'alpha.link@ -> alpha$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected echo 'file + alpha.link' >> $testroot/stdout.expected - echo '--- alpha.link' >> $testroot/stdout.expected - echo '+++ alpha.link' >> $testroot/stdout.expected + printf '--- alpha.link\t\n' >> $testroot/stdout.expected + printf '+++ alpha.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -770,8 +844,8 @@ test_diff_symlinks_in_work_tree() { grep 'dotgotfoo.link@ -> .got/foo$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected echo 'file + dotgotfoo.link' >> $testroot/stdout.expected - echo '--- dotgotfoo.link' >> $testroot/stdout.expected - echo '+++ dotgotfoo.link' >> $testroot/stdout.expected + printf '--- dotgotfoo.link\t\n' >> $testroot/stdout.expected + printf '+++ dotgotfoo.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-.got/foo' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -783,8 +857,8 @@ test_diff_symlinks_in_work_tree() { grep 'beta.link@ -> ../beta$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected echo 'file + epsilon/beta.link' >> $testroot/stdout.expected - echo '--- epsilon/beta.link' >> $testroot/stdout.expected - echo '+++ epsilon/beta.link' >> $testroot/stdout.expected + printf '--- epsilon/beta.link\t\n' >> $testroot/stdout.expected + printf '+++ epsilon/beta.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-../beta' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -796,8 +870,8 @@ test_diff_symlinks_in_work_tree() { grep 'epsilon.link@ -> epsilon$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected echo 'file + epsilon.link' >> $testroot/stdout.expected - echo '--- epsilon.link' >> $testroot/stdout.expected - echo '+++ epsilon.link' >> $testroot/stdout.expected + printf '--- epsilon.link\t\n' >> $testroot/stdout.expected + printf '+++ epsilon.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-epsilon' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -809,16 +883,16 @@ test_diff_symlinks_in_work_tree() { grep 'nonexistent.link@ -> nonexistent$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected echo 'file + /dev/null' >> $testroot/stdout.expected - echo '--- nonexistent.link' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- nonexistent.link\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-nonexistent' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected echo "commit - $commit_id1" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + zeta.link (mode 120000)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ zeta.link' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ zeta.link\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+epsilon/zeta' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -867,8 +941,8 @@ test_diff_symlinks_in_repo() { got tree -r $testroot/repo -c $commit_id2 -i | \ grep 'alpha.link@ -> beta$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected - echo '--- alpha.link' >> $testroot/stdout.expected - echo '+++ alpha.link' >> $testroot/stdout.expected + printf '--- alpha.link\t\n' >> $testroot/stdout.expected + printf '+++ alpha.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -882,8 +956,8 @@ test_diff_symlinks_in_repo() { got tree -r $testroot/repo -c $commit_id2 -i | \ grep 'dotgotfoo.link@ -> .got/bar$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected - echo '--- dotgotfoo.link' >> $testroot/stdout.expected - echo '+++ dotgotfoo.link' >> $testroot/stdout.expected + printf '--- dotgotfoo.link\t\n' >> $testroot/stdout.expected + printf '+++ dotgotfoo.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-.got/foo' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -897,8 +971,8 @@ test_diff_symlinks_in_repo() { got tree -r $testroot/repo -c $commit_id2 -i epsilon | \ grep 'beta.link@ -> ../gamma/delta$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected - echo '--- epsilon/beta.link' >> $testroot/stdout.expected - echo '+++ epsilon/beta.link' >> $testroot/stdout.expected + printf '--- epsilon/beta.link\t\n' >> $testroot/stdout.expected + printf '+++ epsilon/beta.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-../beta' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -912,8 +986,8 @@ test_diff_symlinks_in_repo() { got tree -r $testroot/repo -c $commit_id2 -i | \ grep 'epsilon.link@ -> gamma$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected - echo '--- epsilon.link' >> $testroot/stdout.expected - echo '+++ epsilon.link' >> $testroot/stdout.expected + printf '--- epsilon.link\t\n' >> $testroot/stdout.expected + printf '+++ epsilon.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-epsilon' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -925,8 +999,8 @@ test_diff_symlinks_in_repo() { cut -d' ' -f 1 | sed -e 's/$/ (mode 120000)/' \ >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- nonexistent.link' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- nonexistent.link\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-nonexistent' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -936,8 +1010,8 @@ test_diff_symlinks_in_repo() { grep 'zeta.link@ -> epsilon/zeta$' | \ cut -d' ' -f 1 | sed -e 's/$/ (mode 120000)/' \ >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ zeta.link' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ zeta.link\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+epsilon/zeta' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -986,8 +1060,8 @@ test_diff_binary_files() { echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + foo (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ foo' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ foo\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected printf '+\377\377\0\0\377\377\0\0\n' >> $testroot/stdout.expected printf '\\ No newline at end of file\n' >> $testroot/stdout.expected @@ -1013,8 +1087,8 @@ test_diff_binary_files() { got tree -r $testroot/repo -i | grep 'foo$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + foo' >> $testroot/stdout.expected - echo '--- foo' >> $testroot/stdout.expected - echo '+++ foo' >> $testroot/stdout.expected + printf '--- foo\t\n' >> $testroot/stdout.expected + printf '+++ foo\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected printf -- '-\377\377\0\0\377\377\0\0\n' >> $testroot/stdout.expected printf '\\ No newline at end of file\n' >> $testroot/stdout.expected @@ -1058,21 +1132,21 @@ test_diff_commits() { echo "commit + $commit_id1" >> $testroot/stdout.expected echo "blob - $alpha_id0" >> $testroot/stdout.expected echo "blob + $alpha_id1" >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected @@ -1102,21 +1176,21 @@ test_diff_commits() { echo "commit + $commit_id1" >> $testroot/stdout.expected echo "blob - $alpha_id0" >> $testroot/stdout.expected echo "blob + $alpha_id1" >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected (cd $testroot/wt && got diff -c $commit_id0 -c $commit_id1 \ @@ -1135,8 +1209,8 @@ test_diff_commits() { echo "commit + $commit_id1" >> $testroot/stdout.expected echo "blob - $alpha_id0" >> $testroot/stdout.expected echo "blob + $alpha_id1" >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected @@ -1165,14 +1239,14 @@ test_diff_commits() { echo "commit + $commit_id1" >> $testroot/stdout.expected echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected (cd $testroot/repo && got diff -c $commit_id0 -c $commit_id1 \ @@ -1330,8 +1404,8 @@ test_diff_crlf() { printf 'one\r\ntwain\r\nthree\r\n' > $testroot/wt/crlf (cd $testroot/wt && got diff | sed -n '/^---/,$l' > $testroot/stdout) cat <<\EOF > $testroot/stdout.expected ---- crlf$ -+++ crlf$ +--- crlf\t$ ++++ crlf\t$ @@ -1,3 +1,3 @@$ one\r$ -two\r$ @@ -1379,8 +1453,8 @@ path + $testroot/wt commit - $commit_id blob - /dev/null file + xfile (mode 755) ---- /dev/null -+++ xfile +--- /dev/null$(printf '\t') ++++ xfile$(printf '\t') @@ -0,0 +1 @@ +xfile EOF @@ -1432,21 +1506,21 @@ EOF echo "commit + $commit_id1" >> $testroot/stdout.expected echo "blob - $alpha_id0" >> $testroot/stdout.expected echo "blob + $alpha_id1" >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected @@ -1486,21 +1560,21 @@ EOF echo "commit + $commit_id1" >> $testroot/stdout.expected echo "blob - $alpha_id0" >> $testroot/stdout.expected echo "blob + $alpha_id1" >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected (cd $testroot/wt && got diff -d -c $commit_id0 -c $commit_id1 \ @@ -1527,8 +1601,8 @@ EOF echo "commit + $commit_id1" >> $testroot/stdout.expected echo "blob - $alpha_id0" >> $testroot/stdout.expected echo "blob + $alpha_id1" >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected @@ -1567,14 +1641,14 @@ EOF echo "commit + $commit_id1" >> $testroot/stdout.expected echo "blob - $beta_id0 (mode 644)" >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo "blob + $new_id1 (mode 644)" >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected (cd $testroot/repo && got diff -d -c $commit_id0 -c $commit_id1 \ @@ -1621,8 +1695,8 @@ EOF got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + alpha' >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected @@ -1631,15 +1705,15 @@ EOF got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + new (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected @@ -1673,8 +1747,8 @@ EOF got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + alpha' >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified alpha' >> $testroot/stdout.expected @@ -1683,8 +1757,8 @@ EOF got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo "commit - $head_rev" >> $testroot/stdout.expected @@ -1692,16 +1766,16 @@ EOF got tree -r $testroot/repo -i epsilon | grep 'zeta$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + epsilon/zeta' >> $testroot/stdout.expected - echo '--- epsilon/zeta' >> $testroot/stdout.expected - echo '+++ epsilon/zeta' >> $testroot/stdout.expected + printf '--- epsilon/zeta\t\n' >> $testroot/stdout.expected + printf '+++ epsilon/zeta\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-zeta' >> $testroot/stdout.expected echo '+modified zeta' >> $testroot/stdout.expected echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + new (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected @@ -1756,15 +1830,15 @@ EOF echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + master (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ master' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ master\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+master' >> $testroot/stdout.expected echo "commit - $head_rev" >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + new (mode 644)' >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ new' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ new\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected cmp -s $testroot/stdout.expected $testroot/stdout @@ -1797,8 +1871,8 @@ diffstat $alpha_blobid $alpha_new_blobid blob - $alpha_blobid blob + $alpha_new_blobid ---- $alpha_blobid -+++ $alpha_new_blobid +--- $alpha_blobid$(printf '\t') ++++ $alpha_new_blobid$(printf '\t') @@ -1 +1 @@ -alpha +modified alpha @@ -1891,41 +1965,41 @@ test_diff_long_path_diffstat() { commit + $(cd "$testroot/wt" && got br -l | fgrep '*' | cut -d' ' -f3) blob - $blobid_alpha blob + $(get_blob_id "$testroot/repo" "" alpha longpath) - --- alpha - +++ alpha + --- alpha$(printf '\t') + +++ alpha$(printf '\t') @@ -1 +1 @@ -alpha +xalpha blob - $blobid_beta blob + $(get_blob_id "$testroot/repo" "" beta longpath) - --- beta - +++ beta + --- beta$(printf '\t') + +++ beta$(printf '\t') @@ -1 +1 @@ -beta +xbeta blob - $blobid_zeta blob + $(get_blob_id "$testroot/repo" "epsilon" zeta longpath) - --- epsilon/zeta - +++ epsilon/zeta + --- epsilon/zeta$(printf '\t') + +++ epsilon/zeta$(printf '\t') @@ -1 +1 @@ -zeta +xzeta blob - /dev/null blob + $blobid_longerpath (mode 644) - --- /dev/null - +++ $longerpath + --- /dev/null$(printf '\t') + +++ $longerpath$(printf '\t') @@ -0,0 +1 @@ +longerpath blob - /dev/null blob + $blobid_longpath (mode 644) - --- /dev/null - +++ $longpath + --- /dev/null$(printf '\t') + +++ $longpath$(printf '\t') @@ -0,0 +1 @@ +longpath blob - $blobid_delta blob + $(get_blob_id "$testroot/repo" "gamma" delta longpath) - --- gamma/delta - +++ gamma/delta + --- gamma/delta$(printf '\t') + +++ gamma/delta$(printf '\t') @@ -1 +1 @@ -delta +xdelta @@ -1967,14 +2041,14 @@ commit - $commit_id0 commit + $commit_id1 blob - $alpha_blobid (mode 644) blob + /dev/null ---- alpha -+++ /dev/null +--- alpha$(printf '\t') ++++ /dev/null$(printf '\t') @@ -1 +0,0 @@ -alpha blob - /dev/null blob + $alpha_eta_blobid (mode 644) ---- /dev/null -+++ alpha/eta +--- /dev/null$(printf '\t') ++++ alpha/eta$(printf '\t') @@ -0,0 +1 @@ +eta EOF @@ -2026,7 +2100,7 @@ EOF } test_diff_dir_to_file() { - local testroot=`test_init diff_file_to_dir` + local testroot=`test_init diff_dir_to_file` local commit_id0=`git_show_head $testroot/repo` local epsilon_zeta_blobid=`get_blob_id $testroot/repo epsilon zeta` @@ -2050,14 +2124,14 @@ commit - $commit_id0 commit + $commit_id1 blob - $epsilon_zeta_blobid (mode 644) blob + /dev/null ---- epsilon/zeta -+++ /dev/null +--- epsilon/zeta$(printf '\t') ++++ /dev/null$(printf '\t') @@ -1 +0,0 @@ -zeta blob - /dev/null blob + $epsilon_blobid (mode 644) ---- /dev/null -+++ epsilon +--- /dev/null$(printf '\t') ++++ epsilon$(printf '\t') @@ -0,0 +1 @@ +epsilon EOF @@ -2128,8 +2202,8 @@ commit - /dev/null commit + $commit_id blob - /dev/null blob + $alpha_blobid (mode 644) ---- /dev/null -+++ alpha +--- /dev/null$(printf '\t') ++++ alpha$(printf '\t') @@ -0,0 +1 @@ +alpha EOF @@ -2215,8 +2289,8 @@ test_diff_commit_keywords() { echo "commit + $(pop_idx 8 $@)" >> $testroot/stdout.expected echo "blob - $(pop_idx 4 $beta_ids)" >> $testroot/stdout.expected echo "blob + $(pop_idx 5 $beta_ids)" >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ beta' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ beta\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-beta change 5' >> $testroot/stdout.expected echo '+beta change 7' >> $testroot/stdout.expected @@ -2251,8 +2325,8 @@ test_diff_commit_keywords() { echo "commit + $(pop_idx 2 $@)" >> $testroot/stdout.expected echo "blob - $(pop_idx 1 $beta_ids)" >> $testroot/stdout.expected echo "blob + $(pop_idx 2 $beta_ids)" >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ beta' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ beta\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo '+beta change 1' >> $testroot/stdout.expected @@ -2279,8 +2353,8 @@ test_diff_commit_keywords() { echo "commit + $(pop_idx 4 $@)" >> $testroot/stdout.expected echo "blob - $(pop_idx 2 $beta_ids)" >> $testroot/stdout.expected echo "blob + $(pop_idx 3 $beta_ids)" >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ beta' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ beta\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-beta change 1' >> $testroot/stdout.expected echo '+beta change 3' >> $testroot/stdout.expected @@ -2308,8 +2382,8 @@ test_diff_commit_keywords() { echo "commit + $(pop_idx 9 $@)" >> $testroot/stdout.expected echo "blob - $(pop_idx 4 $alpha_ids)" >> $testroot/stdout.expected echo "blob + $(pop_idx 5 $alpha_ids)" >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha change 6' >> $testroot/stdout.expected echo '+alpha change 8' >> $testroot/stdout.expected @@ -2336,15 +2410,15 @@ test_diff_commit_keywords() { echo "commit + $(pop_idx 9 $@)" >> $testroot/stdout.expected echo "blob - $(pop_idx 2 $alpha_ids)" >> $testroot/stdout.expected echo "blob + $(pop_idx 5 $alpha_ids)" >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha change 2' >> $testroot/stdout.expected echo '+alpha change 8' >> $testroot/stdout.expected echo "blob - $(pop_idx 2 $beta_ids)" >> $testroot/stdout.expected echo "blob + $(pop_idx 5 $beta_ids)" >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ beta' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ beta\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-beta change 1' >> $testroot/stdout.expected echo '+beta change 7' >> $testroot/stdout.expected @@ -2371,15 +2445,15 @@ test_diff_commit_keywords() { echo "commit + $(pop_idx 8 $@)" >> $testroot/stdout.expected echo "blob - $(pop_idx 3 $alpha_ids)" >> $testroot/stdout.expected echo "blob + $(pop_idx 4 $alpha_ids)" >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha change 4' >> $testroot/stdout.expected echo '+alpha change 6' >> $testroot/stdout.expected echo "blob - $(pop_idx 4 $beta_ids)" >> $testroot/stdout.expected echo "blob + $(pop_idx 5 $beta_ids)" >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ beta' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ beta\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-beta change 5' >> $testroot/stdout.expected echo '+beta change 7' >> $testroot/stdout.expected @@ -2448,24 +2522,24 @@ test_diff_mixed_worktree() { commit - $baseid_alpha blob - $blobid_alpha file + alpha - --- alpha - +++ alpha + --- alpha$(printf '\t') + +++ alpha$(printf '\t') @@ -1 +1 @@ -'alpha +alpha commit - $baseid_beta blob - $blobid_beta file + beta - --- beta - +++ beta + --- beta$(printf '\t') + +++ beta$(printf '\t') @@ -1 +1 @@ -beta +'beta commit - $baseid_new blob - /dev/null file + new (mode 644) - --- /dev/null - +++ new + --- /dev/null$(printf '\t') + +++ new$(printf '\t') @@ -0,0 +1 @@ +new EOF @@ -2490,16 +2564,16 @@ test_diff_mixed_worktree() { commit - $baseid_alpha blob - $blobid_alpha blob + $stageid_alpha - --- alpha - +++ alpha + --- alpha$(printf '\t') + +++ alpha$(printf '\t') @@ -1 +1 @@ -'alpha +alpha commit - $baseid_beta blob - $blobid_beta blob + $stageid_beta - --- beta - +++ beta + --- beta$(printf '\t') + +++ beta$(printf '\t') @@ -1 +1 @@ -beta +'beta @@ -2519,6 +2593,7 @@ test_diff_mixed_worktree() { test_parseargs "$@" run_test test_diff_basic +run_test test_diff_filename_with_whitespaces run_test test_diff_shows_conflict run_test test_diff_tag run_test test_diff_lightweight_tag commit - fe66becbbe242300f7a2a5b9233dac96584839f004b922e11e6697ce705ed37f blob - 6a2f098cffe5489de75407cb6c60870e22ce472bb753c9f0ff3a0b870c5a279c file + regress/cmdline/import.sh --- regress/cmdline/import.sh +++ regress/cmdline/import.sh @@ -71,26 +71,26 @@ test_import_basic() { echo "commit + $head_commit" >> $testroot/stdout.expected echo "blob - /dev/null" >> $testroot/stdout.expected echo "blob + $id_alpha (mode 644)" >> $testroot/stdout.expected - echo "--- /dev/null" >> $testroot/stdout.expected - echo "+++ alpha" >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected echo "+alpha" >> $testroot/stdout.expected echo "blob - /dev/null" >> $testroot/stdout.expected echo "blob + $id_beta (mode 644)" >> $testroot/stdout.expected - echo "--- /dev/null" >> $testroot/stdout.expected - echo "+++ beta" >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ beta\t\n' >> $testroot/stdout.expected echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected echo "+beta" >> $testroot/stdout.expected echo "blob - /dev/null" >> $testroot/stdout.expected echo "blob + $id_zeta (mode 644)" >> $testroot/stdout.expected - echo "--- /dev/null" >> $testroot/stdout.expected - echo "+++ epsilon/zeta" >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ epsilon/zeta\t\n' >> $testroot/stdout.expected echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected echo "+zeta" >> $testroot/stdout.expected echo "blob - /dev/null" >> $testroot/stdout.expected echo "blob + $id_delta (mode 644)" >> $testroot/stdout.expected - echo "--- /dev/null" >> $testroot/stdout.expected - echo "+++ gamma/delta" >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ gamma/delta\t\n' >> $testroot/stdout.expected echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected echo "+delta" >> $testroot/stdout.expected echo "" >> $testroot/stdout.expected @@ -197,26 +197,26 @@ test_import_specified_head() { echo "commit + $head_commit" >> $testroot/stdout.expected echo "blob - /dev/null" >> $testroot/stdout.expected echo "blob + $id_alpha (mode 644)" >> $testroot/stdout.expected - echo "--- /dev/null" >> $testroot/stdout.expected - echo "+++ alpha" >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected echo "+alpha" >> $testroot/stdout.expected echo "blob - /dev/null" >> $testroot/stdout.expected echo "blob + $id_beta (mode 644)" >> $testroot/stdout.expected - echo "--- /dev/null" >> $testroot/stdout.expected - echo "+++ beta" >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ beta\t\n' >> $testroot/stdout.expected echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected echo "+beta" >> $testroot/stdout.expected echo "blob - /dev/null" >> $testroot/stdout.expected echo "blob + $id_zeta (mode 644)" >> $testroot/stdout.expected - echo "--- /dev/null" >> $testroot/stdout.expected - echo "+++ epsilon/zeta" >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ epsilon/zeta\t\n' >> $testroot/stdout.expected echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected echo "+zeta" >> $testroot/stdout.expected echo "blob - /dev/null" >> $testroot/stdout.expected echo "blob + $id_delta (mode 644)" >> $testroot/stdout.expected - echo "--- /dev/null" >> $testroot/stdout.expected - echo "+++ gamma/delta" >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ gamma/delta\t\n' >> $testroot/stdout.expected echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected echo "+delta" >> $testroot/stdout.expected echo "" >> $testroot/stdout.expected commit - fe66becbbe242300f7a2a5b9233dac96584839f004b922e11e6697ce705ed37f blob - 48b6144db3cdd955b186ad1fbb12058d4e7e796733d64160033e889a8370aa46 file + regress/cmdline/patch.sh --- regress/cmdline/patch.sh +++ regress/cmdline/patch.sh @@ -151,6 +151,75 @@ EOF test_done $testroot $ret } +test_patch_filename_with_whitespaces() { + local testroot=`test_init patch_filename_with_whitespaces` + + got checkout $testroot/repo $testroot/wt >/dev/null + ret=$? + if [ $ret -ne 0 ]; then + test_done $testroot $ret + return 1 + fi + + # add a file with a whitespace in its name + cat < $testroot/wt/patch +--- /dev/null ++++ iota file +@@ -0,0 +1 @@ ++iota is my favourite character +EOF + + (cd $testroot/wt && got patch < patch) > $testroot/stdout + if [ $ret -ne 0 ]; then + test_done "$testroot" $ret + return 1 + fi + + echo 'A iota file' > $testroot/stdout.expected + cmp -s $testroot/stdout.expected $testroot/stdout + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done $testroot $ret + return 1 + fi + + echo 'iota is my favourite character' > $testroot/wt/iota.expected + cmp -s $testroot/wt/iota.expected $testroot/wt/'iota file' + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/wt/iota.expected $testroot/wt/iota + test_done "$testroot" $ret + return 1 + fi + + # now change it + cat < $testroot/wt/patch +--- iota file ++++ iota file +@@ -1 +1 @@ +-iota is my favourite character ++iota is no longer my favourite character +EOF + + (cd $testroot/wt && got patch < patch) > $testroot/stdout + if [ $ret -ne 0 ]; then + test_done "$testroot" $ret + return 1 + fi + + echo 'M iota file' > $testroot/stdout.expected + cmp -s $testroot/stdout.expected $testroot/stdout + ret=$? + if [ $ret -ne 0 ]; then + diff -u $testroot/stdout.expected $testroot/stdout + test_done $testroot $ret + return 1 + fi + + test_done $testroot $ret +} + test_patch_dont_apply() { local testroot=`test_init patch_dont_apply` @@ -2149,6 +2218,7 @@ test_patch_commit_keywords() { test_parseargs "$@" run_test test_patch_basic +run_test test_patch_filename_with_whitespaces run_test test_patch_dont_apply run_test test_patch_malformed run_test test_patch_no_patch commit - fe66becbbe242300f7a2a5b9233dac96584839f004b922e11e6697ce705ed37f blob - 57503f19810ce7cb99a8309193c412df11869f9bbe17e24fe730807fd1d40110 file + regress/cmdline/revert.sh --- regress/cmdline/revert.sh +++ regress/cmdline/revert.sh @@ -574,8 +574,8 @@ EOF >> $testroot/stdout.expected echo 'file + numbers' >> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected echo 'file + numbers' >> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected echo 'file + numbers' >> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected echo ' (staged)' >> $testroot/stdout.expected echo 'file + alpha' >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-modified file' >> $testroot/stdout.expected echo '+modified file again' >> $testroot/stdout.expected @@ -952,8 +952,8 @@ test_stage_diff() { >> $testroot/stdout.expected echo " (staged)" >> $testroot/stdout.expected echo 'file + foo' >> $testroot/stdout.expected - echo '--- foo' >> $testroot/stdout.expected - echo '+++ foo' >> $testroot/stdout.expected + printf '--- foo\t\n' >> $testroot/stdout.expected + printf '+++ foo\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-new file' >> $testroot/stdout.expected echo '+new file changed' >> $testroot/stdout.expected @@ -977,8 +977,8 @@ test_stage_diff() { echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified file' >> $testroot/stdout.expected @@ -987,8 +987,8 @@ test_stage_diff() { got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo "commit - $head_commit" >> $testroot/stdout.expected @@ -996,8 +996,8 @@ test_stage_diff() { echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ foo' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ foo\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected @@ -1393,8 +1393,8 @@ test_stage_commit() { >> $testroot/stdout.expected echo -n 'blob + ' >> $testroot/stdout.expected cat $testroot/blob_id_alpha >> $testroot/stdout.expected - echo '--- alpha' >> $testroot/stdout.expected - echo '+++ alpha' >> $testroot/stdout.expected + printf '--- alpha\t\n' >> $testroot/stdout.expected + printf '+++ alpha\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '+modified file' >> $testroot/stdout.expected @@ -1404,16 +1404,16 @@ test_stage_commit() { >> $testroot/stdout.expected echo " (mode 644)" >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-beta' >> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo -n 'blob + ' >> $testroot/stdout.expected cat $testroot/blob_id_foo | tr -d '\n' >> $testroot/stdout.expected echo " (mode 644)" >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ foo' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ foo\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+new file' >> $testroot/stdout.expected @@ -1607,8 +1607,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo "--- numbers" >> $testroot/stdout.expected - echo "+++ numbers" >> $testroot/stdout.expected + printf '--- numbers\t\n' >> $testroot/stdout.expected + printf '+++ numbers\t\n' >> $testroot/stdout.expected echo "@@ -4,7 +4,7 @@" >> $testroot/stdout.expected echo " 4" >> $testroot/stdout.expected echo " 5" >> $testroot/stdout.expected @@ -1714,8 +1714,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo "--- numbers" >> $testroot/stdout.expected - echo "+++ numbers" >> $testroot/stdout.expected + printf '--- numbers\t\n' >> $testroot/stdout.expected + printf '+++ numbers\t\n' >> $testroot/stdout.expected echo "@@ -13,4 +13,4 @@" >> $testroot/stdout.expected echo " 13" >> $testroot/stdout.expected echo " 14" >> $testroot/stdout.expected @@ -1869,8 +1869,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo "--- numbers" >> $testroot/stdout.expected - echo "+++ numbers" >> $testroot/stdout.expected + printf '--- numbers\t\n' >> $testroot/stdout.expected + printf '+++ numbers\t\n' >> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected echo " (staged)" >> $testroot/stdout.expected echo 'file + numbers' >> $testroot/stdout.expected - echo "--- numbers" >> $testroot/stdout.expected - echo "+++ numbers" >> $testroot/stdout.expected + printf '--- numbers\t\n' >> $testroot/stdout.expected + printf '+++ numbers\t\n' >> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected (cd $testroot/wt && got stage -l epsilon/new) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo "--- /dev/null" >> $testroot/stdout.expected - echo "+++ epsilon/new" >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ epsilon/new\t\n' >> $testroot/stdout.expected echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected echo "+new" >> $testroot/stdout.expected cmp -s $testroot/stdout.expected $testroot/stdout @@ -2097,8 +2097,8 @@ test_stage_patch_removed() { (cd $testroot/wt && got stage -l beta) | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo "--- beta" >> $testroot/stdout.expected - echo "+++ /dev/null" >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected echo "-beta" >> $testroot/stdout.expected cmp -s $testroot/stdout.expected $testroot/stdout @@ -2322,8 +2322,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo "--- numbers" >> $testroot/stdout.expected - echo "+++ numbers" >> $testroot/stdout.expected + printf '--- numbers\t\n' >> $testroot/stdout.expected + printf '+++ numbers\t\n' >> $testroot/stdout.expected echo "@@ -1,5 +1,5 @@" >> $testroot/stdout.expected echo " 1" >> $testroot/stdout.expected echo "-2" >> $testroot/stdout.expected @@ -2518,8 +2518,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l alpha.link) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- alpha.link' >> $testroot/stdout.expected - echo '+++ alpha.link' >> $testroot/stdout.expected + printf '--- alpha.link\t\n' >> $testroot/stdout.expected + printf '+++ alpha.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -2530,8 +2530,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l dotgotbar.link) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ dotgotbar.link' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ dotgotbar.link\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+.got/bar' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -2540,8 +2540,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ dotgotfoo.link' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ dotgotfoo.link\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+this is regular file foo' >> $testroot/stdout.expected echo "commit - $head_commit" >> $testroot/stdout.expected @@ -2551,8 +2551,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l epsilon/beta.link) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- epsilon/beta.link' >> $testroot/stdout.expected - echo '+++ epsilon/beta.link' >> $testroot/stdout.expected + printf '--- epsilon/beta.link\t\n' >> $testroot/stdout.expected + printf '+++ epsilon/beta.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-../beta' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -2565,8 +2565,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l epsilon.link) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- epsilon.link' >> $testroot/stdout.expected - echo '+++ epsilon.link' >> $testroot/stdout.expected + printf '--- epsilon.link\t\n' >> $testroot/stdout.expected + printf '+++ epsilon.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-epsilon' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -2577,8 +2577,8 @@ EOF got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- nonexistent.link' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- nonexistent.link\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-nonexistent' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -2587,8 +2587,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ zeta.link' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ zeta.link\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+gamma/delta' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -2849,8 +2849,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l alpha.link) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- alpha.link' >> $testroot/stdout.expected - echo '+++ alpha.link' >> $testroot/stdout.expected + printf '--- alpha.link\t\n' >> $testroot/stdout.expected + printf '+++ alpha.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-alpha' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -2861,8 +2861,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ dotgotfoo.link' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ dotgotfoo.link\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+this is regular file foo' >> $testroot/stdout.expected echo "commit - $head_commit" >> $testroot/stdout.expected @@ -2872,8 +2872,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l epsilon.link) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- epsilon.link' >> $testroot/stdout.expected - echo '+++ epsilon.link' >> $testroot/stdout.expected + printf '--- epsilon.link\t\n' >> $testroot/stdout.expected + printf '+++ epsilon.link\t\n' >> $testroot/stdout.expected echo '@@ -1 +1 @@' >> $testroot/stdout.expected echo '-epsilon' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -2884,8 +2884,8 @@ EOF got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \ cut -d' ' -f 1 >> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo '--- nonexistent.link' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- nonexistent.link\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-nonexistent' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected @@ -2894,8 +2894,8 @@ EOF echo -n 'blob + ' >> $testroot/stdout.expected (cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \ >> $testroot/stdout.expected - echo '--- /dev/null' >> $testroot/stdout.expected - echo '+++ zeta.link' >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ zeta.link\t\n' >> $testroot/stdout.expected echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected echo '+gamma/delta' >> $testroot/stdout.expected echo '\ No newline at end of file' >> $testroot/stdout.expected commit - fe66becbbe242300f7a2a5b9233dac96584839f004b922e11e6697ce705ed37f blob - 812bbd03ae053feac9971dba5aa1d9546602c53146b6cdf836b4aa5b857384c2 file + regress/cmdline/unstage.sh --- regress/cmdline/unstage.sh +++ regress/cmdline/unstage.sh @@ -419,8 +419,8 @@ EOF (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \ >> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected echo "file + numbers" >> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected echo "file + numbers" >> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected echo 'file + numbers' >> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected echo 'blob - /dev/null' >> $testroot/stdout.expected echo 'file + epsilon/new (mode 644)' >> $testroot/stdout.expected - echo "--- /dev/null" >> $testroot/stdout.expected - echo "+++ epsilon/new" >> $testroot/stdout.expected + printf '--- /dev/null\t\n' >> $testroot/stdout.expected + printf '+++ epsilon/new\t\n' >> $testroot/stdout.expected echo "@@ -0,0 +1 @@" >> $testroot/stdout.expected echo "+new" >> $testroot/stdout.expected cmp -s $testroot/stdout.expected $testroot/stdout @@ -873,8 +873,8 @@ test_unstage_patch_removed() { got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + /dev/null' >> $testroot/stdout.expected - echo "--- beta" >> $testroot/stdout.expected - echo "+++ /dev/null" >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected echo "-beta" >> $testroot/stdout.expected cmp -s $testroot/stdout.expected $testroot/stdout @@ -979,8 +979,8 @@ EOF tr -d '\n' >> $testroot/stdout.expected echo " (staged)" >> $testroot/stdout.expected echo "file + numbers" >> $testroot/stdout.expected - echo "--- numbers" >> $testroot/stdout.expected - echo "+++ numbers" >> $testroot/stdout.expected + printf '--- numbers\t\n' >> $testroot/stdout.expected + printf '+++ numbers\t\n' >> $testroot/stdout.expected echo "@@ -1,5 +1,5 @@" >> $testroot/stdout.expected echo " 1" >> $testroot/stdout.expected echo "-2" >> $testroot/stdout.expected @@ -1008,8 +1008,8 @@ EOF (cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 \ >> $testroot/stdout.expected cat >> $testroot/stdout.expected <> $testroot/stdout.expected echo 'blob + /dev/null' >> $testroot/stdout.expected - echo "--- zzz" >> $testroot/stdout.expected - echo "+++ /dev/null" >> $testroot/stdout.expected + printf '--- zzz\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo "@@ -1 +0,0 @@" >> $testroot/stdout.expected echo "-zzz" >> $testroot/stdout.expected cmp -s $testroot/stdout.expected $testroot/stdout commit - fe66becbbe242300f7a2a5b9233dac96584839f004b922e11e6697ce705ed37f blob - 88f867850a9affdd90d03ac9298b2bc870533de7cdd553988334d49545909665 file + regress/cmdline/update.sh --- regress/cmdline/update.sh +++ regress/cmdline/update.sh @@ -1184,8 +1184,8 @@ test_update_conflict_wt_rm_vs_repo_edit() { got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \ >> $testroot/stdout.expected echo 'file + /dev/null' >> $testroot/stdout.expected - echo '--- beta' >> $testroot/stdout.expected - echo '+++ /dev/null' >> $testroot/stdout.expected + printf '--- beta\t\n' >> $testroot/stdout.expected + printf '+++ /dev/null\t\n' >> $testroot/stdout.expected echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected echo '-modified beta' >> $testroot/stdout.expected