1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-23 10:16:08 +02:00

log -L: test merge of parallel modify/rename

This tests a toy example of a history like

  * Merge
  | \
  |  * Modify foo
  |  |
  *  | Rename foo->bar
  | /
  * Create foo

Current log -L fails on this; we'll fix it in the next commit.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Thomas Rast 2013-04-12 18:05:10 +02:00 committed by Junio C Hamano
parent 035ff3987b
commit d51c5274e4
3 changed files with 250 additions and 6 deletions

View File

@ -8,13 +8,20 @@ test_expect_success 'setup (import history)' '
git reset --hard
'
canned_test () {
test_expect_success "$1" "
git log $1 >actual &&
test_cmp \"\$TEST_DIRECTORY\"/t4211/expect.$2 actual
canned_test_1 () {
test_expect_$1 "$2" "
git log $2 >actual &&
test_cmp \"\$TEST_DIRECTORY\"/t4211/expect.$3 actual
"
}
canned_test () {
canned_test_1 success "$@"
}
canned_test_failure () {
canned_test_1 failure "$@"
}
test_bad_opts () {
test_expect_success "invalid args: $1" "
test_must_fail git log $1 2>errors &&
@ -38,6 +45,7 @@ canned_test "-L '/long f/',/^}/:a.c -L /main/,/^}/:a.c simple" two-ranges
canned_test "-L 24,+1:a.c simple" vanishes-early
canned_test "-M -L '/long f/,/^}/:b.c' move-support" move-support-f
canned_test_failure "-M -L ':f:b.c' parallel-change" parallel-change-f-to-main
canned_test "-L 4,12:a.c -L :main:a.c simple" multiple
canned_test "-L 4,18:a.c -L :main:a.c simple" multiple-overlapping

View File

@ -0,0 +1,160 @@
commit 0469c60bc4837d52d97b1f081dec5f98dea20fed
Merge: ba227c6 6ce3c4f
Author: Thomas Rast <trast@inf.ethz.ch>
Date: Fri Apr 12 16:16:24 2013 +0200
Merge across the rename
commit 6ce3c4ff690136099bb17e1a8766b75764726ea7
Author: Thomas Rast <trast@student.ethz.ch>
Date: Thu Feb 28 10:49:50 2013 +0100
another simple change
diff --git a/b.c b/b.c
--- a/b.c
+++ b/b.c
@@ -4,14 +4,14 @@
long f(long x)
{
int s = 0;
while (x) {
- x >>= 1;
+ x /= 2;
s++;
}
return s;
}
/*
* This is only an example!
*/
commit ba227c6632349700fbb957dec2b50f5e2358be3f
Author: Thomas Rast <trast@inf.ethz.ch>
Date: Fri Apr 12 16:15:57 2013 +0200
change on another line of history while rename happens
diff --git a/a.c b/a.c
--- a/a.c
+++ b/a.c
@@ -4,14 +4,14 @@
long f(long x)
{
int s = 0;
while (x) {
x >>= 1;
s++;
}
return s;
}
/*
- * This is only an example!
+ * This is only a short example!
*/
commit 39b6eb2d5b706d3322184a169f666f25ed3fbd00
Author: Thomas Rast <trast@student.ethz.ch>
Date: Thu Feb 28 10:45:41 2013 +0100
touch comment
diff --git a/a.c b/a.c
--- a/a.c
+++ b/a.c
@@ -3,14 +3,14 @@
long f(long x)
{
int s = 0;
while (x) {
x >>= 1;
s++;
}
return s;
}
/*
- * A comment.
+ * This is only an example!
*/
commit a6eb82647d5d67f893da442f8f9375fd89a3b1e2
Author: Thomas Rast <trast@student.ethz.ch>
Date: Thu Feb 28 10:45:16 2013 +0100
touch both functions
diff --git a/a.c b/a.c
--- a/a.c
+++ b/a.c
@@ -3,14 +3,14 @@
-int f(int x)
+long f(long x)
{
int s = 0;
while (x) {
x >>= 1;
s++;
}
return s;
}
/*
* A comment.
*/
commit f04fb20f2c77850996cba739709acc6faecc58f7
Author: Thomas Rast <trast@student.ethz.ch>
Date: Thu Feb 28 10:44:55 2013 +0100
change f()
diff --git a/a.c b/a.c
--- a/a.c
+++ b/a.c
@@ -3,13 +3,14 @@
int f(int x)
{
int s = 0;
while (x) {
x >>= 1;
s++;
}
+ return s;
}
/*
* A comment.
*/
commit de4c48ae814792c02a49c4c3c0c757ae69c55f6a
Author: Thomas Rast <trast@student.ethz.ch>
Date: Thu Feb 28 10:44:48 2013 +0100
initial
diff --git a/a.c b/a.c
--- /dev/null
+++ b/a.c
@@ -0,0 +3,13 @@
+int f(int x)
+{
+ int s = 0;
+ while (x) {
+ x >>= 1;
+ s++;
+ }
+}
+
+/*
+ * A comment.
+ */
+

View File

@ -325,6 +325,82 @@ move within the file
from :17
M 100644 :18 b.c
reset refs/heads/master
from :19
blob
mark :20
data 243
#include <unistd.h>
#include <stdio.h>
long f(long x)
{
int s = 0;
while (x) {
x >>= 1;
s++;
}
return s;
}
/*
* This is only a short example!
*/
int main ()
{
printf("%ld\n", f(15));
return 0;
}
/* incomplete lines are bad! */
commit refs/heads/parallel-change
mark :21
author Thomas Rast <trast@inf.ethz.ch> 1365776157 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1365776157 +0200
data 55
change on another line of history while rename happens
from :14
M 100644 :20 a.c
blob
mark :22
data 242
#include <unistd.h>
#include <stdio.h>
long f(long x)
{
int s = 0;
while (x) {
x /= 2;
s++;
}
return s;
}
/*
* This is only a short example!
*/
int main ()
{
printf("%ld\n", f(15));
return 0;
}
/* incomplete lines are bad! */
commit refs/heads/parallel-change
mark :23
author Thomas Rast <trast@inf.ethz.ch> 1365776184 +0200
committer Thomas Rast <trast@inf.ethz.ch> 1365776191 +0200
data 24
Merge across the rename
from :21
merge :17
D a.c
M 100644 :22 b.c
reset refs/heads/parallel-change
from :23