Preparatory commit for a git rebase --status command. This command will indicate the state of the process in the rebase, and the reason why it stopped. Signed-off-by: Guillaume Pagès <guillaume.pages@xxxxxxxxxxxxxxxxxxxxxxx> --- The observations from Matthieu Moy have been taken into account It is an almost empty code sent to validate the global architecture of this command. It is written in C because git status is already in C and it seems that it is the current tendency to port shell code to C. Moreover will likely use code from wt_status to implement this functionnality. The command calls a helper from a shell script, as it is made in bisect (bisect--helper.c). Makefile | 2 ++ builtin.h | 1 + builtin/rebase--status--helper.c | 23 +++++++++++++++++++++++ git-rebase.sh | 6 +++++- git.c | 1 + rebase--status.c | 6 ++++++ rebase--status.h | 7 +++++++ 7 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 builtin/rebase--status--helper.c create mode 100644 rebase--status.c create mode 100644 rebase--status.h diff --git a/Makefile b/Makefile index e0caec3..e3b3e63 100644 --- a/Makefile +++ b/Makefile @@ -853,6 +853,7 @@ LIB_OBJS += prompt.o LIB_OBJS += quote.o LIB_OBJS += reachable.o LIB_OBJS += read-cache.o +LIB_OBJS += rebase--status.o LIB_OBJS += reflog-walk.o LIB_OBJS += refs.o LIB_OBJS += remote.o @@ -969,6 +970,7 @@ BUILTIN_OBJS += builtin/prune-packed.o BUILTIN_OBJS += builtin/prune.o BUILTIN_OBJS += builtin/push.o BUILTIN_OBJS += builtin/read-tree.o +BUILTIN_OBJS += builtin/rebase--status--helper.o BUILTIN_OBJS += builtin/receive-pack.o BUILTIN_OBJS += builtin/reflog.o BUILTIN_OBJS += builtin/remote.o diff --git a/builtin.h b/builtin.h index c47c110..5071a08 100644 --- a/builtin.h +++ b/builtin.h @@ -99,6 +99,7 @@ extern int cmd_prune(int argc, const char **argv, const char *prefix); extern int cmd_prune_packed(int argc, const char **argv, const char *prefix); extern int cmd_push(int argc, const char **argv, const char *prefix); extern int cmd_read_tree(int argc, const char **argv, const char *prefix); +extern int cmd_rebase_status__helper(int argc, const char **argv, const char *prefix); extern int cmd_receive_pack(int argc, const char **argv, const char *prefix); extern int cmd_reflog(int argc, const char **argv, const char *prefix); extern int cmd_remote(int argc, const char **argv, const char *prefix); diff --git a/builtin/rebase--status--helper.c b/builtin/rebase--status--helper.c new file mode 100644 index 0000000..efda29c --- /dev/null +++ b/builtin/rebase--status--helper.c @@ -0,0 +1,23 @@ +#include "builtin.h" +#include "cache.h" +#include "parse-options.h" +#include "rebase--status.h" + +static const char * const git_rebase_status_helper_usage[] = { + N_("git rebase--status--helper"), + NULL +}; + +int cmd_rebase_status__helper(int argc, const char **argv, const char *prefix) +{ + struct option options[] = { + + }; + + argc = parse_options(argc, argv, prefix, options, + git_rebase_status_helper_usage, 0); + + + /* next-all */ + return rebase_status(); +} diff --git a/git-rebase.sh b/git-rebase.sh index 47ca3b9..4e1f3e1 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -43,6 +43,7 @@ continue! continue abort! abort and check out the original branch skip! skip current patch and continue edit-todo! edit the todo list during an interactive rebase +status! show the status of the current rebase " . git-sh-setup . git-sh-i18n @@ -238,7 +239,7 @@ do --verify) ok_to_skip_pre_rebase= ;; - --continue|--skip|--abort|--edit-todo) + --continue|--skip|--abort|--edit-todo|--status) test $total_argc -eq 2 || usage action=${1##--} ;; @@ -401,6 +402,9 @@ abort) edit-todo) run_specific_rebase ;; +status) + exec git rebase--status--helper + ;; esac # Make sure no rebase is in progress diff --git a/git.c b/git.c index 9efd1a3..3ebc144 100644 --- a/git.c +++ b/git.c @@ -410,6 +410,7 @@ static struct cmd_struct commands[] = { { "prune-packed", cmd_prune_packed, RUN_SETUP }, { "push", cmd_push, RUN_SETUP }, { "read-tree", cmd_read_tree, RUN_SETUP }, + { "rebase--status--helper", cmd_rebase_status__helper, RUN_SETUP }, { "receive-pack", cmd_receive_pack }, { "reflog", cmd_reflog, RUN_SETUP }, { "remote", cmd_remote, RUN_SETUP }, diff --git a/rebase--status.c b/rebase--status.c new file mode 100644 index 0000000..1962349 --- /dev/null +++ b/rebase--status.c @@ -0,0 +1,6 @@ +#include "rebase--status.h" + +int rebase_status(){ + printf("git rebase --status is not yet implemented\n"); + return 0; +} diff --git a/rebase--status.h b/rebase--status.h new file mode 100644 index 0000000..17d22a1 --- /dev/null +++ b/rebase--status.h @@ -0,0 +1,7 @@ +#ifndef REBASE__STATUS_H +#define REBASE__STATUS_H + + +extern int rebase_status(); + +#endif -- 2.0.5.6.g818b3fd -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html