[PATCH] add test for 'git rebase --keep-empty'

Subsystems: the rest

STALE3719d

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

[PATCH] add test for 'git rebase --keep-empty'

From: Martin von Zweigbergk <hidden>
Date: 2016-06-15 22:54:26

Signed-off-by: Martin von Zweigbergk <redacted>
---

While trying to use patch-id instead of
--ignore-if-in-upstream/--cherry-pick/cherry/etc, I noticed that
patch-id ignores empty patches and I was surprised that tests still
pass. This test case would be useful to protect --keep-empty.

 t/t3401-rebase-partial.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh
index 7f8693b..b89b512 100755
--- a/t/t3401-rebase-partial.sh
+++ b/t/t3401-rebase-partial.sh
@@ -47,7 +47,14 @@ test_expect_success 'rebase ignores empty commit' '
 	git commit --allow-empty -m empty &&
 	test_commit D &&
 	git rebase C &&
-	test $(git log --format=%s C..) = "D"
+	test "$(git log --format=%s C..)" = "D"
+'
+
+test_expect_success 'rebase --keep-empty' '
+	git reset --hard D &&
+	git rebase --keep-empty C &&
+	test "$(git log --format=%s C..)" = "D
+empty"
 '
 
 test_done
-- 
1.7.11.1.104.ge7b44f1

Re: [PATCH] add test for 'git rebase --keep-empty'

From: Neil Horman <nhorman@tuxdriver.com>
Date: 2016-06-15 22:54:26

On Wed, Aug 08, 2012 at 09:48:18AM -0700, Martin von Zweigbergk wrote:
quoted hunk
Signed-off-by: Martin von Zweigbergk <redacted>
---

While trying to use patch-id instead of
--ignore-if-in-upstream/--cherry-pick/cherry/etc, I noticed that
patch-id ignores empty patches and I was surprised that tests still
pass. This test case would be useful to protect --keep-empty.

 t/t3401-rebase-partial.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh
index 7f8693b..b89b512 100755
--- a/t/t3401-rebase-partial.sh
+++ b/t/t3401-rebase-partial.sh
@@ -47,7 +47,14 @@ test_expect_success 'rebase ignores empty commit' '
 	git commit --allow-empty -m empty &&
 	test_commit D &&
 	git rebase C &&
-	test $(git log --format=%s C..) = "D"
+	test "$(git log --format=%s C..)" = "D"
+'
+
+test_expect_success 'rebase --keep-empty' '
+	git reset --hard D &&
+	git rebase --keep-empty C &&
+	test "$(git log --format=%s C..)" = "D
+empty"
 '
 
 test_done
-- 
1.7.11.1.104.ge7b44f1
Acked-by: Neil Horman <nhorman@tuxdriver.com>

[PATCH v2] add tests for 'git rebase --keep-empty'

From: Martin von Zweigbergk <hidden>
Date: 2016-06-15 22:54:27

Add test cases for 'git rebase --keep-empty' with and without an
"empty" commit already in upstream. The empty commit that is about to
be rebased should be kept in both cases.

Signed-off-by: Martin von Zweigbergk <redacted>
---

Added another test for when the upstream already has an empty
commit. The test case protects the current behavior; I just assume the
current behavior is what we want.

While writing the test case, I also noticed that an interrupted 'git
rebase --keep-empty' can not be continued 'git rebase --continue', but
instead needs 'git cherry-pick --continue'. I guess this shouldn't
really be surprising given that it's implemented in terms of
cherry-pick. This should be fixed once all the different kinds of
rebase use the same way of finding the commits to rebase, so I
wouldn't worry about fixing this specific problem right now.

 t/t3401-rebase-partial.sh | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh
index 7f8693b..58f4823 100755
--- a/t/t3401-rebase-partial.sh
+++ b/t/t3401-rebase-partial.sh
@@ -47,7 +47,23 @@ test_expect_success 'rebase ignores empty commit' '
 	git commit --allow-empty -m empty &&
 	test_commit D &&
 	git rebase C &&
-	test $(git log --format=%s C..) = "D"
+	test "$(git log --format=%s C..)" = "D"
+'
+
+test_expect_success 'rebase --keep-empty' '
+	git reset --hard D &&
+	git rebase --keep-empty C &&
+	test "$(git log --format=%s C..)" = "D
+empty"
+'
+
+test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' '
+	git reset --hard A &&
+	git commit --allow-empty -m also-empty &&
+	git rebase --keep-empty D &&
+	test "$(git log --format=%s A..)" = "also-empty
+D
+empty"
 '
 
 test_done
-- 
1.7.11.1.104.ge7b44f1

Re: [PATCH v2] add tests for 'git rebase --keep-empty'

From: Neil Horman <nhorman@tuxdriver.com>
Date: 2016-06-15 22:54:27

On Thu, Aug 09, 2012 at 08:39:51AM -0700, Martin von Zweigbergk wrote:
Add test cases for 'git rebase --keep-empty' with and without an
"empty" commit already in upstream. The empty commit that is about to
be rebased should be kept in both cases.

Signed-off-by: Martin von Zweigbergk <redacted>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
quoted hunk
---

Added another test for when the upstream already has an empty
commit. The test case protects the current behavior; I just assume the
current behavior is what we want.

While writing the test case, I also noticed that an interrupted 'git
rebase --keep-empty' can not be continued 'git rebase --continue', but
instead needs 'git cherry-pick --continue'. I guess this shouldn't
really be surprising given that it's implemented in terms of
cherry-pick. This should be fixed once all the different kinds of
rebase use the same way of finding the commits to rebase, so I
wouldn't worry about fixing this specific problem right now.

 t/t3401-rebase-partial.sh | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh
index 7f8693b..58f4823 100755
--- a/t/t3401-rebase-partial.sh
+++ b/t/t3401-rebase-partial.sh
@@ -47,7 +47,23 @@ test_expect_success 'rebase ignores empty commit' '
 	git commit --allow-empty -m empty &&
 	test_commit D &&
 	git rebase C &&
-	test $(git log --format=%s C..) = "D"
+	test "$(git log --format=%s C..)" = "D"
+'
+
+test_expect_success 'rebase --keep-empty' '
+	git reset --hard D &&
+	git rebase --keep-empty C &&
+	test "$(git log --format=%s C..)" = "D
+empty"
+'
+
+test_expect_success 'rebase --keep-empty keeps empty even if already in upstream' '
+	git reset --hard A &&
+	git commit --allow-empty -m also-empty &&
+	git rebase --keep-empty D &&
+	test "$(git log --format=%s A..)" = "also-empty
+D
+empty"
 '
 
 test_done
-- 
1.7.11.1.104.ge7b44f1

RE: [PATCH v2] add tests for 'git rebase --keep-empty'

From: Joachim Schmitz <hidden>
Date: 2016-06-15 22:54:27

Hi folks

I'm a brand new subscriper of this mailing list, so please forgive if I
violate some protocol or talk about things that had been discussed to death
earlier.

I'm currently in the process of porting git (1.7.11.4 for now) to the HP
NonStop platform and found several issues:

- HP NonStop is lacking poll(), git is making quite some use of it.
My Solution: I 'stole' the implementation from GNUlib, which implements
poll() using select().
Git should either provide its own poll(), not use it at all or resort to
using GNUlib, what do you think?.

- HP NonStop is lacking getrlimit(), fsync(), setitimer() and memory mapped
IO.
For now I've commented out the part that used getrlimit() and use a home
brewed implementation for fsync(), setitimer() and mmap().

- git makes use of some C99 features or at least feature that are not
availabe in C89, like 'inline'
C89 is the default compiler on HP NonStop, but we also habe a c99 compiler,
so telling configure to search for c99  should help here.

- libintl and libiconv sem to get linked in the wrong order, resulting in
unresolved symbols.
I've just moved the "ifndef NO_GETTEXT" section of Makefile to above the
"ifdef NEEDS_LIBICONF" section.

- HP NonStop doesn't have stat.st_blocks, this is used in
builtin/count-objects.c around line 45, not sure yet how to fix that.

- HP NonStop doesn't have stat.st_?time.nsec, there are several places what
an "#ifdef USE_NSEC" is missing, I can provide a diff if needed (offending
files: builtin/fetch-pack.c and read-cache.c). 

- HP NonStop doesn't know SA_RESTART
I fixed that with a "#define SA_RESTART 0" in the 3 files affected
(builtin/log.c, fast-import.c and progress.c)

- using C99 but not using #include <strings.h> results in compiler errors
due to a missing prototype for strcasecmp()
I fixed it by adding that to git-compat-util.h

- HP NonStop doesn't have intptr_t and uintpr_t (in its stdint.h)
I added them to git-compat-util.h

- HP NonStop doesn't need the " #define _XOPEN_SOURCE 600", just like
__APPLE__, __FreeBSD__ etc, so I added a "&& !defined(__TANDEM) in
git-compat-util.h

- there seems to be an issue with compat/fnmatch/fnmatch.c not including
string.h, seems that HAVE_STRING_H is not #define'd anywhere.


- Once compiled and installed, a simple 
jojo@\hpitug:/home/jojo/GitHub $ git clone git://github.com/git/git.git
fails with:
/home/jojo/GitHub/git/.git/branches/: No such file or directory
After creating those manually it fails because the directory isn't empty,
catch-22
After some trial'n'error I found that the culprit seems to be the
subdirectories branches, hook and info in
/usr/local/share/git-core/templates/, if I remove/rename those, the above
command works fine.
I have no idea why that is nor how to properly fix it, anyone out there?

Bye, Jojo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help