summaryrefslogtreecommitdiff
path: root/src/diff_print.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-04-21 16:08:05 -0700
committerRussell Belfer <rb@github.com>2014-04-22 09:17:29 -0700
commit12e422a0562de2aebb05f5f414dbcde7caf85886 (patch)
treecf679a3ce25ec6e9c58efe1324fdc5eb628fbd1c /src/diff_print.c
parenta32d684f866e7710fd139d69ad5d1a8d0ae527c4 (diff)
downloadlibgit2-12e422a0562de2aebb05f5f414dbcde7caf85886.tar.gz
Some doc and examples/diff.c changes
I was playing with "git diff-index" and wanted to be able to emulate that behavior a little more closely with the diff example. Also, I wanted to play with running `git_diff_tree_to_workdir` directly even though core Git doesn't exactly have the equivalent, so I added a command line option for that and tweaked some other things in the example code. This changes a minor output thing in that the "raw" print helper function will no longer add ellipses (...) if the OID is not actually abbreviated.
Diffstat (limited to 'src/diff_print.c')
-rw-r--r--src/diff_print.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/diff_print.c b/src/diff_print.c
index a7f7b6fe8..ee5cd8dfb 100644
--- a/src/diff_print.c
+++ b/src/diff_print.c
@@ -175,7 +175,8 @@ static int diff_print_one_raw(
git_oid_tostr(end_oid, pi->oid_strlen, &delta->new_file.id);
git_buf_printf(
- out, ":%06o %06o %s... %s... %c",
+ out, (pi->oid_strlen <= GIT_OID_HEXSZ) ?
+ ":%06o %06o %s... %s... %c" : ":%06o %06o %s %s %c",
delta->old_file.mode, delta->new_file.mode, start_oid, end_oid, code);
if (delta->similarity > 0)