commit - ef20f542049f5928fa256eb470801089d0b1048b
commit + 9b4458b41088db703d890881c32dfd242efce4df
blob - 64e9211906bb2f24ea99ab4711625da3df5aa9cb
blob + 3d3f817d6a45800bef116a8942a2a06a9a32aa14
--- got/got.c
+++ got/got.c
&qid->id);
if (err)
return err;
+ err = got_object_id_str(&id_str1, &qid->id);
+ if (err)
+ goto done;
}
+ err = got_object_id_str(&id_str2, id);
+ if (err)
+ goto done;
+
if (path && path[0] != '\0') {
int obj_type;
err = got_object_id_by_path(&obj_id2, repo, commit, path);
if (err)
goto done;
- err = got_object_id_str(&id_str2, obj_id2);
- if (err) {
- free(obj_id2);
- goto done;
- }
if (pcommit) {
err = got_object_id_by_path(&obj_id1, repo,
pcommit, path);
free(obj_id2);
goto done;
}
- } else {
- err = got_object_id_str(&id_str1, obj_id1);
- if (err) {
- free(obj_id2);
- goto done;
- }
}
}
err = got_object_get_type(&obj_type, repo, obj_id2);
}
fprintf(outfile,
"diff %s %s\n", id_str1 ? id_str1 : "/dev/null", id_str2);
+ fprintf(outfile, "commit - %s\n",
+ id_str1 ? id_str1 : "/dev/null");
+ fprintf(outfile, "commit + %s\n", id_str2);
switch (obj_type) {
case GOT_OBJ_TYPE_BLOB:
err = diff_blobs(obj_id1, obj_id2, path, diff_context,
free(obj_id2);
} else {
obj_id2 = got_object_commit_get_tree_id(commit);
- err = got_object_id_str(&id_str2, obj_id2);
- if (err)
- goto done;
- if (pcommit) {
+ if (pcommit)
obj_id1 = got_object_commit_get_tree_id(pcommit);
- err = got_object_id_str(&id_str1, obj_id1);
- if (err)
- goto done;
- }
fprintf(outfile,
"diff %s %s\n", id_str1 ? id_str1 : "/dev/null", id_str2);
+ fprintf(outfile, "commit - %s\n",
+ id_str1 ? id_str1 : "/dev/null");
+ fprintf(outfile, "commit + %s\n", id_str2);
err = diff_trees(obj_id1, obj_id2, "", diff_context, 0, 0,
repo, outfile);
}
}
if (!a->header_shown) {
- printf("diff %s %s%s\n", a->id_str,
+ printf("diff %s%s\n", a->diff_staged ? "-s " : "",
+ got_worktree_get_root_path(a->worktree));
+ printf("commit - %s\n", a->id_str);
+ printf("path + %s%s\n",
got_worktree_get_root_path(a->worktree),
a->diff_staged ? " (staged changes)" : "");
a->header_shown = 1;
blob - 420ad693dd5543912fea36afad97a2ff9e02c1ba
blob + 4325a3c18009b1a5e03a0b8dae4202531c186761
--- lib/diff.c
+++ lib/diff.c
return err;
}
-const struct got_error *
-got_diff_objects_as_trees(off_t **line_offsets, size_t *nlines,
+static const struct got_error *
+show_object_id(off_t **line_offsets, size_t *nlines, const char *obj_typestr,
+ int ch, const char *id_str, FILE *outfile)
+{
+ const struct got_error *err;
+ int n;
+ off_t outoff = 0;
+
+ n = fprintf(outfile, "%s %c %s\n", obj_typestr, ch, id_str);
+ if (line_offsets != NULL && *line_offsets != NULL) {
+ if (*nlines == 0) {
+ err = add_line_offset(line_offsets, nlines, 0);
+ if (err)
+ return err;
+ } else
+ outoff = (*line_offsets)[*nlines - 1];
+
+ outoff += n;
+ err = add_line_offset(line_offsets, nlines, outoff);
+ if (err)
+ return err;
+ }
+
+ return NULL;
+}
+
+static const struct got_error *
+diff_objects_as_trees(off_t **line_offsets, size_t *nlines,
FILE *f1, FILE *f2, struct got_object_id *id1, struct got_object_id *id2,
struct got_pathlist_head *paths,
char *label1, char *label2, int diff_context, int ignore_whitespace,
}
const struct got_error *
+got_diff_objects_as_trees(off_t **line_offsets, size_t *nlines,
+ FILE *f1, FILE *f2, struct got_object_id *id1, struct got_object_id *id2,
+ struct got_pathlist_head *paths,
+ char *label1, char *label2, int diff_context, int ignore_whitespace,
+ int force_text_diff, struct got_repository *repo, FILE *outfile)
+{
+ const struct got_error *err;
+ char *idstr = NULL;
+
+ if (id1 == NULL && id2 == NULL)
+ return got_error(GOT_ERR_NO_OBJ);
+
+ if (id1) {
+ err = got_object_id_str(&idstr, id1);
+ if (err)
+ goto done;
+ err = show_object_id(line_offsets, nlines, "tree", '-',
+ idstr, outfile);
+ if (err)
+ goto done;
+ free(idstr);
+ idstr = NULL;
+ } else {
+ err = show_object_id(line_offsets, nlines, "tree", '-',
+ "/dev/null", outfile);
+ if (err)
+ goto done;
+ }
+
+ if (id2) {
+ err = got_object_id_str(&idstr, id2);
+ if (err)
+ goto done;
+ err = show_object_id(line_offsets, nlines, "tree", '+',
+ idstr, outfile);
+ if (err)
+ goto done;
+ free(idstr);
+ idstr = NULL;
+ } else {
+ err = show_object_id(line_offsets, nlines, "tree", '+',
+ "/dev/null", outfile);
+ if (err)
+ goto done;
+ }
+
+ err = diff_objects_as_trees(line_offsets, nlines, f1, f2, id1, id2,
+ paths, label1, label2, diff_context, ignore_whitespace,
+ force_text_diff, repo, outfile);
+done:
+ free(idstr);
+ return err;
+}
+
+const struct got_error *
got_diff_objects_as_commits(off_t **line_offsets, size_t *nlines,
FILE *f1, FILE *f2, struct got_object_id *id1, struct got_object_id *id2,
struct got_pathlist_head *paths,
{
const struct got_error *err;
struct got_commit_object *commit1 = NULL, *commit2 = NULL;
+ char *idstr = NULL;
if (id2 == NULL)
return got_error(GOT_ERR_NO_OBJ);
err = got_object_open_as_commit(&commit1, repo, id1);
if (err)
goto done;
+ err = got_object_id_str(&idstr, id1);
+ if (err)
+ goto done;
+ err = show_object_id(line_offsets, nlines, "commit", '-',
+ idstr, outfile);
+ if (err)
+ goto done;
+ free(idstr);
+ idstr = NULL;
+ } else {
+ err = show_object_id(line_offsets, nlines, "commit", '-',
+ "/dev/null", outfile);
+ if (err)
+ goto done;
}
err = got_object_open_as_commit(&commit2, repo, id2);
if (err)
goto done;
- err = got_diff_objects_as_trees(line_offsets, nlines, f1, f2,
+ err = got_object_id_str(&idstr, id2);
+ if (err)
+ goto done;
+ err = show_object_id(line_offsets, nlines, "commit", '+',
+ idstr, outfile);
+ if (err)
+ goto done;
+
+ err = diff_objects_as_trees(line_offsets, nlines, f1, f2,
commit1 ? got_object_commit_get_tree_id(commit1) : NULL,
got_object_commit_get_tree_id(commit2), paths, "", "",
diff_context, ignore_whitespace, force_text_diff, repo, outfile);
got_object_commit_close(commit1);
if (commit2)
got_object_commit_close(commit2);
+ free(idstr);
return err;
}
blob - fae7779801eff69eff31c4d04e25c03dc88ed9a0
blob + be5fd59f7bd22bcddb4107bc9b7d0a9d415c93fa
--- libexec/got-read-patch/got-read-patch.c
+++ libexec/got-read-patch/got-read-patch.c
} else if (!git && !strncmp(line, "diff ", 5)) {
free(commitid);
err = blobid(line + 5, &commitid);
+ } else if (!git && !strncmp(line, "commit - ", 9)) {
+ free(commitid);
+ err = blobid(line + 9, &commitid);
}
if (err)
blob - 994f2f0b851c88abfd6ed1e8047b65d044feab1b
blob + 5cd3fe5876e2470973ab90d512629ae0a5331d16
--- regress/cmdline/cherrypick.sh
+++ regress/cmdline/cherrypick.sh
EOF
(cd $testroot/wt && got diff |
- egrep -v '^(diff|blob|file)' > $testroot/diff)
+ egrep -v '^(diff|blob|file|commit|path)' > $testroot/diff)
cmp -s $testroot/diff.expected $testroot/diff
ret=$?
if [ $ret -ne 0 ]; then
blob - 14022127d533af86f393b2dd9143c34b322ce10a
blob + d04b020f02390c3752f40b856153c1875354e233
--- regress/cmdline/commit.sh
+++ regress/cmdline/commit.sh
fi
echo "diff $commit1 $commit2" > $testroot/stdout.expected
+ echo "commit - $commit1" >> $testroot/stdout.expected
+ echo "commit + $commit2" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -c $commit1 -i gamma | grep 'delta$' \
| cut -d' ' -f 1 >> $testroot/stdout.expected
fi
echo "diff $commit2 $commit3" > $testroot/stdout.expected
+ echo "commit - $commit2" >> $testroot/stdout.expected
+ echo "commit + $commit3" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -c $commit2 -i gamma | grep 'delta$' \
| cut -d' ' -f 1 | sed -e 's/$/ (mode 644)/' \
blob - 3db8d1824c5c7c5b4224d56048f8d6bf2b1c3e8d
blob + 94f402340943fa24af2622ae5b16240e2e9dc93d
--- regress/cmdline/diff.sh
+++ regress/cmdline/diff.sh
echo "new file" > $testroot/wt/new
(cd $testroot/wt && got add new >/dev/null)
- echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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 "modified zeta" > $testroot/wt/epsilon/zeta
# diff several paths in a work tree
- echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
return 1
fi
echo "diff refs/heads/master refs/heads/new" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "commit + $head_rev" >> $testroot/stdout.expected
# diff between the branches is empty
cmp -s $testroot/stdout.expected $testroot/stdout
ret=$?
return 1
fi
echo "diff refs/heads/master refs/heads/new" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "commit + $head_rev" >> $testroot/stdout.expected
cmp -s $testroot/stdout.expected $testroot/stdout
ret=$?
if [ $ret -ne 0 ]; then
return 1
fi
echo "diff refs/heads/master refs/heads/new" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "commit + $head_rev" >> $testroot/stdout.expected
cmp -s $testroot/stdout.expected $testroot/stdout
ret=$?
if [ $ret -ne 0 ]; then
test_done "$testroot" "1"
return 1
fi
- echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo 'file + master' >> $testroot/stdout.expected
echo '--- /dev/null' >> $testroot/stdout.expected
fi
# a single argument which can be resolved to a path is not ambiguous
- echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo 'file + new' >> $testroot/stdout.expected
echo '--- /dev/null' >> $testroot/stdout.expected
return 1
fi
- echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo 'file + new' >> $testroot/stdout.expected
echo '--- /dev/null' >> $testroot/stdout.expected
return 1
fi
- echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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/repo && git tag -m "test" $tag2)
echo "diff $commit_id0 refs/tags/$tag1" > $testroot/stdout.expected
+ echo "commit - $commit_id0" >> $testroot/stdout.expected
+ echo "commit + $commit_id1" >> $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
fi
echo "diff refs/tags/$tag1 refs/tags/$tag2" > $testroot/stdout.expected
+ echo "commit - $commit_id1" >> $testroot/stdout.expected
+ echo "commit + $commit_id2" >> $testroot/stdout.expected
echo "blob - /dev/null" >> $testroot/stdout.expected
echo -n 'blob + ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id2 | grep 'new$' | \
(cd $testroot/repo && git tag $tag2)
echo "diff $commit_id0 refs/tags/$tag1" > $testroot/stdout.expected
+ echo "commit - $commit_id0" >> $testroot/stdout.expected
+ echo "commit + $commit_id1" >> $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
fi
echo "diff refs/tags/$tag1 refs/tags/$tag2" > $testroot/stdout.expected
+ echo "commit - $commit_id1" >> $testroot/stdout.expected
+ echo "commit + $commit_id2" >> $testroot/stdout.expected
echo "blob - /dev/null" >> $testroot/stdout.expected
echo -n 'blob + ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id2 | grep 'new$' | \
(cd $testroot/wt && got diff -w > $testroot/stdout)
- echo "diff $commit_id0 $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id0" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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 add zeta.link > /dev/null)
(cd $testroot/wt && got diff > $testroot/stdout)
- echo "diff $commit_id1 $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id1" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -c $commit_id1 -i | \
grep 'alpha.link@ -> alpha$' | \
got diff -r $testroot/repo $commit_id1 $commit_id2 > $testroot/stdout
echo "diff $commit_id1 $commit_id2" > $testroot/stdout.expected
+ echo "commit - $commit_id1" >> $testroot/stdout.expected
+ echo "commit + $commit_id2" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -c $commit_id1 -i | \
grep 'alpha.link@ -> alpha$' | \
printf '\377\377\0\0\377\377\0\0' > $testroot/wt/foo
(cd $testroot/wt && got add foo >/dev/null)
- echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo 'file + foo' >> $testroot/stdout.expected
echo "Binary files /dev/null and foo differ" \
return 1
fi
- echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo 'file + foo' >> $testroot/stdout.expected
echo '--- /dev/null' >> $testroot/stdout.expected
printf '\377\200\0\0\377\200\0\0' > $testroot/wt/foo
- echo "diff $head_rev $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'foo$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
new_id1=`get_blob_id $testroot/repo "" new`
echo "diff $commit_id0 refs/heads/master" > $testroot/stdout.expected
+ echo "commit - $commit_id0" >> $testroot/stdout.expected
+ 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
# same diff with commit object IDs
echo "diff $commit_id0 $commit_id1" > $testroot/stdout.expected
+ echo "commit - $commit_id0" >> $testroot/stdout.expected
+ 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
# same diff, filtered by paths
echo "diff $commit_id0 $commit_id1" > $testroot/stdout.expected
+ echo "commit - $commit_id0" >> $testroot/stdout.expected
+ 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
fi
echo "diff $commit_id0 $commit_id1" > $testroot/stdout.expected
+ echo "commit - $commit_id0" >> $testroot/stdout.expected
+ 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
blob - 5fd35f7af5ce6affa60ec097e6dc2a85866e1596
blob + 920610e37ab899c23ebcb98ee645c7044a456669
--- regress/cmdline/import.sh
+++ regress/cmdline/import.sh
echo " " >> $testroot/stdout.expected
echo " init" >> $testroot/stdout.expected
echo " " >> $testroot/stdout.expected
- echo "diff /dev/null $tree_id" >> $testroot/stdout.expected
+ echo "diff /dev/null $head_commit" >> $testroot/stdout.expected
+ echo "commit - /dev/null" >> $testroot/stdout.expected
+ 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
blob - 7bdd9c2e0c5b082a18dcf878227aa026335384cf
blob + f322b4b27c50f6f8a96b7c8322063b329f68c34c
--- regress/cmdline/log.sh
+++ regress/cmdline/log.sh
local commit_id1=`git_show_head $testroot/repo`
echo "commit $commit_id1 (master)" > $testroot/stdout.expected
+ echo "commit - $commit_id0" >> $testroot/stdout.expected
+ echo "commit + $commit_id1" >> $testroot/stdout.expected
# This used to fail with 'got: no such entry found in tree'
(cd $testroot/wt && got log -l1 -p new > $testroot/stdout.patch)
ret=$?
blob - 2da5d6e69486ff76ad9de933980eba23101afa7f
blob + 9ad05fe4e6ae0a06c3ae5faa6d212f4388427be1
--- regress/cmdline/revert.sh
+++ regress/cmdline/revert.sh
return 1
fi
- echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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 $commit_id $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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 $commit_id $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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 - 8255dfd0388d7d739afccf6c36583e08ef5ca252
blob + 038d00ac14c1b4463693bd6a50b6607eab9dfba4
--- regress/cmdline/stage.sh
+++ regress/cmdline/stage.sh
(cd $testroot/wt && got diff > $testroot/stdout)
- echo "diff $head_commit $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_commit" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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
(cd $testroot/wt && got diff -s > $testroot/stdout)
- echo "diff $head_commit $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
echo "diff $first_commit $head_commit" \
> $testroot/stdout.expected
+ echo "commit - $first_commit" >> $testroot/stdout.expected
+ echo "commit + $head_commit" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $first_commit | \
grep 'alpha$' | cut -d' ' -f 1 \
(cd $testroot/wt && got diff -s > $testroot/stdout)
- echo "diff $commit_id $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -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 $commit_id $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -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 $commit_id $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -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 $commit_id $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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 $commit_id $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 '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 $commit_id $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -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 $commit_id $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -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 $head_commit $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
cut -d' ' -f 1 >> $testroot/stdout.expected
(cd $testroot/wt && got diff -s > $testroot/stdout)
- echo "diff $head_commit $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'alpha.link@ -> alpha$' | \
cut -d' ' -f 1 >> $testroot/stdout.expected
blob - 74be2a6ea360e72b04ad2f965ba691489a9ca581
blob + b675f2f5d1c438aac58f5bfc0943cb3b08913166
--- regress/cmdline/unstage.sh
+++ regress/cmdline/unstage.sh
(cd $testroot/wt && got diff -s > $testroot/stdout)
- echo "diff $commit_id $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
fi
(cd $testroot/wt && got diff > $testroot/stdout)
- echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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 $commit_id $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
fi
(cd $testroot/wt && got diff > $testroot/stdout)
- echo "diff $commit_id $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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 $commit_id $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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 $commit_id $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $testroot/stdout.expected
echo 'blob - /dev/null' >> $testroot/stdout.expected
echo 'file + epsilon/new' >> $testroot/stdout.expected
echo "--- /dev/null" >> $testroot/stdout.expected
(cd $testroot/wt && got diff > $testroot/stdout)
- echo "diff $commit_id $testroot/wt" \
- > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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 $commit_id $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $commit_id" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $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
fi
(cd $testroot/wt && got diff -s > $testroot/stdout)
- echo "diff $commit_id $testroot/wt (staged changes)" \
- > $testroot/stdout.expected
+ 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 -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i -c $commit_id \
| grep 'numbers$' | cut -d' ' -f 1 \
blob - df937849c6b990bff03f3bfe1953cc9376da9a30
blob + a949436c0074202971cdc185337b3631820467f9
--- 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 $head_rev $testroot/wt" > $testroot/stdout.expected
+ echo "diff $testroot/wt" > $testroot/stdout.expected
+ echo "commit - $head_rev" >> $testroot/stdout.expected
+ echo "path + $testroot/wt" >> $testroot/stdout.expected
echo -n 'blob - ' >> $testroot/stdout.expected
got tree -r $testroot/repo -i | grep 'beta$' | cut -d' ' -f 1 \
>> $testroot/stdout.expected
blob - 727754759324b49fe4b4ef652fc8680080c64745
blob + 660a543a10294eecf9559d98095e46265a14df11
--- tog/tog.c
+++ tog/tog.c
goto done;
err = add_color(&s->colors,
- "^(commit [0-9a-f]|parent [0-9]|(blob|file) [-+] |"
+ "^(commit [0-9a-f]|parent [0-9]|"
+ "(blob|file|tree|commit) [-+] |"
"[MDmA] [^ ])", TOG_COLOR_DIFF_META,
get_color_value("TOG_COLOR_DIFF_META"));
if (err)