From: Philip Pokorny <ppokorny@mindspring•com>
To: Petr Baudis <pasky@ucw•cz>
Cc: git@vger•kernel.org
Subject: Re: PATCH[4/4]: Allow tree-id to return the ID of a tree object
Date: Thu, 28 Apr 2005 00:17:58 -0700 [thread overview]
Message-ID: <42708E26.2090803@mindspring.com> (raw)
In-Reply-To: <20050427232223.GM22956@pasky.ji.cz>
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
Convert parent-id to similar style and function as the new commit-id and
tree-id.
NOTE: parent-id uses commit-id rather than cg-Xnormid directly
Signed-off-by: Philip Pokorny <ppokorny@mindspring•com>
[-- Attachment #2: cogito-0.8-parent-id.patch --]
[-- Type: text/plain, Size: 889 bytes --]
Index: parent-id
===================================================================
--- 6ad600e20c89323c1d3049f75b8ca9b0a2d72167/parent-id (mode:100755 sha1:f35877a6aa5b68d2fb4a388dcfa9b3e64262604e)
+++ uncommitted/parent-id (mode:100775)
@@ -1,12 +1,19 @@
#!/usr/bin/env bash
#
# Get ID of parent commit to a given revision or HEAD.
+# NOTE: will return multiple SHA1s if ID is a commit with multiple parents
+#
# Copyright (c) Petr Baudis, 2005
#
-# Takes ID of the current commit, defaults to HEAD.
-PARENT="^parent [A-Za-z0-9]{40}$"
+# Save for later error message
+orig="$1"
-id=$(commit-id $1) || exit 1
+# Normalize to SHA1 form and verify its a commit
+id=$(commit-id "$1")
+if [ ! "$id" ]; then
+ # commit-id already reported the error
+ exit 1
+fi
-cat-file commit $id | egrep "$PARENT" | cut -d ' ' -f 2
+cat-file commit $id | awk '/^parent/{print $2};/^$/{exit}'
prev parent reply other threads:[~2005-04-28 7:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-27 16:20 PATCH: Allow tree-id to return the ID of a tree object Philip Pokorny
2005-04-27 23:22 ` Petr Baudis
2005-04-28 7:11 ` PATCH[0/4]: " Philip Pokorny
2005-04-28 7:14 ` PATCH[1/4]: " Philip Pokorny
2005-04-28 7:15 ` PATCH[2/4]: " Philip Pokorny
2005-05-02 5:46 ` Philip Pokorny
2005-04-28 7:16 ` PATCH[3/4]: " Philip Pokorny
2005-04-28 7:17 ` Philip Pokorny [this message]
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=42708E26.2090803@mindspring.com \
--to=ppokorny@mindspring$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=pasky@ucw$(echo .)cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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