Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-03-26 09:19:39 +0400
committerRussell Belfer <rb@github.com>2013-03-26 09:19:39 +0400
commit37ee70fab4e6dcf35afc08c0edbe9f101d4abf2d (patch)
treee9bee47b3059bbc5189e0833b927a3bf50776bdf /src/diff.c
parent0c289dd7c6831f4f402f9581b46d0c920053abf9 (diff)
Implement GIT_STATUS_OPT_EXCLUDE_SUBMODULES
This option has been sitting unimplemented for a while, so I finally went through and implemented it along with some tests. As part of this, I improved the implementation of GIT_DIFF_IGNORE_SUBMODULES so it be more diligent about avoiding extra work and about leaving off delta records for submodules to the greatest extent possible (though it may include them still if you are request TYPECHANGE records).
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c
index 11ffc481a..61fd18d89 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -73,6 +73,10 @@ static int diff_delta__from_one(
DIFF_FLAG_ISNT_SET(diff, GIT_DIFF_INCLUDE_UNTRACKED))
return 0;
+ if (entry->mode == GIT_FILEMODE_COMMIT &&
+ DIFF_FLAG_IS_SET(diff, GIT_DIFF_IGNORE_SUBMODULES))
+ return 0;
+
if (!git_pathspec_match_path(
&diff->pathspec, entry->path,
DIFF_FLAG_IS_SET(diff, GIT_DIFF_DISABLE_PATHSPEC_MATCH),
@@ -131,6 +135,11 @@ static int diff_delta__from_two(
DIFF_FLAG_ISNT_SET(diff, GIT_DIFF_INCLUDE_UNMODIFIED))
return 0;
+ if (old_entry->mode == GIT_FILEMODE_COMMIT &&
+ new_entry->mode == GIT_FILEMODE_COMMIT &&
+ DIFF_FLAG_IS_SET(diff, GIT_DIFF_IGNORE_SUBMODULES))
+ return 0;
+
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_REVERSE)) {
uint32_t temp_mode = old_mode;
const git_index_entry *temp_entry = old_entry;
@@ -548,6 +557,11 @@ static int maybe_modified(
}
}
+ /* if mode is GITLINK and submodules are ignored, then skip */
+ else if (S_ISGITLINK(nmode) &&
+ DIFF_FLAG_IS_SET(diff, GIT_DIFF_IGNORE_SUBMODULES))
+ status = GIT_DELTA_UNMODIFIED;
+
/* if we got here and decided that the files are modified, but we
* haven't calculated the OID of the new item, then calculate it now
*/