Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junio@siamese.dyndns.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: [PATCH] Make -p flag optional from commit-tree.
Date: Thu, 21 Apr 2005 15:42:59 -0700	[thread overview]
Message-ID: <7v4qdzeop8.fsf@assigned-by-dhcp.cox.net> (raw)

We cannot currently say:

 $ commit-tree $(write-tree) $(cat .git/heads/junio .git/heads/linus)

The above must be written as:

 $ commit-tree $(write-tree) \
     -p $(cat .git/heads/junio) \
     -p $(cat .git/heads/linus)

This patch makes -p flag optional.  Existing scripts are
hopefully not affected because they are passing -p properly.  If
we want to introduce non parent-ID parameters to commit-tree
later, we can give them their own -flag letters.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 commit-tree.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

commit-tree.c: c0b07f89286c3f6cceae8122b4c3142c8efaf8e1
--- a/commit-tree.c
+++ b/commit-tree.c
@@ -297,10 +297,17 @@ int main(int argc, char **argv)
 		usage(commit_tree_usage);
 
 	check_valid(tree_sha1, "tree");
-	for (i = 2; i < argc; i += 2) {
-		char *a, *b;
-		a = argv[i]; b = argv[i+1];
-		if (!b || strcmp(a, "-p") || get_sha1_hex(b, parent_sha1[parents]))
+	for (i = 2; i < argc; i++) {
+		/* Historically commit-tree required -p in front of
+		 * each parent commit ID.  This is confusing.  We can
+		 * add non parent commit ID parameter later by defining
+		 * flags other than "-p" so let's just ignore them. 
+		 */
+		if (! strcmp(argv[i], "-p"))
+			continue;
+
+		/* Currently it just expects parent IDs. */
+		if (get_sha1_hex(argv[i], parent_sha1[parents]))
 			usage(commit_tree_usage);
 		check_valid(parent_sha1[parents], "commit");
 		parents++;


                 reply	other threads:[~2005-04-21 22:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7v4qdzeop8.fsf@assigned-by-dhcp.cox.net \
    --to=junio@siamese.dyndns.org \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.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