From: Thomas Gleixner <tglx@linutronix.de>
To: git@vger.kernel.org
Subject: [PATCH] Stop git-rev-list at sha1 match
Date: Wed, 11 May 2005 19:24:16 +0000 [thread overview]
Message-ID: <1115839456.22180.79.camel@tglx> (raw)
The patch adds an option to stop the output of git-rev-list
on a sha1 match.
Signed-Off: Thomas Gleixner <tglx@linutronix.de>
--- a/rev-list.c
+++ b/rev-list.c
@@ -7,6 +7,8 @@ int main(int argc, char **argv)
struct commit_list *list = NULL;
struct commit *commit;
char *commit_arg = NULL;
+ char *sha1hex;
+ char *to_sha1 = NULL;
int i;
unsigned long max_age = -1;
unsigned long min_age = -1;
@@ -21,6 +23,8 @@ int main(int argc, char **argv)
max_age = atoi(arg + 10);
} else if (!strncmp(arg, "--min-age=", 10)) {
min_age = atoi(arg + 10);
+ } else if (!strncmp(arg, "--to_sha1=", 10)) {
+ to_sha1 = arg + 10;
} else {
commit_arg = arg;
}
@@ -30,7 +34,8 @@ int main(int argc, char **argv)
usage("usage: rev-list [OPTION] commit-id\n"
" --max-count=nr\n"
" --max-age=epoch\n"
- " --min-age=epoch\n");
+ " --min-age=epoch\n"
+ " --to-sha1=sha1\n");
commit = lookup_commit(sha1);
if (!commit || parse_commit(commit) < 0)
@@ -46,7 +51,10 @@ int main(int argc, char **argv)
break;
if (max_count != -1 && !max_count--)
break;
- printf("%s\n", sha1_to_hex(commit->object.sha1));
+ sha1hex = sha1_to_hex(commit->object.sha1);
+ if (to_sha1 != NULL && strcmp(to_sha1, sha1hex) == 0)
+ break;
+ printf("%s\n", sha1hex);
} while (list);
return 0;
}
next reply other threads:[~2005-05-11 19:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-11 19:24 Thomas Gleixner [this message]
2005-05-11 20:03 ` [PATCH] Stop git-rev-list at sha1 match Junio C Hamano
2005-05-11 20:30 ` Thomas Gleixner
2005-05-11 21:54 ` Junio C Hamano
2005-05-11 22:17 ` Petr Baudis
2005-05-11 22:49 ` Thomas Gleixner
2005-05-11 22:50 ` Petr Baudis
2005-05-11 23:08 ` Thomas Gleixner
2005-05-11 23:44 ` Petr Baudis
2005-05-12 0:31 ` Thomas Gleixner
2005-05-13 5:26 ` Petr Baudis
2005-05-12 1:54 ` Junio C Hamano
2005-05-12 2:11 ` Junio C Hamano
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=1115839456.22180.79.camel@tglx \
--to=tglx@linutronix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.