1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-09 05:36:10 +02:00
Commit Graph

62 Commits

Author SHA1 Message Date
Nguyễn Thái Ngọc Duy 55e6b3547d rerere.c: remove the_repository references
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-12 14:50:06 +09:00
Nguyễn Thái Ngọc Duy c207e9e1f6 cache-tree.c: remove the_repository references
This case is more interesting than other boring "remove the_repo"
commits because while we need access to the object database, we cannot
simply use r->index because unpack-trees.c can operate on a temporary
index, not $GIT_DIR/index. Ideally we should be able to pass an object
database to lookup_tree() but that ship has sailed.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-12 14:50:06 +09:00
Nguyễn Thái Ngọc Duy 5b02ca38a3 wt-status.c: remove implicit dependency on the_index
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-12 14:50:05 +09:00
Junio C Hamano b17ca8f94d rebase: apply cocci patch
Favor oideq() over !oidcmp() when checking for equality.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-02 11:04:59 +09:00
Junio C Hamano b78c5fe96c Merge branch 'js/rebase-autostash-fix'
"git rebase" that has recently been rewritten in C had a few issues
in its "--autstash" feature, which have been corrected.

* js/rebase-autostash-fix:
  rebase --autostash: fix issue with dirty submodules
  rebase --autostash: demonstrate a problem with dirty submodules
  rebase (autostash): use an explicit OID to apply the stash
  rebase (autostash): store the full OID in <state-dir>/autostash
  rebase (autostash): avoid duplicate call to state_dir_path()
2018-11-02 11:04:58 +09:00
Junio C Hamano 7ce32f72e3 Merge branch 'jc/rebase-in-c-5-test-typofix'
Typofix.

* jc/rebase-in-c-5-test-typofix:
  rebase: fix typoes in error messages
2018-11-02 11:04:57 +09:00
Junio C Hamano ee5e90434e Merge branch 'pk/rebase-in-c-6-final'
The final step of rewriting "rebase -i" in C.

* pk/rebase-in-c-6-final:
  rebase: default to using the builtin rebase
2018-11-02 11:04:56 +09:00
Junio C Hamano 4b3517ee9d Merge branch 'js/rebase-in-c-5.5-work-with-rebase-i-in-c'
"rebase" that has been rewritten learns the new calling convention
used by "rebase -i" that was rewritten in C, tying the loose end
between two GSoC topics that stomped on each other's toes.

* js/rebase-in-c-5.5-work-with-rebase-i-in-c:
  builtin rebase: prepare for builtin rebase -i
2018-11-02 11:04:56 +09:00
Junio C Hamano fd1a9e903f Merge branch 'pk/rebase-in-c-5-test'
Rewrite "git rebase" in C.

* pk/rebase-in-c-5-test:
  builtin rebase: error out on incompatible option/mode combinations
  builtin rebase: use no-op editor when interactive is "implied"
  builtin rebase: show progress when connected to a terminal
  builtin rebase: fast-forward to onto if it is a proper descendant
  builtin rebase: optionally pass custom reflogs to reset_head()
  builtin rebase: optionally auto-detect the upstream
2018-11-02 11:04:55 +09:00
Junio C Hamano 0293121717 Merge branch 'pk/rebase-in-c-4-opts'
Rewrite "git rebase" in C.

* pk/rebase-in-c-4-opts:
  builtin rebase: support --root
  builtin rebase: add support for custom merge strategies
  builtin rebase: support `fork-point` option
  merge-base --fork-point: extract libified function
  builtin rebase: support --rebase-merges[=[no-]rebase-cousins]
  builtin rebase: support `--allow-empty-message` option
  builtin rebase: support `--exec`
  builtin rebase: support `--autostash` option
  builtin rebase: support `-C` and `--whitespace=<type>`
  builtin rebase: support `--gpg-sign` option
  builtin rebase: support `--autosquash`
  builtin rebase: support `keep-empty` option
  builtin rebase: support `ignore-date` option
  builtin rebase: support `ignore-whitespace` option
  builtin rebase: support --committer-date-is-author-date
  builtin rebase: support --rerere-autoupdate
  builtin rebase: support --signoff
  builtin rebase: allow selecting the rebase "backend"
2018-11-02 11:04:55 +09:00
Junio C Hamano 39f7331545 Merge branch 'pk/rebase-in-c-3-acts'
Rewrite "git rebase" in C.

* pk/rebase-in-c-3-acts:
  builtin rebase: stop if `git am` is in progress
  builtin rebase: actions require a rebase in progress
  builtin rebase: support --edit-todo and --show-current-patch
  builtin rebase: support --quit
  builtin rebase: support --abort
  builtin rebase: support --skip
  builtin rebase: support --continue
2018-11-02 11:04:54 +09:00
Junio C Hamano e0720a3867 Merge branch 'pk/rebase-in-c-2-basic'
Rewrite "git rebase" in C.

* pk/rebase-in-c-2-basic:
  builtin rebase: support `git rebase <upstream> <switch-to>`
  builtin rebase: only store fully-qualified refs in `options.head_name`
  builtin rebase: start a new rebase only if none is in progress
  builtin rebase: support --force-rebase
  builtin rebase: try to fast forward when possible
  builtin rebase: require a clean worktree
  builtin rebase: support the `verbose` and `diffstat` options
  builtin rebase: support --quiet
  builtin rebase: handle the pre-rebase hook and --no-verify
  builtin rebase: support `git rebase --onto A...B`
  builtin rebase: support --onto
2018-11-02 11:04:53 +09:00
Johannes Schindelin ffae8b2f90 rebase --autostash: fix issue with dirty submodules
Since we cannot stash dirty submodules, there is no use in requiring
them to be clean (or stash them when they are not).

This brings the built-in rebase in line with the previous, scripted
version, which also did not care about dirty submodules (but it was
admittedly not very easy to figure that out).

This fixes https://github.com/git-for-windows/git/issues/1820

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-24 13:38:15 +09:00
Johannes Schindelin b98e914e46 rebase (autostash): use an explicit OID to apply the stash
When `git stash apply <argument>` sees an argument that consists only of
digits, it tries to be smart and interpret it as `stash@{<number>}`.

Unfortunately, an all-digit hash (which is unlikely but still possible)
is therefore misinterpreted as `stash@{<n>}` reflog.

To prevent that from happening, let's append `^0` after the stash hash,
to make sure that it is interpreted as an OID rather than as a number.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-23 13:18:01 +09:00
Johannes Schindelin 12aeb00a22 rebase (autostash): store the full OID in <state-dir>/autostash
It was reported by Gábor Szeder and analyzed by Alban Gruin that the
built-in rebase stores only abbreviated stash hashes in the `autostash`
file.

This is problematic e.g. in t5520-pull.sh, where the abbreviated hash is
so short that it sometimes consists only of digits, which are
subsequently mistaken ("DWIMmed") for numbers by `git stash apply`.

Let's align the behavior of the built-in rebase with the scripted rebase
and store the full stash hash instead. That makes it a lot less likely
that it consists only of digits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-23 13:17:08 +09:00
Johannes Schindelin 71064e6008 rebase (autostash): avoid duplicate call to state_dir_path()
We already called that function at this point, and stored the result in
the `path` variable. We might just as well use it ;-)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-23 13:17:08 +09:00
Junio C Hamano f240918d2b rebase: fix typoes in error messages
The separator between words in a multi-word option name is a dash,
not an underscore.

Inspired by a matching change by Ralf Thielow for the scripted
version of "git rebase".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:21:08 +09:00
Pratik Karki 5541bd5b8f rebase: default to using the builtin rebase
Now that the builtin rebase is feature-complete, we should use it by
default. Let's keep the legacy scripted version around for the time
being; Once the builtin rebase is well-tested enough, we can remove
`git-legacy-rebase.sh`.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:19:42 +09:00
Johannes Schindelin bc24382c2b builtin rebase: prepare for builtin rebase -i
The builtin rebase and the builtin interactive rebase have been
developed independently, on purpose: Google Summer of Code rules
specifically state that students have to work on independent projects,
they cannot collaborate on the same project.

One fallout is that the rebase-in-c and rebase-i-in-c patches cause no
merge conflicts but a royal number of tests in the test suite to fail.

It is easy to explain why: rebase-in-c was developed under the
assumption that all rebase backends are implemented in Unix shell script
and can be sourced via `. git-rebase--<backend>`, which is no longer
true with rebase-i-in-c, where git-rebase--interactive is a hard-linked
builtin.

This patch fixes that.

Please note that we also skip the finish_rebase() call for interactive
rebases because the built-in interactive rebase already takes care of
that. This is needed to support the upcoming `break` command that wants
to interrupt the rebase with exit code 0 (and naturally wants to keep
the state directory intact when doing so).

While at it, remove the `case` arm for the interactive rebase that is
now skipped in favor of the short-cut to the built-in rebase.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:18:47 +09:00
Pratik Karki b361bd754d builtin rebase: error out on incompatible option/mode combinations
While working on the GSoC project to convert the rebase command to a
builtin, the rebase command learned to error out on certain command-line
option combinations that cannot work, such as --whitespace=fix with
--interactive.

This commit converts that code.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:16:05 +09:00
Pratik Karki 3dba9d0884 builtin rebase: use no-op editor when interactive is "implied"
Some options are only handled by the git-rebase--interactive backend,
even if run non-interactively. For this awkward situation (run
non-interactively, but use the interactive backend), the shell scripted
version of `git rebase` introduced the concept of an "implied
interactive rebase". All it does is to replace the editor by a dummy one
(`:` is the Unix command that takes arbitrary command-line parameters,
ignores them and simply exits with success).

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:16:05 +09:00
Pratik Karki cda614e489 builtin rebase: show progress when connected to a terminal
In this commit, we pass `--progress` to the `format-patch` command if
stderr is connected to an interactive terminal, unless we're in quiet
mode.

This `--progress` option will be used in `format-patch` to show progress
reports on stderr as patches are generated.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:16:05 +09:00
Pratik Karki 7eecfa5601 builtin rebase: fast-forward to onto if it is a proper descendant
When trying to rebase onto a direct descendant of HEAD, we can
take a shortcut and fast-forward instead. This commit makes it so.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:16:05 +09:00
Pratik Karki fa443d40b1 builtin rebase: optionally pass custom reflogs to reset_head()
In the next patch, we will make use of that in the code that
fast-forwards to `onto` whenever possible.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:16:05 +09:00
Pratik Karki 8f5986d95a builtin rebase: optionally auto-detect the upstream
The `git rebase` command, when called without the `<upstream>`
command-line argument, automatically looks for the upstream
branch configured for the current branch.

With this commit, the builtin rebase learned that trick, too.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:16:05 +09:00
Pratik Karki 9dba809a69 builtin rebase: support --root
This option allows to rebase entire histories up to, and including, the
root commit.

The conversion from the shell script is straight-forward, apart from
the fact that we do not have to write an empty tree in C.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:12:45 +09:00
Pratik Karki ba1905a5fe builtin rebase: add support for custom merge strategies
When running a rebase in non-am mode, it uses the recursive merge to
cherry-pick the commits, and the rebase command allows to configure
the merge strategy to be used in this operation.

This commit adds that support to the builtin rebase.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:12:45 +09:00
Pratik Karki 92d0d74e8d builtin rebase: support `fork-point` option
This commit adds support for `--fork-point` and `--no-fork-point`.
This is converted as-is from `git-legacy-rebase.sh`.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:12:45 +09:00
Pratik Karki 3c3588c7d3 builtin rebase: support --rebase-merges[=[no-]rebase-cousins]
The mode to rebase non-linear branches is now supported by the builtin
rebase, too.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:12:45 +09:00
Pratik Karki 9b3a448b4e builtin rebase: support `--allow-empty-message` option
This commit introduces the `--allow-empty-message` option to
`builtin/rebase.c`. The motivation behind this option is: if there are
empty messages (which is not allowed in Git by default, but can be
imported from different version control systems), the rebase will fail.

Using `--allow-empty-message` overrides that behaviour which will allow
the commits having empty messages to continue in rebase operation.

Note: a very recent change made this the default in the shell scripted
`git rebase`, therefore the builtin rebase does the same.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:12:45 +09:00
Pratik Karki 68e46d7868 builtin rebase: support `--exec`
This commit adds support for the `--exec` option which takes a shell
command-line as argument. This argument will be appended as an `exec
<cmd>` command after each line in the todo list that creates a commit in
the final history.  commands.

Note: while the shell script version of `git rebase` assigned the empty
string to `cmd` by default, we *unset* it here because the code looks
nicer and it does not change the behavior.

The `--exec` option requires `--interactive` machinery.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:12:45 +09:00
Pratik Karki 6defce2b02 builtin rebase: support `--autostash` option
To support `--autostash` we introduce a function `apply_autostash()`
just like in `git-legacy-rebase.sh`.

Rather than refactoring and using the same function that exists in
`sequencer.c`, we go a different route here, to avoid clashes with
the sister GSoC project that turns the interactive rebase into a
builtin.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:12:45 +09:00
Pratik Karki 7998dbe1ec builtin rebase: support `-C` and `--whitespace=<type>`
This commit converts more code from the shell script version to the
builtin rebase. In this instance, we just have to be careful to
keep support for passing multiple `--whitespace` options, as the
shell script version does so, too.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:12:42 +09:00
Pratik Karki 12026a412c builtin rebase: support `--gpg-sign` option
This commit introduces support for `--gpg-sign` option which is used
to GPG-sign commits.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-11 14:09:39 +09:00
Pratik Karki 051910a956 builtin rebase: support `--autosquash`
This commit adds support for the `--autosquash` option which is used to
automatically squash the commits marked as `squash` or `fixup` in their
messages. This is converted following `git-legacy-rebase.sh` closely.

This option can also be configured via the Git config setting
rebase.autosquash. To support this, we also add a custom
rebase_config() function in this commit that will be used instead (and
falls back to) git_default_config().

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:56:20 -07:00
Pratik Karki 002ee2fe68 builtin rebase: support `keep-empty` option
The `--keep-empty` option can be used to keep the commits that do not
change anything from its parents in the result.

While the scripted version uses `interactive_rebase=implied` to indicate
that the rebase needs to use the `git-rebase--interactive` backend in
non-interactive mode as fallback when figuring out which backend to use,
the C version needs to use a different route because the backend will
already be chosen during the `parse_options()` call.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:56:20 -07:00
Pratik Karki 53f9e5be94 builtin rebase: support `ignore-date` option
This commit adds support for `--ignore-date` which is passed to `git am`
to easily change the dates of the rebased commits.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:56:20 -07:00
Pratik Karki 99d8cc7ce8 builtin rebase: support `ignore-whitespace` option
This commit adds support for the `--ignore-whitespace` option
of the rebase command. This option is simply passed to the
`--am` backend.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:56:20 -07:00
Pratik Karki 38dbcef26e builtin rebase: support --committer-date-is-author-date
This option is simply handed down to `git am` by way of setting the
`git_am_opt` variable that is handled by the `git-rebase--am` backend.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:56:19 -07:00
Pratik Karki ead98c111b builtin rebase: support --rerere-autoupdate
The `--rerere-autoupdate` option allows rerere to update the index with
resolved conflicts. This commit follows closely the equivalent part of
`git-legacy-rebase.sh`.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:56:19 -07:00
Pratik Karki 73d51ed0a5 builtin rebase: support --signoff
This commit adds support for `--signoff` which is used to add a
`Signed-off-by` trailer to all the rebased commits. The actual
handling is left to the rebase backends.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:56:19 -07:00
Pratik Karki 361badd393 builtin rebase: allow selecting the rebase "backend"
With this commit the builtin rebase supports selecting the "rebase
backends" (or "type") `interactive`, `preserve-merges`, and `merge`.

The `state_dir` was already handled according to the rebase type in a
previous commit.

Note that there is one quirk in the shell script: `--interactive`
followed by `--merge` won't reset the type to "merge" but keeps the type
as "interactive". And as t3418 tests this explicitly, we have to support
it in the builtin rebase, too.

Likewise, `--interactive` followed by `--preserve-merges` makes it an
"explicitly interactive" rebase, i.e. a rebase that should show the todo
list, while `--preserve-merges` alone is not interactive (and t5520
tests for this via `git pull --rebase=preserve`).

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:56:19 -07:00
Pratik Karki 0eabf4b95c builtin rebase: stop if `git am` is in progress
This commit checks for the file `applying` used by `git am` in
`rebase-apply/` and if the file is present it means `git am` is in
progress so it errors out.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:55:58 -07:00
Pratik Karki d732a57078 builtin rebase: actions require a rebase in progress
This commit prevents actions (such as --continue, --skip) from running
when there is no rebase in progress.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:55:58 -07:00
Pratik Karki 51e9ea6da7 builtin rebase: support --edit-todo and --show-current-patch
While these sub-commands are very different in spirit, their
implementation is almost identical, so we convert them in one go.

And since those are the last sub-commands that needed to be converted,
now we can also turn that `default:` case into a bug (because we should
now handle all the actions).

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:55:58 -07:00
Pratik Karki 5a61494539 builtin rebase: support --quit
With this patch, the builtin rebase handles the `--quit` action which
can be used to abort a rebase without rolling back any changes performed
during the rebase (this is useful when a user forgot that they were in
the middle of a rebase and continued working normally).

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:55:58 -07:00
Pratik Karki 5e5d96197c builtin rebase: support --abort
This commit teaches the builtin rebase the "abort" action, which a user
can call to roll back a rebase that is in progress.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:55:58 -07:00
Pratik Karki 122420c295 builtin rebase: support --skip
This commit adds the option `--skip` which is used to restart
rebase after skipping the current patch.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:55:58 -07:00
Pratik Karki f95736288a builtin rebase: support --continue
This commit adds the option `--continue` which is used to resume
rebase after merge conflicts. The code tries to stay as close to
the equivalent shell scripts found in `git-legacy-rebase.sh` as
possible.

When continuing a rebase, the state variables are read from state_dir.
Some of the state variables are not actually stored there, such as
`upstream`. The shell script version simply does not set them, but for
consistency, we unset them in the builtin version.

Signed-off-by: Pratik Karki <predatoramigo@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:55:58 -07:00
Pratik Karki e65123a71d builtin rebase: support `git rebase <upstream> <switch-to>`
This commit adds support for `switch-to` which is used to switch to the
target branch if needed. The equivalent codes found in shell script
`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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-09-06 11:55:43 -07:00