git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Stop git-rev-list at sha1 match
@ 2005-05-11 19:24 Thomas Gleixner
  2005-05-11 20:03 ` Junio C Hamano
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Gleixner @ 2005-05-11 19:24 UTC (permalink / raw)
  To: git

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;
 }



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-05-13  5:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-11 19:24 [PATCH] Stop git-rev-list at sha1 match Thomas Gleixner
2005-05-11 20:03 ` 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

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).