diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-03-31 16:29:35 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-05-04 07:18:28 -0500 |
commit | 4beab1f8bbc29a0788ed7d5c1f6bc21741392565 (patch) | |
tree | 9108e6c355a1b0746cb6ed32a3a3bad4e42709c0 /src/diff.c | |
parent | 05f690122e9927eece61afb17c1595a136d119b2 (diff) | |
download | libgit2-4beab1f8bbc29a0788ed7d5c1f6bc21741392565.tar.gz |
checkout: break case-changes into delete/add
When checking out with a case-insensitive working directory, we
want to change the case of items in the working directory to
reflect changes that occured in the checkout target. Diff now
has an option to break case-changing renames into delete/add.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c index 08e218cce..f7e1c8ee4 100644 --- a/src/diff.c +++ b/src/diff.c @@ -822,6 +822,19 @@ static int maybe_modified( status = GIT_DELTA_UNMODIFIED; } + /* If we want case changes, then break this into a delete of the old + * and an add of the new so that consumers can act accordingly (eg, + * checkout will update the case on disk.) + */ + if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_IGNORE_CASE) && + DIFF_FLAG_IS_SET(diff, GIT_DIFF_INCLUDE_CASECHANGE) && + strcmp(oitem->path, nitem->path) != 0) { + + if (!(error = diff_delta__from_one(diff, GIT_DELTA_DELETED, oitem))) + error = diff_delta__from_one(diff, GIT_DELTA_ADDED, nitem); + return error; + } + return diff_delta__from_two( diff, status, oitem, omode, nitem, nmode, git_oid_iszero(&noid) ? NULL : &noid, matched_pathspec); |