{"thread":{"id":"39447","subject":"[PATCH/RFC] create a skeleton for the command git rebase --status","startedAt":"2015-05-28T12:08:11Z","lastAt":"2015-05-28T13:06:34Z","messageCount":3,"participants":["Guillaume Pagès","Matthieu Moy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"262321","messageId":"1432814891-4717-1-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","threadId":"39447","inReplyTo":null,"subject":"[PATCH/RFC] create a skeleton for the command git rebase --status","fromName":"Guillaume Pagès","fromEmail":"guillaume.pages@ensimag.grenoble-inp.fr","sentAt":"2015-05-28T12:08:11Z","receivedAt":"2015-05-28T12:08:11Z","isPatch":true,"sender":{"key":"guillaume.pages@ensimag.grenoble-inp.fr","avatar":null},"body":"It is an almost empty code I send to validate the global architecture\nof this command.  I choose to write it in C because git status is\nalready in C and it seems that it is the current tendency to port\nshell code to C. Moreover I would like to use code from wt_status to\nimplement this functionnality. I wrote a helper that I call from shell\nscript, as it is made in bisect (bisect--helper.c).\n\nSigned-off-by: Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr>\n---\n Makefile         | 2 ++\n builtin.h        | 1 +\n git-rebase.sh    | 7 ++++++-\n git.c            | 1 +\n rebase--status.c | 6 ++++++\n rebase--status.h | 7 +++++++\n 6 files changed, 23 insertions(+), 1 deletion(-)\n create mode 100644 rebase--status.c\n create mode 100644 rebase--status.h\n\ndiff --git a/Makefile b/Makefile\nindex e0caec3..e3b3e63 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -853,6 +853,7 @@ LIB_OBJS += prompt.o\n LIB_OBJS += quote.o\n LIB_OBJS += reachable.o\n LIB_OBJS += read-cache.o\n+LIB_OBJS += rebase--status.o\n LIB_OBJS += reflog-walk.o\n LIB_OBJS += refs.o\n LIB_OBJS += remote.o\n@@ -969,6 +970,7 @@ BUILTIN_OBJS += builtin/prune-packed.o\n BUILTIN_OBJS += builtin/prune.o\n BUILTIN_OBJS += builtin/push.o\n BUILTIN_OBJS += builtin/read-tree.o\n+BUILTIN_OBJS += builtin/rebase--status--helper.o\n BUILTIN_OBJS += builtin/receive-pack.o\n BUILTIN_OBJS += builtin/reflog.o\n BUILTIN_OBJS += builtin/remote.o\ndiff --git a/builtin.h b/builtin.h\nindex c47c110..5071a08 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -99,6 +99,7 @@ extern int cmd_prune(int argc, const char **argv, const char *prefix);\n extern int cmd_prune_packed(int argc, const char **argv, const char *prefix);\n extern int cmd_push(int argc, const char **argv, const char *prefix);\n extern int cmd_read_tree(int argc, const char **argv, const char *prefix);\n+extern int cmd_rebase_status__helper(int argc, const char **argv, const char *prefix);\n extern int cmd_receive_pack(int argc, const char **argv, const char *prefix);\n extern int cmd_reflog(int argc, const char **argv, const char *prefix);\n extern int cmd_remote(int argc, const char **argv, const char *prefix);\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 47ca3b9..8454071 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -43,6 +43,7 @@ continue!          continue\n abort!             abort and check out the original branch\n skip!              skip current patch and continue\n edit-todo!         edit the todo list during an interactive rebase\n+status!            show the status of the current rebase\n \"\n . git-sh-setup\n . git-sh-i18n\n@@ -238,7 +239,7 @@ do\n \t--verify)\n \t\tok_to_skip_pre_rebase=\n \t\t;;\n-\t--continue|--skip|--abort|--edit-todo)\n+\t--continue|--skip|--abort|--edit-todo|--status)\n \t\ttest $total_argc -eq 2 || usage\n \t\taction=${1##--}\n \t\t;;\n@@ -401,6 +402,10 @@ abort)\n edit-todo)\n \trun_specific_rebase\n \t;;\n+status)\n+\tgit rebase--status--helper\n+\tdie\n+\t;;\n esac\n \n # Make sure no rebase is in progress\ndiff --git a/git.c b/git.c\nindex 9efd1a3..3ebc144 100644\n--- a/git.c\n+++ b/git.c\n@@ -410,6 +410,7 @@ static struct cmd_struct commands[] = {\n \t{ \"prune-packed\", cmd_prune_packed, RUN_SETUP },\n \t{ \"push\", cmd_push, RUN_SETUP },\n \t{ \"read-tree\", cmd_read_tree, RUN_SETUP },\n+\t{ \"rebase--status--helper\", cmd_rebase_status__helper, RUN_SETUP },\n \t{ \"receive-pack\", cmd_receive_pack },\n \t{ \"reflog\", cmd_reflog, RUN_SETUP },\n \t{ \"remote\", cmd_remote, RUN_SETUP },\ndiff --git a/rebase--status.c b/rebase--status.c\nnew file mode 100644\nindex 0000000..d67af52\n--- /dev/null\n+++ b/rebase--status.c\n@@ -0,0 +1,6 @@\n+#include \"rebase--status.h\"\n+\n+int rebase_status(){\n+\tprintf(\"Rebase in progress\\n\");\n+\treturn 0;\n+}\ndiff --git a/rebase--status.h b/rebase--status.h\nnew file mode 100644\nindex 0000000..17d22a1\n--- /dev/null\n+++ b/rebase--status.h\n@@ -0,0 +1,7 @@\n+#ifndef REBASE__STATUS_H\n+#define REBASE__STATUS_H\n+\n+\n+extern int rebase_status();\n+\n+#endif\n-- \n2.0.5.5.g1d968ca.dirty\n"},{"id":"262326","messageId":"vpq382gri9d.fsf@anie.imag.fr","threadId":"39447","inReplyTo":"1432814891-4717-1-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","subject":"Re: [PATCH/RFC] create a skeleton for the command git rebase --status","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-05-28T12:36:30Z","receivedAt":"2015-05-28T12:36:30Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr> writes:\n\n> It is an almost empty code I send to validate the global architecture\n> of this command.  I choose to write\n\nAvoid personal wording (I choose to write ... because -> The code is\nwritten ... because). What matters in the commit message is the reason\nfor the choice, not who made it.\n\n> +BUILTIN_OBJS += builtin/rebase--status--helper.o\n\nNo builtin/rebase--status--helper.c in your patch, is it intended?\n\n> +status)\n> +\tgit rebase--status--helper\n> +\tdie\n\n\"die\" is used to exit with an error code ($? != 0). You just mean exit\n$? here, to exit with the same code as the helper.\n\nAnd actually, you don't need to keep your script alive while the helper\nis ran, so you can write\n\nexec git rebase--status--helper\n\n> --- /dev/null\n> +++ b/rebase--status.c\n> @@ -0,0 +1,6 @@\n> +#include \"rebase--status.h\"\n> +\n> +int rebase_status(){\n> +\tprintf(\"Rebase in progress\\n\");\n\n... or not.\n\nAvoid leaving incorrect things like this in intermediate steps, even if\nyou're going to fix them eventually. It's too easy to forget the actual\nfix and leave a \"Rebase in progress\" message even when there's no rebase\nin progress. And reviewers may get confused.\n\nI'd have written stg like\n\n\tprintf(\"git rebase --status is not yet implemented\");\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"262327","messageId":"vpqlhg8onqd.fsf@anie.imag.fr","threadId":"39447","inReplyTo":"1432814891-4717-1-git-send-email-guillaume.pages@ensimag.grenoble-inp.fr","subject":"Re: [PATCH/RFC] create a skeleton for the command git rebase --status","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-05-28T13:06:34Z","receivedAt":"2015-05-28T13:06:34Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Guillaume Pagès <guillaume.pages@ensimag.grenoble-inp.fr> writes:\n\n> It is an almost empty code I send to validate the global architecture\n> of this command.\n\nOne more note: I know what \"git rebase --status\" is about because I'm\nthe one who suggested it and I read your previous message, but not\neverybody is me, and most people would appreciate a brief explanation of\nwhat \"git rebase --status\" is before knowing how you're starting the\nwork.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}