summaryrefslogtreecommitdiff
path: root/git-rerere.perl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2006-12-08 21:29:55 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-12-09 19:09:27 (GMT)
commitd9671b75ad3bbf2f95f11a8571e9beaa12ccf6dd (patch)
tree77927d02162907505221d58d57c0af972fb6a1cd /git-rerere.perl
parent4cfeccc75d6ab1ccc433770bac6bf3b15ab486d6 (diff)
downloadgit-d9671b75ad3bbf2f95f11a8571e9beaa12ccf6dd.zip
git-d9671b75ad3bbf2f95f11a8571e9beaa12ccf6dd.tar.gz
git-d9671b75ad3bbf2f95f11a8571e9beaa12ccf6dd.tar.bz2
rerere: add clear, diff, and status commands
git-am and git-rebase will be updated to use 'clear', and diff/status can be used to aid the user in tracking progress in the resolution process. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-rerere.perl')
-rwxr-xr-xgit-rerere.perl32
1 files changed, 32 insertions, 0 deletions
diff --git a/git-rerere.perl b/git-rerere.perl
index d3664ff..b2550bb 100755
--- a/git-rerere.perl
+++ b/git-rerere.perl
@@ -172,6 +172,38 @@ sub merge {
-d "$rr_dir" || exit(0);
read_rr();
+
+if (@ARGV) {
+ my $arg = shift @ARGV;
+ if ($arg eq 'clear') {
+ for my $path (keys %merge_rr) {
+ my $name = $merge_rr{$path};
+ if (-d "$rr_dir/$name" &&
+ ! -f "$rr_dir/$name/postimage") {
+ rmtree(["$rr_dir/$name"]);
+ }
+ }
+ unlink $merge_rr;
+ }
+ elsif ($arg eq 'status') {
+ for my $path (keys %merge_rr) {
+ print $path, "\n";
+ }
+ }
+ elsif ($arg eq 'diff') {
+ for my $path (keys %merge_rr) {
+ my $name = $merge_rr{$path};
+ system('diff', ((@ARGV == 0) ? ('-u') : @ARGV),
+ '-L', "a/$path", '-L', "b/$path",
+ "$rr_dir/$name/preimage", $path);
+ }
+ }
+ else {
+ die "$0 unknown command: $arg\n";
+ }
+ exit 0;
+}
+
my %conflict = map { $_ => 1 } find_conflict();
# MERGE_RR records paths with conflicts immediately after merge