From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: git@vger.kernel.org
Subject: [PATCH] [TOPGIT] make creating a commit from a topgit branch a function
Date: Wed, 25 Feb 2009 21:03:59 +0100 [thread overview]
Message-ID: <1235592240-12616-4-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <1235592240-12616-3-git-send-email-u.kleine-koenig@pengutronix.de>
This helps avoiding code duplication for the next commit.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
tg-export.sh | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/tg-export.sh b/tg-export.sh
index 9e6940f..dea24d9 100644
--- a/tg-export.sh
+++ b/tg-export.sh
@@ -71,14 +71,11 @@ pretty_tree()
git write-tree)
}
-# collapsed_commit NAME
-# Produce a collapsed commit of branch NAME.
-collapsed_commit()
+create_tg_commit()
{
name="$1"
-
- rm -f "$playground/^pre" "$playground/^post"
- >"$playground/^body"
+ tree="$2"
+ parent="$3"
# Get commit message and authorship information
git cat-file blob "$name:.topmsg" | git mailinfo "$playground/^msg" /dev/null > "$playground/^info"
@@ -92,6 +89,20 @@ collapsed_commit()
test -n "$GIT_AUTHOR_EMAIL" && export GIT_AUTHOR_EMAIL
test -n "$GIT_AUTHOR_DATE" && export GIT_AUTHOR_DATE
+ (printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") |
+ git stripspace |
+ git commit-tree "$tree" -p "$parent"
+}
+
+# collapsed_commit NAME
+# Produce a collapsed commit of branch NAME.
+collapsed_commit()
+{
+ name="$1"
+
+ rm -f "$playground/^pre" "$playground/^post"
+ >"$playground/^body"
+
# Determine parent
parent="$(cut -f 1 "$playground/$name^parents")"
if [ "$(cat "$playground/$name^parents" | wc -l)" -gt 1 ]; then
@@ -107,9 +118,7 @@ collapsed_commit()
if branch_empty "$name"; then
echo "$parent";
else
- (printf '%s\n\n' "$SUBJECT"; cat "$playground/^msg") |
- git stripspace |
- git commit-tree "$(pretty_tree "$name")" -p "$parent"
+ create_tg_commit "$name" "$(pretty_tree $name)" "$parent"
fi;
echo "$name" >>"$playground/^ticker"
--
1.5.6.5
next prev parent reply other threads:[~2009-02-25 20:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-25 19:58 topgit patches Uwe Kleine-König
2009-02-25 20:03 ` [PATCH] [TOPGIT] limit rev-list in branch_contains to a single rev Uwe Kleine-König
2009-02-25 20:03 ` [PATCH] [TOPGIT] allow working with annihilated branches Uwe Kleine-König
2009-02-25 20:03 ` [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
2009-02-25 20:03 ` Uwe Kleine-König [this message]
2009-02-25 20:04 ` [PATCH] [TOPGIT] implement linearize export method Uwe Kleine-König
2009-02-25 21:23 ` topgit patches Petr Baudis
2009-02-25 23:15 ` Uwe Kleine-König
2009-02-25 23:22 ` Petr Baudis
2009-02-26 13:47 ` Uwe Kleine-König
2009-02-26 6:06 ` martin f krafft
2009-02-26 14:15 ` Uwe Kleine-König
2009-02-27 12:37 ` martin f krafft
2009-02-27 19:42 ` Uwe Kleine-König
2009-03-02 16:26 ` Uwe Kleine-König
2009-03-03 7:54 ` martin f krafft
-- strict thread matches above, loose matches on Subject: below --
2009-01-14 21:27 [PATCH] [TOPGIT] make tg remote idempotent Uwe Kleine-König
2009-01-14 21:27 ` [PATCH] [TOPGIT] make creating a commit from a topgit branch a function Uwe Kleine-König
2009-01-21 3:19 ` martin f krafft
2009-01-21 10:16 ` Uwe Kleine-König
2009-01-22 0:13 ` martin f krafft
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=1235592240-12616-4-git-send-email-u.kleine-koenig@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=git@vger.kernel.org \
/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).