commit - b68e64b1d55c9b06ac807e265083267f655ad65c
commit + 125ca675f07f91d5b8713dbc4ba8c2ef7bf70914
blob - f890b946e6565aa7acf7271c37921844fa902230
blob + 0f45835af753a3a6807444c2dc3b9b7127d0dda6
--- got/got.c
+++ got/got.c
if (err) {
close(*fd);
*fd = -1;
+ }
+ return err;
+}
+
+static const struct got_error *
+emit_base_commit_header(FILE *f, struct got_object_id *commit_id,
+ struct got_worktree *worktree)
+{
+ const struct got_error *err;
+ struct got_object_id *base_commit_id;
+ char *base_commit_idstr;
+
+ if (worktree == NULL) /* shouldn't happen */
+ return got_error(GOT_ERR_NOT_WORKTREE);
+
+ base_commit_id = got_worktree_get_base_commit_id(worktree);
+
+ if (commit_id != NULL) {
+ if (got_object_id_cmp(commit_id, base_commit_id) != 0)
+ base_commit_id = commit_id;
}
+
+ err = got_object_id_str(&base_commit_idstr, base_commit_id);
+ if (err != NULL)
+ return err;
+
+ if (fprintf(f, "commit - %s\n", base_commit_idstr) < 0)
+ err = got_error_from_errno("fprintf");
+ free(base_commit_idstr);
return err;
}
err = got_error_from_errno("fprintf");
goto done;
}
- if (fprintf(a->outfile, "commit - %s\n", a->id_str) < 0) {
- err = got_error_from_errno("fprintf");
- goto done;
- }
if (fprintf(a->outfile, "path + %s%s\n",
got_worktree_get_root_path(a->worktree),
a->diff_staged ? " (staged changes)" : "") < 0) {
}
a->header_shown = 1;
}
+
+ err = emit_base_commit_header(a->outfile, commit_id, a->worktree);
+ if (err != NULL)
+ goto done;
if (a->diff_staged) {
const char *label1 = NULL, *label2 = NULL;
blob - 79d34d5be8de2f8a77dd949ec12828120cf67461
blob + 1c2391cef1211e8f745596a22c4944873f497779
--- regress/cmdline/diff.sh
+++ regress/cmdline/diff.sh
(cd $testroot/wt && got add new >/dev/null)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '@@ -1 +1 @@' >> $testroot/stdout.expected
echo '-alpha' >> $testroot/stdout.expected
echo '+modified alpha' >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '+++ /dev/null' >> $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
# diff several paths in a work tree
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '@@ -1 +1 @@' >> $testroot/stdout.expected
echo '-alpha' >> $testroot/stdout.expected
echo '+modified alpha' >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '+++ /dev/null' >> $testroot/stdout.expected
echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
echo '-beta' >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i epsilon | grep 'zeta$' | cut -d' ' -f 1 \
>> $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
return 1
fi
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ 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
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
# a single argument which can be resolved to a path is not ambiguous
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $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
fi
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $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
fi
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'numbers$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
(cd $testroot/wt && got diff -w > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id0" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id0" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -c $commit_id0 -i | grep 'alpha$' | \
cut -d' ' -f 1 >> $testroot/stdout.expected
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id1" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id1" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -c $commit_id1 -i | \
grep 'alpha.link@ -> alpha$' | \
echo '\ No newline at end of file' >> $testroot/stdout.expected
echo '+beta' >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
+ echo "commit - $commit_id1" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -c $commit_id1 -i | \
grep 'dotgotfoo.link@ -> .got/foo$' | \
echo '\ No newline at end of file' >> $testroot/stdout.expected
echo '+.got/bar' >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
+ echo "commit - $commit_id1" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -c $commit_id1 -i epsilon | \
grep 'beta.link@ -> ../beta$' | \
echo '\ No newline at end of file' >> $testroot/stdout.expected
echo '+../gamma/delta' >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
+ echo "commit - $commit_id1" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -c $commit_id1 -i | \
grep 'epsilon.link@ -> epsilon$' | \
echo '\ No newline at end of file' >> $testroot/stdout.expected
echo '+gamma' >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
+ echo "commit - $commit_id1" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -c $commit_id1 -i | \
grep 'nonexistent.link@ -> nonexistent$' | \
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
(cd $testroot/wt && got add foo >/dev/null)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo 'file + foo (mode 644)' >> $testroot/stdout.expected
echo "Binary files /dev/null and foo differ" \
fi
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ 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
printf '\377\200\0\0\377\200\0\0' > $testroot/wt/foo
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'foo$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
local commit_id=`git_show_head $testroot/repo`
cat <<EOF > $testroot/stdout.expected
diff $testroot/wt
-commit - $commit_id
path + $testroot/wt
+commit - $commit_id
blob - /dev/null
file + xfile (mode 755)
--- /dev/null
EOF
echo "diff $testroot/wt" >> $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '@@ -1 +1 @@' >> $testroot/stdout.expected
echo '-alpha' >> $testroot/stdout.expected
echo '+modified alpha' >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '+++ /dev/null' >> $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
# specify paths to diffstat
echo "diff $testroot/wt" >> $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '@@ -1 +1 @@' >> $testroot/stdout.expected
echo '-alpha' >> $testroot/stdout.expected
echo '+modified alpha' >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '+++ /dev/null' >> $testroot/stdout.expected
echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
echo '-beta' >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i epsilon | grep 'zeta$' | cut -d' ' -f 1 \
>> $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
EOF
echo "diff $testroot/wt" >> $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ 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
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
fi
test_done "$testroot" "$ret"
+}
+
+test_diff_mixed_worktree() {
+ local testroot=$(test_init diff_mixed_worktree)
+ local baseid_beta=$(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
+
+ echo "'alpha" > $testroot/wt/alpha
+ (cd $testroot/wt && got commit -m "'alpha" > /dev/null)
+
+ local baseid_alpha=$(git_show_head $testroot/repo)
+
+ echo "'delta" > $testroot/wt/gamma/delta
+ (cd $testroot/wt && got commit -m "'delta" > /dev/null)
+
+ local baseid_new=$(git_show_head $testroot/repo)
+ local blobid_alpha=$(get_blob_id $testroot/repo "" alpha)
+ local blobid_beta=$(get_blob_id $testroot/repo "" beta)
+
+ echo "alpha" > $testroot/wt/alpha
+ echo "'beta" > $testroot/wt/beta
+ echo "new" > $testroot/wt/new
+
+ (cd $testroot/wt && got add new > /dev/null)
+
+ cat <<-EOF >$testroot/stdout.expected
+ diff $testroot/wt
+ path + $testroot/wt
+ commit - $baseid_alpha
+ blob - $blobid_alpha
+ file + alpha
+ --- alpha
+ +++ alpha
+ @@ -1 +1 @@
+ -'alpha
+ +alpha
+ commit - $baseid_beta
+ blob - $blobid_beta
+ file + beta
+ --- beta
+ +++ beta
+ @@ -1 +1 @@
+ -beta
+ +'beta
+ commit - $baseid_new
+ blob - /dev/null
+ file + new (mode 644)
+ --- /dev/null
+ +++ new
+ @@ -0,0 +1 @@
+ +new
+ 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 stage alpha beta > $testroot/stdout)
+
+ stageid_alpha=$(cd $testroot/wt && got stage -l alpha | cut -d' ' -f 1)
+ stageid_beta=$(cd $testroot/wt && got stage -l beta | cut -d' ' -f 1)
+
+ cat <<-EOF >$testroot/stdout.expected
+ diff -s $testroot/wt
+ path + $testroot/wt (staged changes)
+ commit - $baseid_alpha
+ blob - $blobid_alpha
+ blob + $stageid_alpha
+ --- alpha
+ +++ alpha
+ @@ -1 +1 @@
+ -'alpha
+ +alpha
+ commit - $baseid_beta
+ blob - $blobid_beta
+ blob + $stageid_beta
+ --- beta
+ +++ beta
+ @@ -1 +1 @@
+ -beta
+ +'beta
+ EOF
+
+ (cd $testroot/wt && got diff -s > $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_parseargs "$@"
run_test test_diff_dir_to_file
run_test test_diff_path_in_root_commit
run_test test_diff_commit_keywords
+run_test test_diff_mixed_worktree
blob - 884ba874302b4e95327b6a03d633122a2757442a
blob + 66b8ac0292d449f916eeb70817e844ea1710dd4b
--- regress/cmdline/patch.sh
+++ regress/cmdline/patch.sh
test_done $testroot $ret
return 1
fi
+
+ local alpha_basecommit_id=`git_show_head $testroot/repo`
seq 10 > $testroot/wt/numbers
(cd $testroot/wt && got add numbers && got commit -m +numbers) \
cat <<-EOF > $testroot/wt/alpha.expected
<<<<<<< --- alpha
ALPHA
- ||||||| commit $commit_id
+ ||||||| commit $alpha_basecommit_id
alpha
=======
a
blob - 011e20bae0544b37165ccaf2b12d702d4869e2f0
blob + cc12859f70df97800a252ad662cc906397252208
--- regress/cmdline/revert.sh
+++ regress/cmdline/revert.sh
fi
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
blob - 001262301f5016d81a6b4944240cc53a7e8a0144
blob + 1ad08eac94cab7500e0e8b85dc6c499f05700a6b
--- regress/cmdline/stage.sh
+++ regress/cmdline/stage.sh
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_commit" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l alpha) | cut -d' ' -f 1 | tr -d '\n' \
>> $testroot/stdout.expected
echo '@@ -1 +1 @@' >> $testroot/stdout.expected
echo '-modified file' >> $testroot/stdout.expected
echo '+modified file again' >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 | tr -d '\n' \
>> $testroot/stdout.expected
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_commit" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '@@ -1 +1 @@' >> $testroot/stdout.expected
echo '-alpha' >> $testroot/stdout.expected
echo '+modified file' >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo '+++ /dev/null' >> $testroot/stdout.expected
echo '@@ -1 +0,0 @@' >> $testroot/stdout.expected
echo '-beta' >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo -n 'blob + ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l foo) | cut -d' ' -f 1 \
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
tr -d '\n' >> $testroot/stdout.expected
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo -n 'blob + ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l epsilon/new) | cut -d' ' -f 1 \
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l beta) | cut -d' ' -f 1 \
>> $testroot/stdout.expected
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_commit" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
cut -d' ' -f 1 >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
echo '+beta' >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo -n 'blob + ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l dotgotbar.link) | cut -d' ' -f 1 \
echo '@@ -0,0 +1 @@' >> $testroot/stdout.expected
echo '+.got/bar' >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo -n 'blob + ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \
echo '+++ dotgotfoo.link' >> $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
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i epsilon | grep 'beta.link@ -> ../beta$' | \
cut -d' ' -f 1 >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
echo '+../gamma/delta' >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'epsilon.link@ -> epsilon$' | \
cut -d' ' -f 1 >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
echo '+gamma' >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \
cut -d' ' -f 1 >> $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 - $head_commit" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo -n 'blob + ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_commit" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
cut -d' ' -f 1 >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
echo '+beta' >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo -n 'blob + ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l dotgotfoo.link) | cut -d' ' -f 1 \
echo '+++ dotgotfoo.link' >> $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
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'epsilon.link@ -> epsilon$' | \
cut -d' ' -f 1 >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
echo '+gamma' >> $testroot/stdout.expected
echo '\ No newline at end of file' >> $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'nonexistent.link@ -> nonexistent$' | \
cut -d' ' -f 1 >> $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 - $head_commit" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo -n 'blob + ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l zeta.link) | cut -d' ' -f 1 \
blob - 6bb970784b5cf067c17b918409a825a1287df1e1
blob + 1f9c74b96419ec6eda2b937ea04a8b7cae1c8e5f
--- regress/cmdline/unstage.sh
+++ regress/cmdline/unstage.sh
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
tr -d '\n' >> $testroot/stdout.expected
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
tr -d '\n' >> $testroot/stdout.expected
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $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
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
(cd $testroot/wt && got diff > $testroot/stdout)
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
(cd $testroot/wt && got stage -l numbers) | cut -d' ' -f 1 | \
tr -d '\n' >> $testroot/stdout.expected
(cd $testroot/wt && got diff -s > $testroot/stdout)
echo "diff -s $testroot/wt" > $testroot/stdout.expected
- echo "commit - $commit_id" >> $testroot/stdout.expected
echo "path + $testroot/wt (staged changes)" >> $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
-16
+c
EOF
+ echo "commit - $commit_id" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'zzz$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
blob - 013d85e1d4cf6d156380290afdb9ab2e51598e63
blob + cd31d1db006846950774ef96be6c8beec4cc3f4e
--- regress/cmdline/update.sh
+++ regress/cmdline/update.sh
# 'got diff' should show post-update contents of beta being deleted
local head_rev=`git_show_head $testroot/repo`
echo "diff $testroot/wt" > $testroot/stdout.expected
- echo "commit - $head_rev" >> $testroot/stdout.expected
echo "path + $testroot/wt" >> $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected