Git development
 help / color / mirror / Atom feed
* [EGIT PATCH] Throw created exception
From: Robin Rosenberg @ 2009-01-27 22:11 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../org/spearce/jgit/lib/UnpackedObjectLoader.java |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/UnpackedObjectLoader.java b/org.spearce.jgit/src/org/spearce/jgit/lib/UnpackedObjectLoader.java
index 0560c3a..f2cae87 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/UnpackedObjectLoader.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/UnpackedObjectLoader.java
@@ -89,7 +89,7 @@ public UnpackedObjectLoader(final Repository db, final AnyObjectId id)
 
 	/**
 	 * Construct an ObjectLoader from a loose object's compressed form.
-	 * 
+	 *
 	 * @param compressed
 	 *            entire content of the loose object file.
 	 * @throws CorruptObjectException
@@ -187,7 +187,7 @@ private void decompress(final AnyObjectId id, final Inflater inf, int p)
 			throw coe;
 		}
 		if (p != objectSize)
-			new CorruptObjectException(id, "incorrect length");
+			throw new CorruptObjectException(id, "incorrect length");
 	}
 
 	public int getType() {
-- 
1.6.1.285.g35d8b

^ permalink raw reply related

* Re: git-am annoyance
From: Junio C Hamano @ 2009-01-27 22:30 UTC (permalink / raw)
  To: sverre; +Cc: Git Mailinglist
In-Reply-To: <bd6139dc0901271407i4406d5e6u6db1df9e5a7bdc4f@mail.gmail.com>

Sverre Rabbelier <alturin@gmail.com> writes:

> Observe what happens if, on accident, rather than running a alias
> (amendall), the 'tab' didn't catch on:
> $ git am
> ^C

It wants to read from the stdin as "git am < mbox" is a valid usage.

A patch to detect that the input was killed with ^C and clean things up
would be welcome.  Also we may be able to detect "-t 0", too.

> $ # ok, now what do I do?

Here is one thing you could do.

    $ PS1=': $(__git_ps1 "%s"); '
    : master|AM/REBASE; 
    : master|AM/REBASE; git am --abort

But you are right.  We should be able to detect this.

I think it was just people who often use "am" are so used to correctly the
command that the state where no state files are created didn't happen
often and never reported the breakage.

^ permalink raw reply

* [PATCH v2 0/6] rebase simplifications
From: Johannes Schindelin @ 2009-01-27 22:34 UTC (permalink / raw)
  To: git, gitster
In-Reply-To: <7v7i4g31lj.fsf@gitster.siamese.dyndns.org>

Changes vs  v1:

removed the "rnyn" blurt (which probably marsk me as Alpine user...)

removed the SHELL_PATH handling; it is a miracle to me why it works, but 
I'd rather not meddle with the magic now that you pointed it out

Moved test_commit and test_merge into test-lib.sh

Fixed the quoting in test_commit and test_merge

AFAIR that's all...

Johannes Schindelin (6):
  t3404 & t3411: undo copy&paste
  lib-rebase.sh: Document what set_fake_editor() does
  test-lib.sh: introduce test_commit() and test_merge() helpers
  Simplify t3410
  Simplify t3411
  Simplify t3412

 t/README                                  |   18 ++++
 t/lib-rebase.sh                           |   48 +++++++++++
 t/t3404-rebase-interactive.sh             |   37 +--------
 t/t3410-rebase-preserve-dropped-merges.sh |  124 ++++++++---------------------
 t/t3411-rebase-preserve-around-merges.sh  |  103 +++++-------------------
 t/t3412-rebase-root.sh                    |   28 ++-----
 t/test-lib.sh                             |   26 ++++++
 7 files changed, 159 insertions(+), 225 deletions(-)
 create mode 100644 t/lib-rebase.sh

^ permalink raw reply

* [PATCH v2 1/6] t3404 & t3411: undo copy&paste
From: Johannes Schindelin @ 2009-01-27 22:34 UTC (permalink / raw)
  To: git, gitster
In-Reply-To: <7v7i4g31lj.fsf@gitster.siamese.dyndns.org>

Rather than copying and pasting, which is prone to lead to fixes
missing in one version, move the fake-editor generator to t/t3404/.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/lib-rebase.sh                          |   36 ++++++++++++++++++++++++++++
 t/t3404-rebase-interactive.sh            |   37 +++--------------------------
 t/t3411-rebase-preserve-around-merges.sh |   38 +++--------------------------
 3 files changed, 44 insertions(+), 67 deletions(-)
 create mode 100644 t/lib-rebase.sh

diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
new file mode 100644
index 0000000..762ffcf
--- /dev/null
+++ b/t/lib-rebase.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+set_fake_editor () {
+	echo "#!$SHELL_PATH" >fake-editor.sh
+	cat >> fake-editor.sh <<\EOF
+case "$1" in
+*/COMMIT_EDITMSG)
+	test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1"
+	test -z "$FAKE_COMMIT_AMEND" || echo "$FAKE_COMMIT_AMEND" >> "$1"
+	exit
+	;;
+esac
+test -z "$EXPECT_COUNT" ||
+	test "$EXPECT_COUNT" = $(sed -e '/^#/d' -e '/^$/d' < "$1" | wc -l) ||
+	exit
+test -z "$FAKE_LINES" && exit
+grep -v '^#' < "$1" > "$1".tmp
+rm -f "$1"
+cat "$1".tmp
+action=pick
+for line in $FAKE_LINES; do
+	case $line in
+	squash|edit)
+		action="$line";;
+	*)
+		echo sed -n "${line}s/^pick/$action/p"
+		sed -n "${line}p" < "$1".tmp
+		sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"
+		action=pick;;
+	esac
+done
+EOF
+
+	test_set_editor "$(pwd)/fake-editor.sh"
+	chmod a+x fake-editor.sh
+}
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index 2cc8e7a..3592403 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -10,6 +10,10 @@ that the result still makes sense.
 '
 . ./test-lib.sh
 
+. ../lib-rebase.sh
+
+set_fake_editor
+
 # set up two branches like this:
 #
 # A - B - C - D - E
@@ -61,39 +65,6 @@ test_expect_success 'setup' '
 	git tag I
 '
 
-echo "#!$SHELL_PATH" >fake-editor.sh
-cat >> fake-editor.sh <<\EOF
-case "$1" in
-*/COMMIT_EDITMSG)
-	test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1"
-	test -z "$FAKE_COMMIT_AMEND" || echo "$FAKE_COMMIT_AMEND" >> "$1"
-	exit
-	;;
-esac
-test -z "$EXPECT_COUNT" ||
-	test "$EXPECT_COUNT" = $(sed -e '/^#/d' -e '/^$/d' < "$1" | wc -l) ||
-	exit
-test -z "$FAKE_LINES" && exit
-grep -v '^#' < "$1" > "$1".tmp
-rm -f "$1"
-cat "$1".tmp
-action=pick
-for line in $FAKE_LINES; do
-	case $line in
-	squash|edit)
-		action="$line";;
-	*)
-		echo sed -n "${line}s/^pick/$action/p"
-		sed -n "${line}p" < "$1".tmp
-		sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"
-		action=pick;;
-	esac
-done
-EOF
-
-test_set_editor "$(pwd)/fake-editor.sh"
-chmod a+x fake-editor.sh
-
 test_expect_success 'no changes are a nop' '
 	git rebase -i F &&
 	test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
diff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh
index aacfaae..6a1586a 100755
--- a/t/t3411-rebase-preserve-around-merges.sh
+++ b/t/t3411-rebase-preserve-around-merges.sh
@@ -5,44 +5,14 @@
 
 test_description='git rebase preserve merges
 
-This test runs git rebase with and tries to squash a commit from after a merge
-to before the merge.
+This test runs git rebase with -p and tries to squash a commit from after
+a merge to before the merge.
 '
 . ./test-lib.sh
 
-# Copy/paste from t3404-rebase-interactive.sh
-echo "#!$SHELL_PATH" >fake-editor.sh
-cat >> fake-editor.sh <<\EOF
-case "$1" in
-*/COMMIT_EDITMSG)
-	test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1"
-	test -z "$FAKE_COMMIT_AMEND" || echo "$FAKE_COMMIT_AMEND" >> "$1"
-	exit
-	;;
-esac
-test -z "$EXPECT_COUNT" ||
-	test "$EXPECT_COUNT" = $(sed -e '/^#/d' -e '/^$/d' < "$1" | wc -l) ||
-	exit
-test -z "$FAKE_LINES" && exit
-grep -v '^#' < "$1" > "$1".tmp
-rm -f "$1"
-cat "$1".tmp
-action=pick
-for line in $FAKE_LINES; do
-	case $line in
-	squash|edit)
-		action="$line";;
-	*)
-		echo sed -n "${line}s/^pick/$action/p"
-		sed -n "${line}p" < "$1".tmp
-		sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"
-		action=pick;;
-	esac
-done
-EOF
+. ../lib-rebase.sh
 
-test_set_editor "$(pwd)/fake-editor.sh"
-chmod a+x fake-editor.sh
+set_fake_editor
 
 # set up two branches like this:
 #
-- 
1.6.1.482.g7d54be

^ permalink raw reply related

* [PATCH v2 2/6] lib-rebase.sh: Document what set_fake_editor() does
From: Johannes Schindelin @ 2009-01-27 22:34 UTC (permalink / raw)
  To: git, gitster
In-Reply-To: <7v7i4g31lj.fsf@gitster.siamese.dyndns.org>

Make it easy for other authors to use rebase tests' fake-editor.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/lib-rebase.sh |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
index 762ffcf..260a231 100644
--- a/t/lib-rebase.sh
+++ b/t/lib-rebase.sh
@@ -1,5 +1,17 @@
 #!/bin/sh
 
+# After setting the fake editor with this function, you can
+#
+# - override the commit message with $FAKE_COMMIT_MESSAGE,
+# - amend the commit message with $FAKE_COMMIT_AMEND
+# - check that non-commit messages have a certain line count with $EXPECT_COUNT
+# - rewrite a rebase -i script with $FAKE_LINES in the form
+#
+#	"[<lineno1>] [<lineno2>]..."
+#
+#   If a line number is prefixed with "squash" or "edit", the respective line's
+#   command will be replaced with the specified one.
+
 set_fake_editor () {
 	echo "#!$SHELL_PATH" >fake-editor.sh
 	cat >> fake-editor.sh <<\EOF
-- 
1.6.1.482.g7d54be

^ permalink raw reply related

* [PATCH v2 3/6] test-lib.sh: introduce test_commit() and test_merge() helpers
From: Johannes Schindelin @ 2009-01-27 22:34 UTC (permalink / raw)
  To: git, gitster
In-Reply-To: <7v7i4g31lj.fsf@gitster.siamese.dyndns.org>

Often we just need to add a commit with a given (short) name, that will
be tagged with the same name.  Now, relatively complicated graphs can be
constructed easily and in a clear fashion:

	test_commit A &&
	test_commit B &&
	git checkout A &&
	test_commit C &&
	test_merge D B

will construct this graph:

	A - B
	  \   \
	    C - D

For simplicity, files whose name is the lower case version of the commit
message (to avoid a warning about ambiguous names) will be committed, with
the corresponding commit messages as contents.

If you need to provide a different file/different contents, you can use
the more explicit form

	test_commit $MESSAGE $FILENAME $CONTENTS

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/README      |   18 ++++++++++++++++++
 t/test-lib.sh |   25 +++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/t/README b/t/README
index 8f12d48..f208cf1 100644
--- a/t/README
+++ b/t/README
@@ -212,6 +212,24 @@ library for your script to use.
    is to summarize successes and failures in the test script and
    exit with an appropriate error code.
 
+ - test_tick
+
+   Make commit and tag names consistent by setting the author and
+   committer times to defined stated.  Subsequent calls will
+   advance the times by a fixed amount.
+
+ - test_commit <message> [<filename> [<contents>]]
+
+   Creates a commit with the given message, committing the given
+   file with the given contents (default for both is to reuse the
+   message string), and adds a tag (again reusing the message
+   string as name).  Calls test_tick to make the SHA-1s
+   reproducible.
+
+ - test_merge <message> <commit-or-tag>
+
+   Merges the given rev using the given message.  Like test_commit,
+   creates a tag and calls test_tick before committing.
 
 Tips for Writing Tests
 ----------------------
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 41d5a59..c1839f7 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -193,6 +193,31 @@ test_tick () {
 	export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
 }
 
+# Call test_commit with the arguments "<message> [<file> [<contents>]]"
+#
+# This will commit a file with the given contents and the given commit
+# message.  It will also add a tag with <message> as name.
+#
+# Both <file> and <contents> default to <message>.
+
+test_commit () {
+	file=${2:-$(echo "$1" | tr 'A-Z' 'a-z')}
+	echo "${3-$1}" > "$file" &&
+	git add "$file" &&
+	test_tick &&
+	git commit -m "$1" &&
+	git tag "$1"
+}
+
+# Call test_merge with the arguments "<message> <commit>", where <commit>
+# can be a tag pointing to the commit-to-merge.
+
+test_merge () {
+	test_tick &&
+	git merge -m "$1" "$2" &&
+	git tag "$1"
+}
+
 # You are not expected to call test_ok_ and test_failure_ directly, use
 # the text_expect_* functions instead.
 
-- 
1.6.1.482.g7d54be

^ permalink raw reply related

* [PATCH v2 4/6] Simplify t3410
From: Johannes Schindelin @ 2009-01-27 22:34 UTC (permalink / raw)
  To: git, gitster
In-Reply-To: <7v7i4g31lj.fsf@gitster.siamese.dyndns.org>

Use test_commit() and test_merge(), reducing the code while making the
intent clearer.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t3410-rebase-preserve-dropped-merges.sh |  124 ++++++++---------------------
 1 files changed, 35 insertions(+), 89 deletions(-)

diff --git a/t/t3410-rebase-preserve-dropped-merges.sh b/t/t3410-rebase-preserve-dropped-merges.sh
index 5816415..c49143a 100755
--- a/t/t3410-rebase-preserve-dropped-merges.sh
+++ b/t/t3410-rebase-preserve-dropped-merges.sh
@@ -22,47 +22,17 @@ rewritten.
 # where B, D and G touch the same file.
 
 test_expect_success 'setup' '
-	: > file1 &&
-	git add file1 &&
-	test_tick &&
-	git commit -m A &&
-	git tag A &&
-	echo 1 > file1 &&
-	test_tick &&
-	git commit -m B file1 &&
-	: > file2 &&
-	git add file2 &&
-	test_tick &&
-	git commit -m C &&
-	echo 2 > file1 &&
-	test_tick &&
-	git commit -m D file1 &&
-	: > file3 &&
-	git add file3 &&
-	test_tick &&
-	git commit -m E &&
-	git tag E &&
-	git checkout -b branch1 A &&
-	: > file4 &&
-	git add file4 &&
-	test_tick &&
-	git commit -m F &&
-	git tag F &&
-	echo 3 > file1 &&
-	test_tick &&
-	git commit -m G file1 &&
-	git tag G &&
-	: > file5 &&
-	git add file5 &&
-	test_tick &&
-	git commit -m H &&
-	git tag H &&
-	git checkout -b branch2 F &&
-	: > file6 &&
-	git add file6 &&
-	test_tick &&
-	git commit -m I &&
-	git tag I
+	test_commit A file1 &&
+	test_commit B file1 1 &&
+	test_commit C file2 &&
+	test_commit D file1 2 &&
+	test_commit E file3 &&
+	git checkout A &&
+	test_commit F file4 &&
+	test_commit G file1 3 &&
+	test_commit H file5 &&
+	git checkout F &&
+	test_commit I file6
 '
 
 # A - B - C - D - E
@@ -72,68 +42,44 @@ test_expect_success 'setup' '
 #         I -- G2 -- J -- K           I -- K
 # G2 = same changes as G
 test_expect_success 'skip same-resolution merges with -p' '
-	git checkout branch1 &&
+	git checkout H &&
 	! git merge E &&
-	echo 23 > file1 &&
-	git add file1 &&
-	git commit -m L &&
-	git checkout branch2 &&
-	echo 3 > file1 &&
-	git commit -a -m G2 &&
+	test_commit L file1 23 &&
+	git checkout I &&
+	test_commit G2 file1 3 &&
 	! git merge E &&
-	echo 23 > file1 &&
-	git add file1 &&
-	git commit -m J &&
-	echo file7 > file7 &&
-	git add file7 &&
-	git commit -m K &&
-	GIT_EDITOR=: git rebase -i -p branch1 &&
-	test $(git rev-parse branch2^^) = $(git rev-parse branch1) &&
+	test_commit J file1 23 &&
+	test_commit K file7 file7 &&
+	git rebase -i -p L &&
+	test $(git rev-parse HEAD^^) = $(git rev-parse L) &&
 	test "23" = "$(cat file1)" &&
-	test "" = "$(cat file6)" &&
-	test "file7" = "$(cat file7)" &&
-
-	git checkout branch1 &&
-	git reset --hard H &&
-	git checkout branch2 &&
-	git reset --hard I
+	test "I" = "$(cat file6)" &&
+	test "file7" = "$(cat file7)"
 '
 
 # A - B - C - D - E
 #   \             \ \
-#     F - G - H -- L \        -->   L
-#       \            |               \
-#         I -- G2 -- J -- K           I -- G2 -- K
+#     F - G - H -- L2 \        -->   L2
+#       \             |                \
+#         I -- G3 --- J2 -- K2           I -- G3 -- K2
 # G2 = different changes as G
 test_expect_success 'keep different-resolution merges with -p' '
-	git checkout branch1 &&
+	git checkout H &&
 	! git merge E &&
-	echo 23 > file1 &&
-	git add file1 &&
-	git commit -m L &&
-	git checkout branch2 &&
-	echo 4 > file1 &&
-	git commit -a -m G2 &&
+	test_commit L2 file1 23 &&
+	git checkout I &&
+	test_commit G3 file1 4 &&
 	! git merge E &&
-	echo 24 > file1 &&
-	git add file1 &&
-	git commit -m J &&
-	echo file7 > file7 &&
-	git add file7 &&
-	git commit -m K &&
-	! GIT_EDITOR=: git rebase -i -p branch1 &&
+	test_commit J2 file1 24 &&
+	test_commit K2 file7 file7 &&
+	test_must_fail git rebase -i -p L2 &&
 	echo 234 > file1 &&
 	git add file1 &&
-	GIT_EDITOR=: git rebase --continue &&
-	test $(git rev-parse branch2^^^) = $(git rev-parse branch1) &&
+	git rebase --continue &&
+	test $(git rev-parse HEAD^^^) = $(git rev-parse L2) &&
 	test "234" = "$(cat file1)" &&
-	test "" = "$(cat file6)" &&
-	test "file7" = "$(cat file7)" &&
-
-	git checkout branch1 &&
-	git reset --hard H &&
-	git checkout branch2 &&
-	git reset --hard I
+	test "I" = "$(cat file6)" &&
+	test "file7" = "$(cat file7)"
 '
 
 test_done
-- 
1.6.1.482.g7d54be

^ permalink raw reply related

* [PATCH v2 6/6] Simplify t3412
From: Johannes Schindelin @ 2009-01-27 22:35 UTC (permalink / raw)
  To: git, gitster
In-Reply-To: <7v7i4g31lj.fsf@gitster.siamese.dyndns.org>

Use the newly introduced test_commit() and test_merge() helpers.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t3412-rebase-root.sh |   28 +++++++---------------------
 1 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/t/t3412-rebase-root.sh b/t/t3412-rebase-root.sh
index 3d8ff67..9fc528f 100755
--- a/t/t3412-rebase-root.sh
+++ b/t/t3412-rebase-root.sh
@@ -7,23 +7,13 @@ Tests if git rebase --root --onto <newparent> can rebase the root commit.
 . ./test-lib.sh
 
 test_expect_success 'prepare repository' '
-	echo 1 > A &&
-	git add A &&
-	git commit -m 1 &&
-	echo 2 > A &&
-	git add A &&
-	git commit -m 2 &&
+	test_commit 1 A &&
+	test_commit 2 A &&
 	git symbolic-ref HEAD refs/heads/other &&
 	rm .git/index &&
-	echo 3 > B &&
-	git add B &&
-	git commit -m 3 &&
-	echo 1 > A &&
-	git add A &&
-	git commit -m 1b &&
-	echo 4 > B &&
-	git add B &&
-	git commit -m 4
+	test_commit 3 B &&
+	test_commit 1b A 1 &&
+	test_commit 4 B
 '
 
 test_expect_success 'rebase --root expects --onto' '
@@ -103,9 +93,7 @@ test_expect_success 'pre-rebase got correct input (5)' '
 test_expect_success 'set up merge history' '
 	git checkout other^ &&
 	git checkout -b side &&
-	echo 5 > C &&
-	git add C &&
-	git commit -m 5 &&
+	test_commit 5 C &&
 	git checkout other &&
 	git merge side
 '
@@ -132,9 +120,7 @@ test_expect_success 'set up second root and merge' '
 	git symbolic-ref HEAD refs/heads/third &&
 	rm .git/index &&
 	rm A B C &&
-	echo 6 > D &&
-	git add D &&
-	git commit -m 6 &&
+	test_commit 6 D &&
 	git checkout other &&
 	git merge third
 '
-- 
1.6.1.482.g7d54be

^ permalink raw reply related

* [PATCH v2 5/6] Simplify t3411
From: Johannes Schindelin @ 2009-01-27 22:35 UTC (permalink / raw)
  To: git, gitster
In-Reply-To: <7v7i4g31lj.fsf@gitster.siamese.dyndns.org>

Use test_commit() and test_merge().  This way, it is harder to forget to
tag, or to call test_tick before committing.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t3411-rebase-preserve-around-merges.sh |   65 ++++++++----------------------
 1 files changed, 17 insertions(+), 48 deletions(-)

diff --git a/t/t3411-rebase-preserve-around-merges.sh b/t/t3411-rebase-preserve-around-merges.sh
index 6a1586a..6533505 100755
--- a/t/t3411-rebase-preserve-around-merges.sh
+++ b/t/t3411-rebase-preserve-around-merges.sh
@@ -21,27 +21,13 @@ set_fake_editor
 #        -- C1 --
 
 test_expect_success 'setup' '
-	touch a &&
-	touch b &&
-	git add a &&
-	git commit -m A1 &&
-	git tag A1
-	git add b &&
-	git commit -m B1 &&
-	git tag B1 &&
-	git checkout -b branch &&
-	touch c &&
-	git add c &&
-	git commit -m C1 &&
-	git checkout master &&
-	touch d &&
-	git add d &&
-	git commit -m D1 &&
-	git merge branch &&
-	touch f &&
-	git add f &&
-	git commit -m F1 &&
-	git tag F1
+	test_commit A1 &&
+	test_commit B1 &&
+	test_commit C1 &&
+	git reset --hard B1 &&
+	test_commit D1 &&
+	test_merge E1 C1 &&
+	test_commit F1
 '
 
 # Should result in:
@@ -52,7 +38,7 @@ test_expect_success 'setup' '
 #
 test_expect_success 'squash F1 into D1' '
 	FAKE_LINES="1 squash 3 2" git rebase -i -p B1 &&
-	test "$(git rev-parse HEAD^2)" = "$(git rev-parse branch)" &&
+	test "$(git rev-parse HEAD^2)" = "$(git rev-parse C1)" &&
 	test "$(git rev-parse HEAD~2)" = "$(git rev-parse B1)" &&
 	git tag E2
 '
@@ -70,32 +56,15 @@ test_expect_success 'squash F1 into D1' '
 # And rebase G1..M1 onto E2
 
 test_expect_success 'rebase two levels of merge' '
-	git checkout -b branch2 A1 &&
-	touch g &&
-	git add g &&
-	git commit -m G1 &&
-	git checkout -b branch3 &&
-	touch h
-	git add h &&
-	git commit -m H1 &&
-	git checkout -b branch4 &&
-	touch i &&
-	git add i &&
-	git commit -m I1 &&
-	git tag I1 &&
-	git checkout branch3 &&
-	touch j &&
-	git add j &&
-	git commit -m J1 &&
-	git merge I1 --no-commit &&
-	git commit -m K1 &&
-	git tag K1 &&
-	git checkout branch2 &&
-	touch l &&
-	git add l &&
-	git commit -m L1 &&
-	git merge K1 --no-commit &&
-	git commit -m M1 &&
+	test_commit G1 &&
+	test_commit H1 &&
+	test_commit I1 &&
+	git checkout -b branch3 H1 &&
+	test_commit J1 &&
+	test_merge K1 I1 &&
+	git checkout -b branch2 G1 &&
+	test_commit L1 &&
+	test_merge M1 K1 &&
 	GIT_EDITOR=: git rebase -i -p E2 &&
 	test "$(git rev-parse HEAD~3)" = "$(git rev-parse E2)" &&
 	test "$(git rev-parse HEAD~2)" = "$(git rev-parse HEAD^2^2~2)" &&
-- 
1.6.1.482.g7d54be

^ permalink raw reply related

* Re: Heads up: major rebase -i -p rework coming up
From: Stephen Haberman @ 2009-01-27 22:36 UTC (permalink / raw)
  To: Nanako Shiraishi
  Cc: Johannes Schindelin, git, spearce, Thomas Rast, Bjrn Steinbrink
In-Reply-To: <20090128071054.6117@nanako3.lavabit.com>


> >     a -- b -- c  origin/feature
> >       \
> >        d -- e    feature
> >            /
> >       ... g      origin/master

> Sorry for asking a basic question, but if "feature" is a topic branch
> for advance the feature, why are you merging origin/master into it?
> Doesn't it blur the theme of the branch by including "development of
> the feature and all the random things that happened while it was being
> developed in other places"?

We merged origin/master because a release had just happened (e.g. master
moved from 1.0 -> 1.1), and when QA looks at origin/feature, they wanted
to see it integrated with the latest release (e.g. 1.1).

Now, granted, if feature was a private/unpublished branch, we would
rebase the entire thing (a/b/c) on top of master (g), but a/b/c has
already been published to our bug tracker, email lists, and other
developers who are collaborating on origin/feature, so between polluting
feature with a merge from master and changing the published hashes, we
chose the merge.

- Stephen

^ permalink raw reply

* Re: [PATCH] mergetool merge/skip/abort
From: Junio C Hamano @ 2009-01-27 22:37 UTC (permalink / raw)
  To: Charles Bailey; +Cc: Theodore Tso, git
In-Reply-To: <20090127220947.GA21319@hashpling.org>

Charles Bailey <charles@hashpling.org> writes:

> On Mon, Jan 26, 2009 at 05:58:35PM -0500, Theodore Tso wrote:
> ...
> A quick blame session has shown that after Ted I've probably touched
> the next most number of lines of mergetool. It's a crude measure and
> not necessarily a sign of competence, I admit.
>
> Although not rolling in spare time, I feel I'd be able review
> mergetool patches at roughly the rate that they tend to appear at the
> moment.
>
> Given the above, if I pass the "good taste" and "Junio trust" tests I
> feel that I should offer my services as mergetool patch wrangler.

Competence certainly counts to a certain extent, but volunteerism,
willingness, and enthusiasm count too.

Taste is sometimes a relative thing and we can make sure where we agree to
disagree on the list case by case basis.

Most importantly, anybody who will suffer when the tool breaks will be
much better person than I to look after it.  That is one of the largest
ingredient in the "trust" factor.

Thanks.

^ permalink raw reply

* Re: git-am annoyance
From: Sverre Rabbelier @ 2009-01-27 22:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailinglist
In-Reply-To: <7vr62o1iww.fsf@gitster.siamese.dyndns.org>

On Tue, Jan 27, 2009 at 23:30, Junio C Hamano <gitster@pobox.com> wrote:
> It wants to read from the stdin as "git am < mbox" is a valid usage.

Ah, ofcourse, that makes sense :).

> A patch to detect that the input was killed with ^C and clean things up
> would be welcome.  Also we may be able to detect "-t 0", too.

What is '-t 0'? How would one detect this in bash?

>> $ # ok, now what do I do?
>
> Here is one thing you could do.
>
>    $ PS1=': $(__git_ps1 "%s"); '
>    : master|AM/REBASE;
>    : master|AM/REBASE; git am --abort

Ugh, I couldn't even get that thing to work :P.

> But you are right.  We should be able to detect this.

That would be nice indeed.

> I think it was just people who often use "am" are so used to correctly the
> command that the state where no state files are created didn't happen
> often and never reported the breakage.

Ok, am glad I reported it then, now it's a known issue at least.

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* Re: Anyone have access to 64-bit Vista?
From: Geoffrey Lee @ 2009-01-27 22:41 UTC (permalink / raw)
  To: git
In-Reply-To: <20090127122456.0df531c3.stephen@exigencecorp.com>

On Tue, Jan 27, 2009 at 10:24 AM, Stephen Haberman
<stephen@exigencecorp.com> wrote:
> It kind of works on my Vista 64-bit system--I do not see the shell
> extensions in the native Windows Explorer (which is 64 bit), but I do
> see the shell extensions in an Explorer replacement I use (Xplorer2)
> that is 32-bit.
>
> I've seen other oddities in 32-bit vs. 64-bit programs--e.g. my alt tab
> replacement (Joe), which is 32-bit, works great with 32-bit programs
> but cannot remove focus from 64-bit programs (IE, Windows Explorer,
> etc.). Ironically, very few of the programs I use are 64-bit, so I get
> by with the alt tab replacement.
>
> - Stephen
>

Thanks! It seems that 64-bit explorer.exe will not load 32-bit shell
extensions. At least now I know I'm not going crazy. :)

-Geoffrey Lee

^ permalink raw reply

* Re: [PATCH 1/6] t3404 & t3411: undo copy&paste
From: Junio C Hamano @ 2009-01-27 22:46 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Stephen Haberman, Thomas Rast, git
In-Reply-To: <alpine.DEB.1.00.0901272254450.14855@racer>

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> > +		sed -n "${line}p" < "$1".tmp
>> > +		sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"
>> > +		sed -n "${line}s/^pick/$action/p" < "$1".tmp
>
>
> Probably.  It is for debugging, anyway.  As everything you only see with 
> -v.

Exactly.  That is why I'd rather want to see what exact insn sequence is
being fed to the "rebase -i".  Because I'd be debugging my new test or
changes to "rebase -i", not debugging fake-editor's use of sed.

^ permalink raw reply

* Re: git-am annoyance
From: Johannes Schindelin @ 2009-01-27 22:49 UTC (permalink / raw)
  To: sverre; +Cc: Junio C Hamano, Git Mailinglist
In-Reply-To: <bd6139dc0901271437l19f1201ch867f1a7c2045e54b@mail.gmail.com>

Hi,

On Tue, 27 Jan 2009, Sverre Rabbelier wrote:

> What is '-t 0'? How would one detect this in bash?

It detects if file descriptor 0 (stdin) is a terminal.  "man test" to the 
rescue ;-)

Ciao,
Dscho

P.S.: if I hadn't tried exactly that in my valgrind patches recently, I 
would not have known either...

^ permalink raw reply

* Re: Anyone have access to 64-bit Vista?
From: Johannes Schindelin @ 2009-01-27 22:51 UTC (permalink / raw)
  To: Geoffrey Lee; +Cc: git
In-Reply-To: <83d7aaa40901271441h47c98edepc16f5026de636134@mail.gmail.com>

Hi,

On Tue, 27 Jan 2009, Geoffrey Lee wrote:

> On Tue, Jan 27, 2009 at 10:24 AM, Stephen Haberman
> <stephen@exigencecorp.com> wrote:
> > It kind of works on my Vista 64-bit system--I do not see the shell
> > extensions in the native Windows Explorer (which is 64 bit), but I do
> > see the shell extensions in an Explorer replacement I use (Xplorer2)
> > that is 32-bit.
> >
> > I've seen other oddities in 32-bit vs. 64-bit programs--e.g. my alt tab
> > replacement (Joe), which is 32-bit, works great with 32-bit programs
> > but cannot remove focus from 64-bit programs (IE, Windows Explorer,
> > etc.). Ironically, very few of the programs I use are 64-bit, so I get
> > by with the alt tab replacement.
> >
> > - Stephen
> >
> 
> Thanks! It seems that 64-bit explorer.exe will not load 32-bit shell
> extensions. At least now I know I'm not going crazy. :)

How could it?  You cannot have 32-bit code and 64-bit code running in the 
same process.  At least not with x86_64 (AFAIK).

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH v2 0/6] rebase simplifications
From: Junio C Hamano @ 2009-01-27 22:50 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, gitster
In-Reply-To: <alpine.DEB.1.00.0901272323530.3586@pacific.mpi-cbg.de>

Johannes Schindelin <johannes.schindelin@gmx.de> writes:

> Changes vs  v1:
>
> removed the "rnyn" blurt (which probably marsk me as Alpine user...)
>
> removed the SHELL_PATH handling; it is a miracle to me why it works, but 
> I'd rather not meddle with the magic now that you pointed it out
>
> Moved test_commit and test_merge into test-lib.sh
>
> Fixed the quoting in test_commit and test_merge
>
> AFAIR that's all...

Thanks; looks much nicer (not just relative to v1 but compared to the
original).

^ permalink raw reply

* git gui blame tooltip problem in Cygwin with multiple displays
From: Hannu Koivisto @ 2009-01-27 22:52 UTC (permalink / raw)
  To: git

Hi,

I have two displays in my Windows XP SP3 machine, display 1 on the
left 1050x1680 (rotated 90deg) and display 2 (primary display) on
the right 1920x1080.  Display coordinates ((top left
corner)-(bottom right corner)) are (-1050,-600)-(0,1080) and
(0,0)-(1920,1080), respectively.  That is, all visible x
coordinates on display 1 are negative and y coordinates are partly
negative.

git gui blame works fine when its window is on the primary display
but if I move it to the other display, the tooltips it opens are
still opened on the primary display, far from the cursor's current
position.  I wonder if the tooltip position calculations cannot
handle those negative coordinates?  I found the code in question
but I can't really read tcl/tk nor have I any idea how to
instrument it to log position calculations, for example.

I realize this may be a quite rare setup and I would like to help
narrow this down but I need a debug version of the code or
something, unless of course the problem is obvious to the author or
someome who is proficient with tcl.

Tested with git 1.6.1.265.g9a013 (and some slightly older version
as well).

PS. I tried to send this, twice, directly to the list (instead of
via Gmane) and Cc the author of the code, Shawn O. Pearce, but for
some reason those mails never showed up, even though at the same
time I was able to send other mails to the list just fine.  Weird.

-- 
Hannu

^ permalink raw reply

* Re: [PATCH 1/6] t3404 & t3411: undo copy&paste
From: Johannes Schindelin @ 2009-01-27 22:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Stephen Haberman, Thomas Rast, git
In-Reply-To: <7veiyo1i5y.fsf@gitster.siamese.dyndns.org>

Hi,

On Tue, 27 Jan 2009, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> >> > +		sed -n "${line}p" < "$1".tmp
> >> > +		sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"
> >> > +		sed -n "${line}s/^pick/$action/p" < "$1".tmp
> >
> > Probably.  It is for debugging, anyway.  As everything you only see with 
> > -v.
> 
> Exactly.  That is why I'd rather want to see what exact insn sequence is 
> being fed to the "rebase -i".  Because I'd be debugging my new test or 
> changes to "rebase -i", not debugging fake-editor's use of sed.

If you are really after seeing the constructed rebase script, then

			tail -n 1 "$1"

would make tons more sense, no?

Ciao,
Dscho

^ permalink raw reply

* Re: Anyone have access to 64-bit Vista?
From: Steven Noonan @ 2009-01-27 23:01 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Geoffrey Lee, git
In-Reply-To: <alpine.DEB.1.00.0901272350360.3586@pacific.mpi-cbg.de>

On Tue, Jan 27, 2009 at 2:51 PM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Tue, 27 Jan 2009, Geoffrey Lee wrote:
>
>> On Tue, Jan 27, 2009 at 10:24 AM, Stephen Haberman
>> <stephen@exigencecorp.com> wrote:
>> > It kind of works on my Vista 64-bit system--I do not see the shell
>> > extensions in the native Windows Explorer (which is 64 bit), but I do
>> > see the shell extensions in an Explorer replacement I use (Xplorer2)
>> > that is 32-bit.
>> >
>> > I've seen other oddities in 32-bit vs. 64-bit programs--e.g. my alt tab
>> > replacement (Joe), which is 32-bit, works great with 32-bit programs
>> > but cannot remove focus from 64-bit programs (IE, Windows Explorer,
>> > etc.). Ironically, very few of the programs I use are 64-bit, so I get
>> > by with the alt tab replacement.
>> >
>> > - Stephen
>> >
>>
>> Thanks! It seems that 64-bit explorer.exe will not load 32-bit shell
>> extensions. At least now I know I'm not going crazy. :)
>
> How could it?  You cannot have 32-bit code and 64-bit code running in the
> same process.  At least not with x86_64 (AFAIK).
>

Correct, this is also my biggest gripe with how x86_64 is implemented.
Thank you, AMD!

- Steven

^ permalink raw reply

* Bad objects error since upgrading GitHub servers to 1.6.1
From: PJ Hyett @ 2009-01-27 23:04 UTC (permalink / raw)
  To: git

Hi folks,

We upgraded our servers to Git 1.6.1 yesterday and almost immediately
starting hearing reports of "Fatal: Bad Object Error." I have
experienced this myself, so I'm 99% certain this isn't user error. I'm
also using 1.6.1 locally.

I ran into this error after trying to push code to GitHub after a
series of simple commits, I was doing absolutely nothing out of the
ordinary.

Please see our support thread for more examples:
http://support.github.com/discussions/feature-requests/157-fatal-bad-object-error-when-doing-simple-push

All of the error messages are the same. Can anyone please shed some
light on this, I don't see any other recourse but to downgrade Git
until this is resolved.

Thanks,
PJ

^ permalink raw reply

* [PATCH 0/2] Fix two issues found by valgrind
From: Johannes Schindelin @ 2009-01-27 23:07 UTC (permalink / raw)
  To: git; +Cc: gitster

Okay, not tons of issues.  But at least it was worth the hassle.

Johannes Schindelin (2):
  test-path-utils: Fix off by one, found by valgrind
  get_sha1_basic(): fix invalid memory access, found by valgrind

 sha1_name.c       |    2 +-
 test-path-utils.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

^ permalink raw reply

* [PATCH 1/2] test-path-utils: Fix off by one, found by valgrind
From: Johannes Schindelin @ 2009-01-27 23:07 UTC (permalink / raw)
  To: git; +Cc: gitster
In-Reply-To: <alpine.DEB.1.00.0901280005180.3586@pacific.mpi-cbg.de>

When normalizing an absolute path, we might have to add a slash _and_ a
NUL to the buffer, so the buffer was one too small.

Let's just future proof the code and alloc PATH_MAX + 1 bytes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 test-path-utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test-path-utils.c b/test-path-utils.c
index a0bcb0e..2c0f5a3 100644
--- a/test-path-utils.c
+++ b/test-path-utils.c
@@ -3,7 +3,7 @@
 int main(int argc, char **argv)
 {
 	if (argc == 3 && !strcmp(argv[1], "normalize_absolute_path")) {
-		char *buf = xmalloc(strlen(argv[2])+1);
+		char *buf = xmalloc(PATH_MAX + 1);
 		int rv = normalize_absolute_path(buf, argv[2]);
 		assert(strlen(buf) == rv);
 		puts(buf);
-- 
1.6.1.482.g7d54be

^ permalink raw reply related

* [PATCH 2/2] get_sha1_basic(): fix invalid memory access, found by valgrind
From: Johannes Schindelin @ 2009-01-27 23:07 UTC (permalink / raw)
  To: git; +Cc: gitster
In-Reply-To: <alpine.DEB.1.00.0901280005180.3586@pacific.mpi-cbg.de>

When get_sha1_basic() is passed a buffer of len 0, it should not
check if buf[len-1] is a curly bracket.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 sha1_name.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sha1_name.c b/sha1_name.c
index 7d95bbb..5d0ac02 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -334,7 +334,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
 
 	/* basic@{time or number or -number} format to query ref-log */
 	reflog_len = at = 0;
-	if (str[len-1] == '}') {
+	if (len && str[len-1] == '}') {
 		for (at = len-2; at >= 0; at--) {
 			if (str[at] == '@' && str[at+1] == '{') {
 				reflog_len = (len-1) - (at+2);
-- 
1.6.1.482.g7d54be

^ permalink raw reply related

* Re: Bad objects error since upgrading GitHub servers to 1.6.1
From: PJ Hyett @ 2009-01-27 23:10 UTC (permalink / raw)
  To: git
In-Reply-To: <bab6a2ab0901271504j73dce7afjf8436c3c7c83b770@mail.gmail.com>

To expand further, here's the output from the command line when this happened.

~/Development/github(jetty)$ git push pjhyett jetty
fatal: bad object e13a86261c6e710af8fd4b5fb093b28b8583d820
error: pack-objects died with strange error
error: failed to push some refs to 'git@github.com:pjhyett/github.git'

~/Development/github(jetty)$ git fsck --full
warning in tree 0d640d99b492b0c7db034e92d0460a7f84b22356: contains
zero-padded file modes
warning in tree 56fe2a1a3da446606aadf8861feccd592b636a34: contains
zero-padded file modes
warning in tree 99e2a89db2aa9846fc2491b3e4ccd8861e8d3283: contains
zero-padded file modes
warning in tree a6e532d7451bc4aadab86ade84df69180fab4765: contains
zero-padded file modes
dangling blob 43611213c3eff91e5fe071cf2907f69a99b630b2
dangling commit b28b3ecd85a04ecbd1dcb8aedc6886a465f6ab18
dangling commit 13a70c8687527936d2c375f0f7aefe71142de3c7
dangling commit 2aa94c1199cb332f58b70c6ce19d8de3c45c6f3c
dangling blob 61b910e7a97600691fd279e4db3662e751fb5fb7
dangling commit c4f19e16208d59666323ae0575435720be9b865d
dangling commit 19245f5d77aa449eebb4a0521b5ff4f6ce1865ab
dangling commit 122995fb7c9a7e459b0801e0647eb918bea878bf
dangling commit 7d51e3926b8720d1c7cad19aeb35d6ab4af755fd
dangling commit 1162dd21370439416967a34915832125e4975239
dangling blob 8c630b66927f6022a72e457be308de5c9ad9f4e6
dangling blob 827d4d8855fe6a3a7856ea35cd641192140f2dcd
dangling commit c9824506855d6cad9b52df115aa267d70872c2cc
dangling blob fb9bbfc3aa17c5d1ae4e15c862bd874e3476fcfc
dangling commit 46a4b39245a58ad867010f272991d6233db6288b
dangling commit d6bf5f30853fecea745559dc3a718113f3619634
dangling blob d4d66fc4c3a2cbc94d8ed9cb30a6b56daa86e58f
dangling commit b4f8d7766e8905e5ac6d6cfeeaf7370a716c24a2

Very odd that the bad object didn't appear in the fsck output.

I was able to fix the error by copying a non-corrupted version of the
object back into .git/objects and then running a git fetch.

-PJ

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox