Re: [GSoC] [PATCH v4 0/4] rebase: rewrite rebase in C
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jul 8, 2018, 21:14 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1807082311540.75@tvgsbejvaqbjf.bet>
- In-Reply-To
- <20180708180104.17921-1-predatoramigo@gmail.com>
Hi Pratik,
On Sun, 8 Jul 2018, Pratik Karki wrote:
Show 24 quoted lines
> As a GSoC project, I have been working on the builtin rebase. > > The motivation behind the rewrite of rebase i.e. from shell script to C > are for following reasons: > > 1. Writing shell scripts and getting it to production is much faster > than doing the equivalent in C but lacks in performance and extra > workarounds are needed for non-POSIX platforms. > > 2. Git for Windows is at loss as the installer size increases due to > addition of extra dependencies for the shell scripts which are usually > available in POSIX compliant platforms. > > This series of patches serves to demonstrate a minimal builtin rebase > which supports running `git rebase <upstream>` and also serves to ask for > reviews. > > Changes since v3: > > - Fix commit message of `rebase: start implementing it as a builtin`. > > - Acknowledge Junio's style reviews. > > - Acknowledge Johannes Schindelin's review.
The range-diff looks like this (and makes sense to me; you might want to fix the typo s/retun/return/, but that's all for now):
-- snipsnap --
1: 7baec70f219 ! 1: 42778b20edf rebase: start implementing it as a builtin
@@ -13,6 +13,12 @@
be able to conveniently test new features by configuring
`rebase.useBuiltin`. + In the original difftool conversion, if sane_execvp() that attempts to
+ run the legacy scripted version returned with non-negative status, the
+ command silently exited without doing anything with success, but
+ sane_execvp() should not retun with non-negative status in the first
+ place, so we use die() to notice such an abnormal case.
+
We intentionally avoid reading the config directly to avoid
messing up the GIT_* environment variables when we need to fall back to
exec()ing the shell script. The test of builtin rebase can be done by
2: f385f42dc56 ! 2: a28be7308e6 rebase: refactor common shell functions into their own file
@@ -45,6 +45,20 @@
diff --git a/git-legacy-rebase.sh b/git-legacy-rebase.sh
--- a/git-legacy-rebase.sh
+++ b/git-legacy-rebase.sh
+@@
+ LF='
+ '
+ ok_to_skip_pre_rebase=
+-resolvemsg="
+-$(gettext 'Resolve all conflicts manually, mark them as resolved with
+-"git add/rm <conflicted_files>", then run "git rebase --continue".
+-You can instead skip this commit: run "git rebase --skip".
+-To abort and get back to the state before "git rebase", run "git rebase --abort".')
+-"
++
+ squash_onto=
+ unset onto
+ unset restrict_revision
@@
true) gpg_sign_opt=-S ;;
*) gpg_sign_opt= ;;
@@ -128,6 +142,13 @@
+++ b/git-rebase--common.sh
@@
+
++resolvemsg="
++$(gettext 'Resolve all conflicts manually, mark them as resolved with
++"git add/rm <conflicted_files>", then run "git rebase --continue".
++You can instead skip this commit: run "git rebase --skip".
++To abort and get back to the state before "git rebase", run "git rebase --abort".')
++"
++
+write_basic_state () {
+ echo "$head_name" > "$state_dir"/head-name &&
+ echo "$onto" > "$state_dir"/onto &&
3: 147699bd195 = 3: 7591098c4d1 sequencer: refactor the code to detach HEAD to checkout.c
4: bbaa4264caa ! 4: f8429e950a4 builtin/rebase: support running "git rebase <upstream>"
@@ -232,13 +232,14 @@
+ }
+
+ /*
-+ * If the branch to rebase is given, that is the branch we will rebase
-+ * branch_name -- branch/commit being rebased, or HEAD (already detached)
-+ * orig_head -- commit object name of tip of the branch before rebasing
-+ * head_name -- refs/heads/<that-branch> or "detached HEAD"
-+ */
++ * If the branch to rebase is given, that is the branch we will rebase
++ * branch_name -- branch/commit being rebased, or
++ * HEAD (already detached)
++ * orig_head -- commit object name of tip of the branch before rebasing
++ * head_name -- refs/heads/<that-branch> or "detached HEAD"
++ */
+ if (argc > 1)
-+ die ("TODO: handle switch_to");
++ die("TODO: handle switch_to");
+ else {
+ /* Do not need to switch branches, we are already on it. */
+ options.head_name =