Re: [PATCH 3/4] Added tests for the case of merged and unmerged entries for the same file

2014-08-21 Thread Jaime Soriano Pastor
On Wed, Aug 20, 2014 at 11:00 PM, Junio C Hamano gits...@pobox.com wrote:
 Jaime Soriano Pastor jsorianopas...@gmail.com writes:

 Signed-off-by: Jaime Soriano Pastor jsorianopas...@gmail.com
 ---
  t/t9904-unmerged-file-with-merged-entry.sh | 86 
 ++

 Isn't this number already used for another test?  A test on the
 index probably belongs to t2XXX or t3XXX family.

Umm, I though this test number was free, I just added it to the last+1
position, if I finally add a test I'll take this into account. Thanks.

  1 file changed, 86 insertions(+)
  create mode 100755 t/t9904-unmerged-file-with-merged-entry.sh

 diff --git a/t/t9904-unmerged-file-with-merged-entry.sh 
 b/t/t9904-unmerged-file-with-merged-entry.sh
 new file mode 100755
 index 000..945bc1c
 --- /dev/null
 +++ b/t/t9904-unmerged-file-with-merged-entry.sh
 @@ -0,0 +1,86 @@
 +#!/bin/sh
 +
 +test_description='Operations with unmerged files with merged entries'
 +
 +. ./test-lib.sh
 +
 +setup_repository() {
 + test_commit A conflict A
 + test_commit A conflict2 A2 branchbase
 + test_commit B conflict B
 + test_commit B conflict2 B2
 + git checkout branchbase -b branch1
 + test_commit C conflict C
 + test_commit C conflict2 C2
 + test_commit something otherfile otherfile
 +}

 No error is checked here?

This is only a helper function for setup, not a test itself.

 +setup_stage_state() {
 + git checkout -f HEAD
 + {
 + git ls-files -s conflict conflict2
 + git merge master  /dev/null
 + git ls-files -s conflict conflict2
 + }  index

 No error is checked here?

Same here.

 Style: no SP between redirection operator and its target, i.e.

 git merge master /dev/null
 { ... } index

 + cat index | git update-index --index-info

 Do not cat a single file into a pipeline, i.e.

 git update-index --index-info index

True :) Thanks.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] Added tests for the case of merged and unmerged entries for the same file

2014-08-21 Thread Junio C Hamano
Jaime Soriano Pastor jsorianopas...@gmail.com writes:

 On Wed, Aug 20, 2014 at 11:00 PM, Junio C Hamano gits...@pobox.com wrote:
 Jaime Soriano Pastor jsorianopas...@gmail.com writes:

 Signed-off-by: Jaime Soriano Pastor jsorianopas...@gmail.com
 ---
  t/t9904-unmerged-file-with-merged-entry.sh | 86 
 ++

 Isn't this number already used for another test?  A test on the
 index probably belongs to t2XXX or t3XXX family.

 Umm, I though this test number was free, I just added it to the last+1
 position, if I finally add a test I'll take this into account. Thanks.

Please check t/README for classes of features and appropriate first
digit; also do not forget that there are topics by other people in
flight and you may need to at least check with the tip of the 'pu'
branch.

Thanks.

  1 file changed, 86 insertions(+)
  create mode 100755 t/t9904-unmerged-file-with-merged-entry.sh

 diff --git a/t/t9904-unmerged-file-with-merged-entry.sh 
 b/t/t9904-unmerged-file-with-merged-entry.sh
 new file mode 100755
 index 000..945bc1c
 --- /dev/null
 +++ b/t/t9904-unmerged-file-with-merged-entry.sh
 @@ -0,0 +1,86 @@
 +#!/bin/sh
 +
 +test_description='Operations with unmerged files with merged entries'
 +
 +. ./test-lib.sh
 +
 +setup_repository() {
 +...
 +}

 No error is checked here?

 This is only a helper function for setup, not a test itself.

So what?  If the set-up fails, we would want

$ sh t-my-test.sh -i

to immediately stop without going further.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] Added tests for the case of merged and unmerged entries for the same file

2014-08-20 Thread Jaime Soriano Pastor
Signed-off-by: Jaime Soriano Pastor jsorianopas...@gmail.com
---
 t/t9904-unmerged-file-with-merged-entry.sh | 86 ++
 1 file changed, 86 insertions(+)
 create mode 100755 t/t9904-unmerged-file-with-merged-entry.sh

diff --git a/t/t9904-unmerged-file-with-merged-entry.sh 
b/t/t9904-unmerged-file-with-merged-entry.sh
new file mode 100755
index 000..945bc1c
--- /dev/null
+++ b/t/t9904-unmerged-file-with-merged-entry.sh
@@ -0,0 +1,86 @@
+#!/bin/sh
+
+test_description='Operations with unmerged files with merged entries'
+
+. ./test-lib.sh
+
+setup_repository() {
+   test_commit A conflict A
+   test_commit A conflict2 A2 branchbase
+   test_commit B conflict B
+   test_commit B conflict2 B2
+   git checkout branchbase -b branch1
+   test_commit C conflict C
+   test_commit C conflict2 C2
+   test_commit something otherfile otherfile
+}
+
+setup_stage_state() {
+   git checkout -f HEAD
+   {
+   git ls-files -s conflict conflict2
+   git merge master  /dev/null
+   git ls-files -s conflict conflict2
+   }  index
+   cat index | git update-index --index-info
+   rm index
+}
+
+test_expect_success 'setup - two branches with conflicting files' '
+   setup_repository 
+   setup_stage_state 
+   git ls-files -s conflict  output 
+   test_line_count = 4 output 
+   git ls-files -s conflict2  output 
+   test_line_count = 4 output 
+   rm output
+'
+
+test_expect_success 'git commit -a' '
+   setup_stage_state 
+   test_must_fail git commit -a
+'
+
+test_expect_success 'git add conflict' '
+   setup_stage_state 
+   test_must_fail git add conflict
+'
+
+test_expect_success 'git rm conflict' '
+   setup_stage_state 
+   test_must_fail git rm conflict
+'
+
+test_expect_success 'git add otherfile' '
+   setup_stage_state 
+   otherfile 
+   git add otherfile
+'
+
+test_expect_success 'git rm otherfile' '
+   setup_stage_state 
+   git rm otherfile
+'
+
+test_expect_success 'git add newfile' '
+   setup_stage_state 
+   newfile 
+   git add newfile
+'
+
+test_expect_success 'git merge branch' '
+   setup_stage_state 
+   test_must_fail git merge master
+'
+
+test_expect_success 'git reset --hard' '
+   setup_stage_state 
+   git reset --hard 
+   git show HEAD:conflict  expected 
+   cat conflict  current 
+   git show HEAD:conflict2  expected 
+   cat conflict2  current 
+   test_cmp expected current
+'
+
+test_done
-- 
2.0.4.4.gaf54b2b

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] Added tests for the case of merged and unmerged entries for the same file

2014-08-20 Thread Junio C Hamano
Jaime Soriano Pastor jsorianopas...@gmail.com writes:

 Signed-off-by: Jaime Soriano Pastor jsorianopas...@gmail.com
 ---
  t/t9904-unmerged-file-with-merged-entry.sh | 86 
 ++

Isn't this number already used for another test?  A test on the
index probably belongs to t2XXX or t3XXX family.

  1 file changed, 86 insertions(+)
  create mode 100755 t/t9904-unmerged-file-with-merged-entry.sh

 diff --git a/t/t9904-unmerged-file-with-merged-entry.sh 
 b/t/t9904-unmerged-file-with-merged-entry.sh
 new file mode 100755
 index 000..945bc1c
 --- /dev/null
 +++ b/t/t9904-unmerged-file-with-merged-entry.sh
 @@ -0,0 +1,86 @@
 +#!/bin/sh
 +
 +test_description='Operations with unmerged files with merged entries'
 +
 +. ./test-lib.sh
 +
 +setup_repository() {
 + test_commit A conflict A
 + test_commit A conflict2 A2 branchbase
 + test_commit B conflict B
 + test_commit B conflict2 B2
 + git checkout branchbase -b branch1
 + test_commit C conflict C
 + test_commit C conflict2 C2
 + test_commit something otherfile otherfile
 +}

No error is checked here?

 +setup_stage_state() {
 + git checkout -f HEAD
 + {
 + git ls-files -s conflict conflict2
 + git merge master  /dev/null
 + git ls-files -s conflict conflict2
 + }  index

No error is checked here?

Style: no SP between redirection operator and its target, i.e.

git merge master /dev/null
{ ... } index

 + cat index | git update-index --index-info

Do not cat a single file into a pipeline, i.e.

git update-index --index-info index


Thanks.
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html