summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 13e86ef)
raw | patch | inline | side by side (parent: 13e86ef)
author | Junio C Hamano <junkio@cox.net> | |
Fri, 5 Jan 2007 09:25:18 +0000 (01:25 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 7 Jan 2007 06:57:42 +0000 (22:57 -0800) |
This updates the way diffcore represents an unmerged pair
somewhat. It used to be that entries with mode=0 on both sides
were used to represent an unmerged pair, but now it has an
explicit flag. This is to allow diff-index --cached to report
the entry from the tree when the path is unmerged in the index.
This is used in updating "git reset <tree> -- <path>" to restore
absense of the path in the index from the tree.
Signed-off-by: Junio C Hamano <junkio@cox.net>
somewhat. It used to be that entries with mode=0 on both sides
were used to represent an unmerged pair, but now it has an
explicit flag. This is to allow diff-index --cached to report
the entry from the tree when the path is unmerged in the index.
This is used in updating "git reset <tree> -- <path>" to restore
absense of the path in the index from the tree.
Signed-off-by: Junio C Hamano <junkio@cox.net>
diff-lib.c | patch | blob | history | |
diff.c | patch | blob | history | |
diff.h | patch | blob | history | |
diffcore.h | patch | blob | history |
diff --git a/diff-lib.c b/diff-lib.c
index fc69fb92a50c3dff67da76fedf1bf1df561c6065..2c9be60ed9b47c2e563f69e6c8b60195fd51a917 100644 (file)
--- a/diff-lib.c
+++ b/diff-lib.c
* Show the diff for the 'ce' if we found the one
* from the desired stage.
*/
- diff_unmerge(&revs->diffopt, ce->name);
+ diff_unmerge(&revs->diffopt, ce->name, 0, null_sha1);
if (ce_stage(ce) != diff_unmerged_stage)
continue;
}
!show_modified(revs, ce, ac[1], 0,
cached, match_missing))
break;
- /* fallthru */
+ diff_unmerge(&revs->diffopt, ce->name,
+ ntohl(ce->ce_mode), ce->sha1);
+ break;
case 3:
- diff_unmerge(&revs->diffopt, ce->name);
+ diff_unmerge(&revs->diffopt, ce->name,
+ 0, null_sha1);
break;
default:
index f14288bb8a100c43c6709f658b9a9ca44832fd7f..2c2e9dcb8c83709df37d6d57bdfe13bb0e85c0ba 100644 (file)
--- a/diff.c
+++ b/diff.c
}
void diff_unmerge(struct diff_options *options,
- const char *path)
+ const char *path,
+ unsigned mode, const unsigned char *sha1)
{
struct diff_filespec *one, *two;
one = alloc_filespec(path);
two = alloc_filespec(path);
- diff_queue(&diff_queued_diff, one, two);
+ fill_filespec(one, sha1, mode);
+ diff_queue(&diff_queued_diff, one, two)->is_unmerged = 1;
}
index eff445596d98e46d40dd37843e690de27c5fabf1..7a347cf77d448817014ceeaed2d3cd99b5894ac6 100644 (file)
--- a/diff.h
+++ b/diff.h
const char *base, const char *path);
extern void diff_unmerge(struct diff_options *,
- const char *path);
+ const char *path,
+ unsigned mode,
+ const unsigned char *sha1);
extern int diff_scoreopt_parse(const char *opt);
diff --git a/diffcore.h b/diffcore.h
index 2249bc2c05744ce5026744547fcb30195a19b3f1..1ea80671e30500f95fc1b648ccc6d5143ac0ac52 100644 (file)
--- a/diffcore.h
+++ b/diffcore.h
unsigned source_stays : 1; /* all of R/C are copies */
unsigned broken_pair : 1;
unsigned renamed_pair : 1;
+ unsigned is_unmerged : 1;
};
-#define DIFF_PAIR_UNMERGED(p) \
- (!DIFF_FILE_VALID((p)->one) && !DIFF_FILE_VALID((p)->two))
+#define DIFF_PAIR_UNMERGED(p) ((p)->is_unmerged)
#define DIFF_PAIR_RENAME(p) ((p)->renamed_pair)