From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v2 00/11] A minimal builtin rebase
Date: Tue, 04 Sep 2018 14:27:06 -0700 (PDT) [thread overview]
Message-ID: <pull.32.v2.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <20180808134830.19949-1-predatoramigo@gmail.com>
This patch series provides the bare minimum to run more than just the
trivial rebase (i.e. git rebase <upstream>): it implements the most common
options such as --onto.
It is based the latest iteration of pk/rebase-in-c.
This is the second patch series that brings us more closer to a builtin "git
rebase".
Changes since v1:
* Many commit messages were reworded.
* An indentation fix was folded into the commit that introduces the
incorrect indentation.
* A missing space after a comma was inserted.
Pratik Karki (11):
builtin rebase: support --onto
builtin rebase: support `git rebase --onto A...B`
builtin rebase: handle the pre-rebase hook and --no-verify
builtin rebase: support --quiet
builtin rebase: support the `verbose` and `diffstat` options
builtin rebase: require a clean worktree
builtin rebase: try to fast forward when possible
builtin rebase: support --force-rebase
builtin rebase: start a new rebase only if none is in progress
builtin rebase: only store fully-qualified refs in `options.head_name`
builtin rebase: support `git rebase <upstream> <switch-to>`
builtin/rebase.c | 333 +++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 320 insertions(+), 13 deletions(-)
base-commit: ac7f467fef8b836084afdce5eded047c79a6858d
Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-32%2Fdscho%2Frebase-in-c-2-basic-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-32/dscho/rebase-in-c-2-basic-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/32
Range-diff vs v1:
1: c5f67c35ea ! 1: fba1b3e2a9 builtin rebase: support --onto
@@ -15,6 +15,7 @@
command name, but to the first (non-option) command-line parameter.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
2: 35d141c32a ! 2: f9826ab58f builtin rebase: support `git rebase --onto A...B`
@@ -7,12 +7,18 @@
The equivalent shell script version of the code offers two different
error messages for the cases where there is no merge base vs more than
- one merge base. Though following the similar approach would be nice,
- this would create more complexity than it is of current. Currently, for
- simple convenience, the `get_oid_mb()` function is used whose return
- value does not discern between those two error conditions.
+ one merge base.
+
+ Though it would be nice to retain this distinction, dropping it makes it
+ possible to simply use the `get_oid_mb()` function. Besides, it happens
+ rarely in real-world scenarios.
+
+ Therefore, in the interest of keeping the code less complex, let's just
+ use that function, and live with an error message that does not
+ distinguish between those two error conditions.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
3: e223f2209d ! 3: 7100820def builtin rebase: handle the pre-rebase hook (and add --no-verify)
@@ -1,12 +1,13 @@
Author: Pratik Karki <predatoramigo@gmail.com>
- builtin rebase: handle the pre-rebase hook (and add --no-verify)
+ builtin rebase: handle the pre-rebase hook and --no-verify
This commit converts the equivalent part of the shell script
`git-legacy-rebase.sh` to run the pre-rebase hook (unless disabled), and
to interrupt the rebase with error if the hook fails.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
4: 19919e7e24 ! 4: 5034f53024 builtin rebase: support --quiet
@@ -7,19 +7,23 @@
the rebase command: both `--quiet` and `--verbose` default to `false` if
neither `--quiet` nor `--verbose` is present.
- This commit goes further and introduces `--no-quiet` which is the
- contrary of `--quiet` and it's introduction doesn't modify any
- behaviour.
+ Despite the default being `false` for both verbose and quiet mode,
+ passing the `--quiet` option will turn off verbose mode, and `--verbose`
+ will turn off quiet mode.
- Note: The `flags` field in `rebase_options` will accumulate more bits in
- subsequent commits, in particular a verbose and a diffstat flag. And as
- --quoet inthe shell scripted version of the rebase command switches off
- --verbose and --stat, and as --verbose switches off --quiet, we use the
- (negated) REBASE_NO_QUIET instead of REBASE_QUIET: this allows us to
- turn off the quiet mode and turn on the verbose and diffstat mode in a
- single OPT_BIT(), and the opposite in a single OPT_NEGBIT().
+ This patch introduces the `flags` bit field, with `REBASE_NO_QUIET`
+ as first user (with many more to come).
+
+ We do *not* use `REBASE_QUIET` here for an important reason: To keep the
+ implementation simple, this commit introduces `--no-quiet` instead of
+ `--quiet`, so that a single `OPT_NEGBIT()` can turn on quiet mode and
+ turn off verbose and diffstat mode at the same time. Likewise, the
+ companion commit which will introduce support for `--verbose` will have
+ a single `OPT_BIT()` that turns off quiet mode and turns on verbose and
+ diffstat mode at the same time.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
5: cbf318d0de ! 5: ce1e1f266a builtin rebase: support the `verbose` and `diffstat` options
@@ -11,6 +11,7 @@
calling) git_default_config().
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
6: b440bf9884 ! 6: f11f21d5c6 builtin rebase: require a clean worktree
@@ -6,6 +6,7 @@
whether the repository is ready for rebase.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
7: 0efe9b41f0 ! 7: 2ec0b744bf builtin rebase: try to fast forward when possible
@@ -11,6 +11,7 @@
rebase).
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
@@ -105,7 +106,7 @@
+ if (!(options.flags & REBASE_NO_QUIET))
+ ; /* be quiet */
+ else if (!strcmp(branch_name, "HEAD") &&
-+ resolve_ref_unsafe("HEAD", 0, NULL, &flag))
++ resolve_ref_unsafe("HEAD", 0, NULL, &flag))
+ puts(_("HEAD is up to date, rebase forced."));
+ else
+ printf(_("Current branch %s is up to date, rebase "
8: ae019dec3f ! 8: 78d90e67de builtin rebase: support --force-rebase
@@ -10,6 +10,7 @@
fast-forward even if it could.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
@@ -63,8 +64,4 @@
+ } else if (!(options.flags & REBASE_NO_QUIET))
; /* be quiet */
else if (!strcmp(branch_name, "HEAD") &&
-- resolve_ref_unsafe("HEAD", 0, NULL, &flag))
-+ resolve_ref_unsafe("HEAD", 0, NULL, &flag))
- puts(_("HEAD is up to date, rebase forced."));
- else
- printf(_("Current branch %s is up to date, rebase "
+ resolve_ref_unsafe("HEAD", 0, NULL, &flag))
9: d58d504c03 ! 9: b639bfa5a8 builtin rebase: start a new rebase only if none is in progress
@@ -7,6 +7,7 @@
ongoing rebase operation completes or is terminated.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
@@ -84,7 +85,7 @@
+ "and run me again. I am stopping in case you still "
+ "have something\n"
+ "valuable there.\n"),
-+ state_dir_base, cmd_live_rebase,buf.buf);
++ state_dir_base, cmd_live_rebase, buf.buf);
+ }
+
if (!(options.flags & REBASE_NO_QUIET))
10: ef468bf3d7 ! 10: aab01f0b8e builtin rebase: only store fully-qualified refs in `options.head_name`
@@ -12,6 +12,7 @@
"detached HEAD" for display only. Make it so.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
11: 9a26fc3fac ! 11: e64190d8ed builtin rebase: support `git rebase <upstream> <switch-to>`
@@ -7,6 +7,7 @@
`git-legacy-rebase.sh` is converted to builtin `rebase.c`.
Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
+ Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
diff --git a/builtin/rebase.c b/builtin/rebase.c
--- a/builtin/rebase.c
--
gitgitgadget
next prev parent reply other threads:[~2018-09-04 21:27 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-08 13:48 [GSoC] [PATCH 00/11] A minimal builtin rebase Pratik Karki
2018-08-08 13:48 ` [PATCH 01/11] builtin rebase: support --onto Pratik Karki
2018-08-08 19:02 ` Junio C Hamano
2018-08-24 16:21 ` Johannes Schindelin
2018-08-08 13:48 ` [PATCH 02/11] builtin rebase: support `git rebase --onto A...B` Pratik Karki
2018-08-08 19:12 ` Junio C Hamano
2018-08-26 18:36 ` Johannes Schindelin
2018-08-08 13:48 ` [PATCH 03/11] builtin rebase: handle the pre-rebase hook (and add --no-verify) Pratik Karki
2018-08-08 19:32 ` Junio C Hamano
2018-08-27 12:15 ` Johannes Schindelin
2018-08-08 13:48 ` [PATCH 04/11] builtin rebase: support --quiet Pratik Karki
2018-08-08 18:31 ` Stefan Beller
2018-08-08 19:37 ` Junio C Hamano
2018-08-27 12:31 ` Johannes Schindelin
2018-08-08 13:48 ` [PATCH 05/11] builtin rebase: support the `verbose` and `diffstat` options Pratik Karki
2018-08-08 13:48 ` [PATCH 06/11] builtin rebase: require a clean worktree Pratik Karki
2018-08-08 13:48 ` [PATCH 07/11] builtin rebase: try to fast forward when possible Pratik Karki
2018-08-08 13:48 ` [PATCH 08/11] builtin rebase: support --force-rebase Pratik Karki
2018-08-08 18:51 ` Stefan Beller
2018-08-24 16:10 ` Johannes Schindelin
2018-08-08 13:48 ` [PATCH 09/11] builtin rebase: start a new rebase only if none is in progress Pratik Karki
2018-08-08 18:59 ` Stefan Beller
2018-08-24 16:13 ` Johannes Schindelin
2018-08-08 13:48 ` [PATCH 10/11] builtin rebase: only store fully-qualified refs in `options.head_name` Pratik Karki
2018-08-08 13:48 ` [PATCH 11/11] builtin rebase: support `git rebase <upstream> <switch-to>` Pratik Karki
2018-08-08 16:03 ` Duy Nguyen
2018-08-08 18:52 ` Johannes Schindelin
2018-09-04 21:27 ` Johannes Schindelin via GitGitGadget [this message]
2018-09-04 21:27 ` [PATCH v2 01/11] builtin rebase: support --onto Pratik Karki via GitGitGadget
2018-09-04 21:27 ` [PATCH v2 02/11] builtin rebase: support `git rebase --onto A...B` Pratik Karki via GitGitGadget
2018-09-04 21:27 ` [PATCH v2 03/11] builtin rebase: handle the pre-rebase hook and --no-verify Pratik Karki via GitGitGadget
2018-09-04 21:27 ` [PATCH v2 04/11] builtin rebase: support --quiet Pratik Karki via GitGitGadget
2018-09-04 21:27 ` [PATCH v2 05/11] builtin rebase: support the `verbose` and `diffstat` options Pratik Karki via GitGitGadget
2018-09-04 21:27 ` [PATCH v2 06/11] builtin rebase: require a clean worktree Pratik Karki via GitGitGadget
2018-09-04 21:27 ` [PATCH v2 07/11] builtin rebase: try to fast forward when possible Pratik Karki via GitGitGadget
2018-09-04 21:27 ` [PATCH v2 08/11] builtin rebase: support --force-rebase Pratik Karki via GitGitGadget
2018-09-04 21:27 ` [PATCH v2 09/11] builtin rebase: start a new rebase only if none is in progress Pratik Karki via GitGitGadget
2018-09-04 21:27 ` [PATCH v2 10/11] builtin rebase: only store fully-qualified refs in `options.head_name` Pratik Karki via GitGitGadget
2018-09-08 8:52 ` SZEDER Gábor
2018-09-10 16:55 ` Junio C Hamano
2018-09-10 20:25 ` SZEDER Gábor
2018-09-04 21:27 ` [PATCH v2 11/11] builtin rebase: support `git rebase <upstream> <switch-to>` Pratik Karki via GitGitGadget
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.32.v2.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.