git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: exon@op5.se (Andreas Ericsson)
To: git@vger.kernel.org
Subject: [PATCH 2/2] git-describe: Ignore argument ordering.
Date: Wed, 11 Jan 2006 21:42:36 +0100 (CET)	[thread overview]
Message-ID: <20060111204236.247D45BEC1@nox.op5.se> (raw)

Use the simple stacking code to do so.

Signed-off-by: Andreas Ericsson <ae@op5.se>

---

 describe.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

9d03987889b62405be7b3fe09fb5dfa81245af00
diff --git a/describe.c b/describe.c
index fda4102..bd4b591 100644
--- a/describe.c
+++ b/describe.c
@@ -141,10 +141,12 @@ static void describe(const char *ref)
 
 int main(int argc, char **argv)
 {
-	int i, desc = 0;
+	int i;
+	struct stack *st = NULL;
+	const char *arg;
 
 	for (i = 1; i < argc; i++) {
-		const char *arg = argv[i];
+		arg = argv[i];
 
 		if (!strcmp(arg, "--all")) {
 			all = 1;
@@ -160,12 +162,15 @@ int main(int argc, char **argv)
 				abbrev = DEFAULT_ABBREV;
 			continue;
 		}
-		describe(arg);
-		desc++;
+
+		st = stack_push(st, arg);
 	}
 
-	if (!desc)
+	if (!st)
 		describe("HEAD");
 
+	while ((arg = stack_pull(st)))
+		describe(arg);
+
 	return 0;
 }
-- 
1.1.0

                 reply	other threads:[~2006-01-11 20:42 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=20060111204236.247D45BEC1@nox.op5.se \
    --to=exon@op5.se \
    --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).