Skip to contentSkip to conversation

Built-in cherry

PATCH New Rene Scharfe 1 participant 1 message Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Built-in cherry

This replaces the shell script git-cherry with a version written in C.

The behaviour of the new version differs from the original in two
points: it has no long help any more, and it is handling the (optional) third parameter a bit differently. Basically, it does the equivalent of

ours=git-rev-list $ours ^$limit ^$upstream

instead of

ours=git-rev-list $ours ^$limit

---

I'm not really sure if the limit behaviour change matches the original intent of this feature; Yann, please holler if it doesn't.

 Makefile      |    4 +-
 builtin-log.c |  106 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 builtin.h     |    1 +
 git-cherry.sh |   91 -------------------------------------------------
 git.c         |    1 +
 5 files changed, 110 insertions(+), 93 deletions(-)
Makefile +2 -2
index 66c8b4b..2b53747 100644
@@ -157,7 +157,7 @@ BASIC_LDFLAGS =
 
 SCRIPT_SH = \
 	git-bisect.sh git-branch.sh git-checkout.sh \
-	git-cherry.sh git-clean.sh git-clone.sh git-commit.sh \
+	git-clean.sh git-clone.sh git-commit.sh \
 	git-fetch.sh \
 	git-ls-remote.sh \
 	git-merge-one-file.sh git-parse-remote.sh \
@@ -210,7 +210,7 @@ # Empty...
 EXTRA_PROGRAMS =
 
 BUILT_INS = \
-	git-format-patch$X git-show$X git-whatchanged$X \
+	git-format-patch$X git-show$X git-whatchanged$X git-cherry$X \
 	git-get-tar-commit-id$X \
 	$(patsubst builtin-%.o,git-%$X,$(BUILTIN_OBJS))
 
builtin-log.c +106 -0

109 lines not on this page · raw message

builtin.h +1 -0
index f71b962..285d98f 100644
@@ -19,6 +19,7 @@ extern int cmd_archive(int argc, const c
 extern int cmd_cat_file(int argc, const char **argv, const char *prefix);
 extern int cmd_checkout_index(int argc, const char **argv, const char *prefix);
 extern int cmd_check_ref_format(int argc, const char **argv, const char *prefix);
+extern int cmd_cherry(int argc, const char **argv, const char *prefix);
 extern int cmd_commit_tree(int argc, const char **argv, const char *prefix);
 extern int cmd_count_objects(int argc, const char **argv, const char *prefix);
 extern int cmd_diff_files(int argc, const char **argv, const char *prefix);
git-cherry.sh deleted +0 -91

91 lines not on this page · raw message

git.c +1 -0
index e089b53..f8c991f 100644
@@ -224,6 +224,7 @@ static void handle_internal_command(int 
 		{ "cat-file", cmd_cat_file, RUN_SETUP },
 		{ "checkout-index", cmd_checkout_index, RUN_SETUP },
 		{ "check-ref-format", cmd_check_ref_format },
+		{ "cherry", cmd_cherry, RUN_SETUP },
 		{ "commit-tree", cmd_commit_tree, RUN_SETUP },
 		{ "count-objects", cmd_count_objects, RUN_SETUP },
 		{ "diff", cmd_diff, RUN_SETUP | USE_PAGER },