git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: "Kristian Høgsberg" <krh@redhat.com>
Cc: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: Re: [PATCH] Port git commit to C.
Date: Fri, 9 Nov 2007 00:27:52 +0100	[thread overview]
Message-ID: <20071108232751.GC4899@steel.home> (raw)
In-Reply-To: <1194541140-3062-1-git-send-email-krh@redhat.com>

Kristian Høgsberg, Thu, Nov 08, 2007 17:59:00 +0100:
> This makes git commit a builtin and moves git-commit.sh to
> contrib/examples.  This also removes the git-runstatus
> helper, which was mostly just a git-status.sh implementation detail.

Applied instead of 00c8febf563da on Junio's pu it breaks t1400:

* expecting success: echo TEST >F &&
     git add F &&
         GIT_AUTHOR_DATE="2005-05-26 23:30" \
         GIT_COMMITTER_DATE="2005-05-26 23:30" git-commit -m add -a &&
         h_TEST=$(git rev-parse --verify HEAD)
         echo The other day this did not work. >M &&
         echo And then Bob told me how to fix it. >>M &&
         echo OTHER >F &&
         GIT_AUTHOR_DATE="2005-05-26 23:41" \
         GIT_COMMITTER_DATE="2005-05-26 23:41" git-commit -F M -a &&
         h_OTHER=$(git rev-parse --verify HEAD) &&
         GIT_AUTHOR_DATE="2005-05-26 23:44" \
         GIT_COMMITTER_DATE="2005-05-26 23:44" git-commit --amend &&
         h_FIXED=$(git rev-parse --verify HEAD) &&
         echo Merged initial commit and a later commit. >M &&
         echo $h_TEST >.git/MERGE_HEAD &&
         GIT_AUTHOR_DATE="2005-05-26 23:45" \
         GIT_COMMITTER_DATE="2005-05-26 23:45" git-commit -F M &&
         h_MERGED=$(git rev-parse --verify HEAD)
         rm -f M
Created initial commit 2bc82dd: add
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 F
Created commit d244b72: The other day this did not work.
 1 files changed, 1 insertions(+), 1 deletions(-)
launching editor, log (null)
fatal: * no commit message?  aborting commit.
*   ok 28: creating initial files

* expecting success: diff expect .git/logs/refs/heads/master
3,4d2
< d244b725ca2c5f8aaacd9df2468b890499380862  C O Mitter <committer@example.com> 1117151040 +0000 commit (amend): The other day this did not work.
<   C O Mitter <committer@example.com> 1117151100 +0000 commit (merge): Merged initial commit and a later commit.
* FAIL 29: git-commit logged updates
        diff expect .git/logs/refs/heads/master


Which is not the test actually failed. The failed one is 28, but the
last "rm -f M" killed the error because of missed "&&" before it.

I believe you need something like this to fix the test:

diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index ce045b2..a90824b 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -205,7 +205,7 @@ test_expect_success \
 	 echo $h_TEST >.git/MERGE_HEAD &&
 	 GIT_AUTHOR_DATE="2005-05-26 23:45" \
 	 GIT_COMMITTER_DATE="2005-05-26 23:45" git-commit -F M &&
-	 h_MERGED=$(git rev-parse --verify HEAD)
+	 h_MERGED=$(git rev-parse --verify HEAD) &&
 	 rm -f M'
 
 cat >expect <<EOF

and something like this to refill the strbuf of commit message with
the text read from the amended commit (the failed test was a
"git commit --amend"). The patch is on top of yours "Export
launch_editor() and make it accept ':' as a no-op editor":

diff --git a/builtin-tag.c b/builtin-tag.c
index c3b76da..8ca9ffb 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -42,17 +42,17 @@ void launch_editor(const char *path, struct strbuf *buffer)
 	if (!editor)
 		editor = "vi";
 
-	if (!strcmp(editor, ":"))
-		return;
-
-	memset(&child, 0, sizeof(child));
-	child.argv = args;
-	args[0] = editor;
-	args[1] = path;
-	args[2] = NULL;
-
-	if (run_command(&child))
-		die("There was a problem with the editor %s.", editor);
+	if (strcmp(editor, ":"))
+	{
+		memset(&child, 0, sizeof(child));
+		child.argv = args;
+		args[0] = editor;
+		args[1] = path;
+		args[2] = NULL;
+
+		if (run_command(&child))
+			die("There was a problem with the editor %s.", editor);
+	}
 
 	if (strbuf_read_file(buffer, path, 0) < 0)
 		die("could not read message file '%s': %s",

  parent reply	other threads:[~2007-11-08 23:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-08 16:59 [PATCH] Port git commit to C Kristian Høgsberg
2007-11-08 23:14 ` Junio C Hamano
2007-11-08 23:27 ` Alex Riesen [this message]
2007-11-08 23:41   ` [PATCH] stop t1400 hiding errors in tests Alex Riesen
2007-11-08 23:47   ` [PATCH] Port git commit to C Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071108232751.GC4899@steel.home \
    --to=raa.lkml@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=krh@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).