summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-22 02:42:18 (GMT)
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-22 05:49:19 (GMT)
commit81e50eabf06dd68e8e62a9b697eaf60904c58b22 (patch)
treef7cf8566f2a72a669b6e4bbaca0cf6ca5a781dd3 /diffcore-rename.c
parent38c6f78059c3060db6f94b24f4a90063a91090d2 (diff)
downloadgit-81e50eabf06dd68e8e62a9b697eaf60904c58b22.zip
git-81e50eabf06dd68e8e62a9b697eaf60904c58b22.tar.gz
git-81e50eabf06dd68e8e62a9b697eaf60904c58b22.tar.bz2
[PATCH] The diff-raw format updates.
Update the diff-raw format as Linus and I discussed, except that it does not use sequence of underscore '_' letters to express nonexistence. All '0' mode is used for that purpose instead. The new diff-raw format can express rename/copy, and the earlier restriction that -M and -C _must_ be used with the patch format output is no longer necessary. The patch makes -M and -C flags independent of -p flag, so you need to say git-whatchanged -M -p to get the diff/patch format. Updated are both documentations and tests. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 9a13caf..28b1de2 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -142,7 +142,7 @@ static void debug_filespec(struct diff_filespec *s, int x, const char *one)
fprintf(stderr, "queue[%d] %s (%s) %s %06o %s\n",
x, one,
s->path,
- s->file_valid ? "valid" : "invalid",
+ DIFF_FILE_VALID(s) ? "valid" : "invalid",
s->mode,
s->sha1_valid ? sha1_to_hex(s->sha1) : "");
fprintf(stderr, "queue[%d] %s size %lu flags %d\n",
@@ -210,7 +210,7 @@ static int needs_to_stay(struct diff_queue_struct *q, int i,
*/
while (i < q->nr) {
struct diff_filepair *p = q->queue[i++];
- if (!p->two->file_valid)
+ if (!DIFF_FILE_VALID(p->two))
continue; /* removed is fine */
if (strcmp(p->one->path, it->path))
continue; /* not relevant */
@@ -247,12 +247,12 @@ void diff_detect_rename(int detect_rename,
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
- if (!p->one->file_valid)
- if (!p->two->file_valid)
+ if (!DIFF_FILE_VALID(p->one))
+ if (!DIFF_FILE_VALID(p->two))
continue; /* ignore nonsense */
else
diff_rename_pool_add(&created, p->two);
- else if (!p->two->file_valid)
+ else if (!DIFF_FILE_VALID(p->two))
diff_rename_pool_add(&deleted, p->one);
else if (1 < detect_rename) /* find copy, too */
diff_rename_pool_add(&stay, p->one);
@@ -340,15 +340,15 @@ void diff_detect_rename(int detect_rename,
*/
for (i = 0; i < q->nr; i++) {
struct diff_filepair *dp, *p = q->queue[i];
- if (!p->one->file_valid) {
- if (p->two->file_valid) {
+ if (!DIFF_FILE_VALID(p->one)) {
+ if (DIFF_FILE_VALID(p->two)) {
/* creation */
dp = diff_queue(&outq, p->one, p->two);
dp->xfrm_work = 4;
}
/* otherwise it is a nonsense; just ignore it */
}
- else if (!p->two->file_valid) {
+ else if (!DIFF_FILE_VALID(p->two)) {
/* deletion */
dp = diff_queue(&outq, p->one, p->two);
dp->xfrm_work = 2;
@@ -374,14 +374,14 @@ void diff_detect_rename(int detect_rename,
/* Copy it out to q, removing duplicates. */
for (i = 0; i < outq.nr; i++) {
struct diff_filepair *p = outq.queue[i];
- if (!p->one->file_valid) {
+ if (!DIFF_FILE_VALID(p->one)) {
/* created */
if (p->two->xfrm_flags & RENAME_DST_MATCHED)
; /* rename/copy created it already */
else
diff_queue(q, p->one, p->two);
}
- else if (!p->two->file_valid) {
+ else if (!DIFF_FILE_VALID(p->two)) {
/* deleted */
if (p->one->xfrm_flags & RENAME_SRC_GONE)
; /* rename/copy deleted it already */