From: "Josef 'Jeff' Sipek" <jsipek@cs.sunysb.edu>
To: git@vger.kernel.org
Cc: "Josef 'Jeff' Sipek" <jsipek@cs.sunysb.edu>
Subject: [PATCH 1/2] Automatically create unannotated tags for top, bottom, and base of the stack
Date: Fri, 9 Mar 2007 23:46:22 -0500 [thread overview]
Message-ID: <11735019831879-git-send-email-jsipek@cs.sunysb.edu> (raw)
In-Reply-To: <11735019831915-git-send-email-jsipek@cs.sunysb.edu>
On every push or pop operation (refresh is a pop followed by a push), update
the stack top (${branch}_top), stack bottom (${branch}_bottom), and stack
base (${branch}_base) tags.
Top: Topmost applied patch/commit
Bottom: Bottommost applied patch/commit
Base: Commit on top of which the bottom most patch is applied
Having these three tags, one can easily get the log/diff/other information
only for commits that are (or are not!) part of the patch stack.
Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
---
guilt | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/guilt b/guilt
index 43e7842..3dbe4b6 100755
--- a/guilt
+++ b/guilt
@@ -277,6 +277,33 @@ function pop_many_patches
mv "$applied.tmp" "$applied"
cd - 2>&1 >/dev/null
+
+ # update references to top, bottom, and base
+ update_stack_tags
+}
+
+# usage: update_stack_tags
+function update_stack_tags
+{
+ if [ `wc -l < $applied` -gt 0 ]; then
+ # there are patches applied, therefore we must get the top,
+ # bottom and base hashes, and update the tags
+
+ local top_hash=`git-rev-parse HEAD`
+ local bottom_hash=`head -1 < $applied | cut -d: -f1`
+ local base_hash=`git-rev-parse $bottom_hash^`
+
+ echo $top_hash > "$GIT_DIR/refs/tags/${branch}_top"
+ echo $bottom_hash > "$GIT_DIR/refs/tags/${branch}_bottom"
+ echo $base_hash > "$GIT_DIR/refs/tags/${branch}_base"
+ else
+ # there are no patches applied, therefore we must remove the
+ # tags to old top, bottom, and base
+
+ rm -f "$GIT_DIR/refs/tags/${branch}_top"
+ rm -f "$GIT_DIR/refs/tags/${branch}_bottom"
+ rm -f "$GIT_DIR/refs/tags/${branch}_base"
+ fi
}
# usage: push_patch patchname [bail_action]
@@ -349,6 +376,11 @@ function push_patch
# mark patch as applied
echo "$commitish:$pname" >> $applied
+ cd - 2>&1 >/dev/null
+
+ # update references to top, bottom, and base of the stack
+ update_stack_tags
+
# restore original GIT_AUTHOR_{NAME,EMAIL}
if [ ! -z "$author_str" ]; then
if [ ! -z "$backup_author_name" ]; then
@@ -376,8 +408,6 @@ function push_patch
rm -f /tmp/guilt.msg.$$ /tmp/guilt.log.$$
- cd - 2>&1 >/dev/null
-
return $bail
}
--
1.5.0.3.268.g3dda
next prev parent reply other threads:[~2007-03-10 4:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-10 4:46 [GUILT][RFC] Autotagging Josef 'Jeff' Sipek
2007-03-10 4:46 ` Josef 'Jeff' Sipek [this message]
2007-03-10 4:46 ` [PATCH 2/2] Autotag: Read guilt.autotag config var and tag commits only if this feature is enabled Josef 'Jeff' Sipek
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=11735019831879-git-send-email-jsipek@cs.sunysb.edu \
--to=jsipek@cs.sunysb.edu \
--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).