Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342044 - New[Client]Git status merge test cases
Summary: New[Client]Git status merge test cases
Status: CLOSED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Client (show other bugs)
Version: 0.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.2   Edit
Assignee: libing wang CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 343198
Blocks:
  Show dependency tree
 
Reported: 2011-04-06 12:20 EDT by libing wang CLA
Modified: 2011-09-01 11:42 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description libing wang CLA 2011-04-06 12:20:46 EDT
I am opening this bug to track all the possible test cases corresponding to bug 339045.
As there is no agreement yet about how the server side will support the merge , the test cases are not yet applied to JS unit tests but some steps will be translated t ojs unit test later.

The test cases are based on two repos:
1.repo1 is the initial git repo and has a file called file.txt with contents as below
line one
line two by repo1
line three
line four

2.repo2 is the clone of repo1

I am writing test case 1 to address all the current problems happened internally.More cases will come afterward.

Test case 1 : changing the same line on both repo
Steps:
1.In repo1 at Orion, change "line two" into "line two by repo1".Save and commit.
2.In repo2 at Orion, change "line two" into "line two by repo2".Save and commit. 
3.In repo2 at git bash , do git pull , get the following:
Auto-merging file.txt
CONFLICT (content): Merge conflict in file.txt
Automatic merge failed; fix conflicts and then commit the result.
** I think this step is reasonable as we should not stop users from using combination of Orion git and git command even we will have git pull support.
4.Go to git status page for repo2

Expected result:
1.file.txt is marked as conflicted in the unstaged area.
2.Clicking on file.txt brings inline viewer with conflicts colored specially (red?)

Actual result:
In the unstaged area , file.txt appears twice , marked as removed and modified.
In the staged area ,file.txt appears twice as , marked as added and changed.
Clicking on the file brings error because there was already something wrong at the first place.

What happened behind the scene:
**The file content at repo2 is:
line one
<<<<<<< HEAD
line two by repo2
=======
line two by repo1
>>>>>>> 3cb9a690f9f6f9d95ee979045ffd4d48f7a0237c
line three
line four

**The git status response is :
{
  "Added": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/T/file.txt",
      "DiffLocation": "http://localhost:8080/git/diff/Default/file/T/file.txt",
      "IndexLocation": "http://localhost:8080/git/index/file/T/file.txt"
    },
    "Location": "http://localhost:8080/file/T/file.txt",
    "Name": "file.txt",
    "Path": "file.txt"
  }],
  "Changed": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/T/file.txt",
      "DiffLocation": "http://localhost:8080/git/diff/Cached/file/T/file.txt",
      "IndexLocation": "http://localhost:8080/git/index/file/T/file.txt"
    },
    "Location": "http://localhost:8080/file/T/file.txt",
    "Name": "file.txt",
    "Path": "file.txt"
  }],
  "Missing": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/T/file.txt",
      "DiffLocation": "http://localhost:8080/git/diff/Default/file/T/file.txt",
      "IndexLocation": "http://localhost:8080/git/index/file/T/file.txt"
    },
    "Location": "http://localhost:8080/file/T/file.txt",
    "Name": "file.txt",
    "Path": "file.txt"
  }],
  "Modified": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/T/file.txt",
      "DiffLocation": "http://localhost:8080/git/diff/Default/file/T/file.txt",
      "IndexLocation": "http://localhost:8080/git/index/file/T/file.txt"
    },
    "Location": "http://localhost:8080/file/T/file.txt",
    "Name": "file.txt",
    "Path": "file.txt"
  }],
  "Removed": [],
  "Untracked": []
}

**Diff content on /git/diff/Default/file/T/file.txt
diff --git a/file.txt b/file.txt
index 4a75dc8..47965b5 100644
--- a/file.txt
+++ b/file.txt
@@ -1,4 +1,8 @@
 line one
-line two
+<<<<<<< HEAD
+line two by repo2
+=======
+line two by repo1
+>>>>>>> 3cb9a690f9f6f9d95ee979045ffd4d48f7a0237c
 line three
 line four
diff --git a/file.txt b/file.txt
deleted file mode 100644
index 820b77e..0000000
--- a/file.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-line one
-line two by repo2
-line three
-line four
diff --git a/file.txt b/file.txt
deleted file mode 100644
index 3ba1817..0000000
--- a/file.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-line one
-line two by repo1
-line three
-line four

**Diff content on /git/diff/Cached/file/T/file.txt
diff --git a/file.txt b/file.txt
index 820b77e..4a75dc8 100644
--- a/file.txt
+++ b/file.txt
@@ -1,4 +1,4 @@
 line one
-line two by repo2
+line two
 line three
 line four
diff --git a/file.txt b/file.txt
new file mode 100644
index 0000000..820b77e
--- /dev/null
+++ b/file.txt
@@ -0,0 +1,4 @@
+line one
+line two by repo2
+line three
+line four
diff --git a/file.txt b/file.txt
new file mode 100644
index 0000000..3ba1817
--- /dev/null
+++ b/file.txt
@@ -0,0 +1,4 @@
+line one
+line two by repo1
+line three
+line four
Comment 1 libing wang CLA 2011-04-07 11:14:04 EDT
bug 342179 is opened against server side for test case1.
Comment 2 libing wang CLA 2011-04-18 12:58:36 EDT
Test case 2 : modify on remote and delete on local
1.Created file2.js in repo1 and commit :
line 1
line 2

2.Pull file2.js into repo2
3.On repo 1 , change "line 2" to "line 2 by remote" , commit
4.On repo 2, delete file2.js and commit
5.Use git pull on repo 2.
6.Conflicts happened

*** file content in repo 2 now is 
line 1 
line 2 by remote


*** git status response 
{
  "Added": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/V/file2.js",
      "DiffLocation": "http://localhost:8080/git/diff/Default/file/V/file2.js",
      "IndexLocation": "http://localhost:8080/git/index/file/V/file2.js"
    },
    "Location": "http://localhost:8080/file/V/file2.js",
    "Name": "file2.js",
    "Path": "file2.js"
  }],
  "Changed": [],
  "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/V/",
  "IndexLocation": "http://localhost:8080/git/index/file/V/",
  "Missing": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/V/file2.js",
      "DiffLocation": "http://localhost:8080/git/diff/Default/file/V/file2.js",
      "IndexLocation": "http://localhost:8080/git/index/file/V/file2.js"
    },
    "Location": "http://localhost:8080/file/V/file2.js",
    "Name": "file2.js",
    "Path": "file2.js"
  }],
  "Modified": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/V/file2.js",
      "DiffLocation": "http://localhost:8080/git/diff/Default/file/V/file2.js",
      "IndexLocation": "http://localhost:8080/git/index/file/V/file2.js"
    },
    "Location": "http://localhost:8080/file/V/file2.js",
    "Name": "file2.js",
    "Path": "file2.js"
  }],
  "Removed": [],
  "Untracked": []
}

***Diff response 
diff --git a/file2.js b/file2.js
index fa352fa..7fc7ae1 100644
--- a/file2.js
+++ b/file2.js
@@ -1,2 +1,2 @@
 line 1 
-line 2
+line 2 by remote
diff --git a/file2.js b/file2.js
deleted file mode 100644
index 7fc7ae1..0000000
--- a/file2.js
+++ /dev/null
@@ -1,2 +0,0 @@
-line 1 
-line 2 by remote
Comment 3 libing wang CLA 2011-04-18 13:22:01 EDT
Test case 3 : delete on remote and modified on local
1.Created file3.js in repo1 and commit :
line 1
line 2

2.Pull file2.js into repo2
3.On repo 1 , delete file3.js and commit
4.On repo 2, change "line 2" to "line 2 by 2" , commit
5.Use git pull on repo 2.
6.Conflicts happened

**The git status response is :
{
  "Added": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/V/file3.js",
      "DiffLocation": "http://localhost:8080/git/diff/Default/file/V/file3.js",
      "IndexLocation": "http://localhost:8080/git/index/file/V/file3.js"
    },
    "Location": "http://localhost:8080/file/V/file3.js",
    "Name": "file3.js",
    "Path": "file3.js"
  }],
  "Changed": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/V/file3.js",
      "DiffLocation": "http://localhost:8080/git/diff/Cached/file/V/file3.js",
      "IndexLocation": "http://localhost:8080/git/index/file/V/file3.js"
    },
    "Location": "http://localhost:8080/file/V/file3.js",
    "Name": "file3.js",
    "Path": "file3.js"
  }],
  "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/V/",
  "IndexLocation": "http://localhost:8080/git/index/file/V/",
  "Missing": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/V/file3.js",
      "DiffLocation": "http://localhost:8080/git/diff/Default/file/V/file3.js",
      "IndexLocation": "http://localhost:8080/git/index/file/V/file3.js"
    },
    "Location": "http://localhost:8080/file/V/file3.js",
    "Name": "file3.js",
    "Path": "file3.js"
  }],
  "Modified": [{
    "Git": {
      "CommitLocation": "http://localhost:8080/git/commit/HEAD/file/V/file3.js",
      "DiffLocation": "http://localhost:8080/git/diff/Default/file/V/file3.js",
      "IndexLocation": "http://localhost:8080/git/index/file/V/file3.js"
    },
    "Location": "http://localhost:8080/file/V/file3.js",
    "Name": "file3.js",
    "Path": "file3.js"
  }],
  "Removed": [],
  "Untracked": []
}

*** response from /git/diff/Default/file/V/file3.js
diff --git a/file3.js b/file3.js
index 7330f3a..eb0dfc5 100644
--- a/file3.js
+++ b/file3.js
@@ -1,2 +1,2 @@
 line 1
-line 2
+line 2 by 2
diff --git a/file3.js b/file3.js
deleted file mode 100644
index eb0dfc5..0000000
--- a/file3.js
+++ /dev/null
@@ -1,2 +0,0 @@
-line 1
-line 2 by 2

*** response from /git/diff/Cached/file/V/file3.js
diff --git a/file3.js b/file3.js
index eb0dfc5..7330f3a 100644
--- a/file3.js
+++ b/file3.js
@@ -1,2 +1,2 @@
 line 1
-line 2 by 2
+line 2
diff --git a/file3.js b/file3.js
new file mode 100644
index 0000000..eb0dfc5
--- /dev/null
+++ b/file3.js
@@ -0,0 +1,2 @@
+line 1
+line 2 by 2
Comment 4 libing wang CLA 2011-06-02 11:40:10 EDT
Closing this as all cases are addressed in http://wiki.eclipse.org/Orion/Manual_Test_Cases#Resolve_merge_conflicts