[PATCH v2 12/18] builtin rebase: support `--exec`

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki This commit adds support for the `--exec` option which takes a shell command-line as argument. This argument will be appended as an `exec ` command after each line in the todo list that creates a commit in the final history. commands. Note: while the shell script version

[PATCH v2 17/18] builtin rebase: add support for custom merge strategies

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed

[PATCH v2 16/18] builtin rebase: support `fork-point` option

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed-off-by: Johannes Schindelin --- builtin/rebase.c | 11 +++ 1 file changed, 11 insertions(+) diff --git

[PATCH v2 11/18] builtin rebase: support `--autostash` option

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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

[PATCH v2 13/18] builtin rebase: support `--allow-empty-message` option

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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

[PATCH v2 18/18] builtin rebase: support --root

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed-off-by: Johannes Schindelin

[PATCH v2 09/18] builtin rebase: support `--gpg-sign` option

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki This commit introduces support for `--gpg-sign` option which is used to GPG-sign commits. Signed-off-by: Pratik Karki Signed-off-by: Johannes Schindelin --- builtin/rebase.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/builtin/rebase.c b

[PATCH v2 15/18] merge-base --fork-point: extract libified function

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki We need this functionality in the builtin rebase. Note: to make this function truly reusable, we have to switch the call get_merges_many_dirty() to get_merges_many() because we want the commit flags to be reset (otherwise, subsequent get_merge_bases() calls would obtain

[PATCH v2 10/18] builtin rebase: support `-C` and `--whitespace=`

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed-off

[PATCH v2 14/18] builtin rebase: support --rebase-merges[=[no-]rebase-cousins]

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki The mode to rebase non-linear branches is now supported by the builtin rebase, too. Signed-off-by: Pratik Karki Signed-off-by: Johannes Schindelin --- builtin/rebase.c | 21 + 1 file changed, 21 insertions(+) diff --git a/builtin/rebase.c b/builtin

[PATCH v2 08/18] builtin rebase: support `--autosquash`

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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

[PATCH v2 07/18] builtin rebase: support `keep-empty` option

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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

[PATCH v2 06/18] builtin rebase: support `ignore-date` option

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed-off-by: Johannes Schindelin --- builtin/rebase.c | 8 1 file changed, 8 insertions(+) diff --git

[PATCH v2 02/18] builtin rebase: support --signoff

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed-off-by: Johannes Schindelin --- builtin/rebase.c | 17

[PATCH v2 05/18] builtin rebase: support `ignore-whitespace` option

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed-off-by: Johannes Schindelin --- builtin/rebase.c | 6 ++ 1 file changed, 6 insertions(+) diff

[PATCH v2 03/18] builtin rebase: support --rerere-autoupdate

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed-off-by: Johannes Schindelin --- builtin/rebase.c | 25

[PATCH v2 04/18] builtin rebase: support --committer-date-is-author-date

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed-off-by: Johannes Schindelin --- builtin/rebase.c | 10 ++ 1 file changed, 10 insertions

[PATCH v2 01/18] builtin rebase: allow selecting the rebase "backend"

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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

[PATCH v2 07/11] builtin rebase: try to fast forward when possible

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki In this commit, we add support to fast forward. Note: we will need the merge base later, therefore the call to can_fast_forward() really needs to be the first one when testing whether we can skip the rebase entirely (otherwise, it would make more sense to skip the possibly

[PATCH v2 10/11] builtin rebase: only store fully-qualified refs in `options.head_name`

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki When running a rebase on a detached HEAD, we currently store the string "detached HEAD" in options.head_name. That is a faithful translation of the shell script version, and we still kind of need it for the purposes of the scripted backends. It is poor style for

[PATCH v2 04/11] builtin rebase: support --quiet

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki This commit introduces a rebase option `--quiet`. While `--quiet` is commonly perceived as opposite to `--verbose`, this is not the case for the rebase command: both `--quiet` and `--verbose` default to `false` if neither `--quiet` nor `--verbose` is present. Despite

[PATCH v2 02/11] builtin rebase: support `git rebase --onto A...B`

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki This commit implements support for an --onto argument that is actually a "symmetric range" i.e. `...`. 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. Thoug

[PATCH v2 11/11] builtin rebase: support `git rebase `

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed-off-by: Johannes Schindelin --- builtin

[PATCH v2 09/11] builtin rebase: start a new rebase only if none is in progress

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki To run a new rebase, there needs to be a check to assure that no other rebase is in progress. New rebase operation cannot start until an ongoing rebase operation completes or is terminated. Signed-off-by: Pratik Karki Signed-off-by: Johannes Schindelin --- builtin/rebase.c

[PATCH v2 03/11] builtin rebase: handle the pre-rebase hook and --no-verify

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki 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 Signed-off-by: Johannes Schindelin --- builtin/rebase.c

[PATCH v2 01/11] builtin rebase: support --onto

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki The `--onto` option is important, as it allows to rebase a range of commits onto a different base commit (which gave the command its odd name: "rebase"). This commit introduces options parsing so that different options can be added in future commits. Note: As t

[PATCH v2 05/11] builtin rebase: support the `verbose` and `diffstat` options

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki This commit introduces support for the `-v` and `--stat` options of rebase. The --stat option can also be configured via the Git config setting rebase.stat. To support this, we also add a custom rebase_config() function in this commit that will be used instead of (and falls

[PATCH v2 08/11] builtin rebase: support --force-rebase

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki In this commit, we add support to `--force-rebase` option. The equivalent part of the shell script found in `git-legacy-rebase.sh` is converted as faithfully as possible to C. The --force-rebase option ensures that the rebase does not simply fast-forward even if it could

[PATCH v2 06/11] builtin rebase: require a clean worktree

2018-09-04 Thread Pratik Karki via GitGitGadget
From: Pratik Karki This commit reads the index of the repository for rebase and checks whether the repository is ready for rebase. Signed-off-by: Pratik Karki Signed-off-by: Johannes Schindelin --- builtin/rebase.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/builtin

[GSoC] [PATCH 0/1] default to builtin rebase

2018-08-08 Thread Pratik Karki
other, i.e. they depend on this order. Pratik Karki (1): rebase: default to using the builtin rebase builtin/rebase.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.18.0

[PATCH 1/1] rebase: default to using the builtin rebase

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 2 +- 1 file

[PATCH 5/6] builtin rebase: use no-op editor when interactive is "implied"

2018-08-08 Thread Pratik Karki
quot;. 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 --- builtin/rebase.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/builtin/rebase.c

[PATCH 3/6] builtin rebase: fast-forward to onto if it is a proper descendant

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index

[PATCH 1/6] builtin rebase: optionally auto-detect the upstream

2018-08-08 Thread Pratik Karki
The `git rebase` command, when called without the `` 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 --- builtin/rebase.c | 44

[PATCH 6/6] builtin rebase: error out on incompatible option/mode combinations

2018-08-08 Thread Pratik Karki
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

[GSoC] [PATCH 0/6] builtin rebase rest

2018-08-08 Thread Pratik Karki
isn't due to my patches) for extra testing other than my system. The next in line patch series which I'll be sending out today are: default to builtin rebase: This will turn on the feature-complete builtin rebase to on. These patch series are built on top of each other, i.e. they depend on this orde

[PATCH 4/6] builtin rebase: show progress when connected to a terminal

2018-08-08 Thread Pratik Karki
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

[PATCH 2/6] builtin rebase: optionally pass custom reflogs to reset_head()

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 33 + 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/builtin/rebase.c b/builtin/rebase.c

[PATCH 16/18] builtin rebase: support `fork-point` option

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index 0b94d2daaa

[PATCH 14/18] builtin rebase: support --rebase-merges[=[no-]rebase-cousins]

2018-08-08 Thread Pratik Karki
The mode to rebase non-linear branches is now supported by the builtin rebase, too. Signed-off-by: Pratik Karki --- builtin/rebase.c | 21 + 1 file changed, 21 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index dfb1e6c25b..0b94d2daaa 100644 --- a/builtin

[PATCH 17/18] builtin rebase: add support for custom merge strategies

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 57

[PATCH 15/18] merge-base --fork-point: extract libified function

2018-08-08 Thread Pratik Karki
). This did not matter when the function was called in `git rev-parse --fork-point` because in that command, the process definitely did not traverse any commits before exiting. Signed-off-by: Pratik Karki --- builtin/merge-base.c | 81 commit.c | 81

[PATCH 18/18] builtin rebase: support --root

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 31

[PATCH 13/18] builtin rebase: support `--allow-empty-message` option

2018-08-08 Thread Pratik Karki
-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 --- builtin/rebase.c | 7

[PATCH 11/18] builtin rebase: support `--autostash` option

2018-08-08 Thread Pratik Karki
into a builtin. Signed-off-by: Pratik Karki --- builtin/rebase.c | 117 +++ 1 file changed, 109 insertions(+), 8 deletions(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index 4437c86513..a6bfa73915 100644 --- a/builtin/rebase.c +++ b/builtin

[PATCH 12/18] builtin rebase: support `--exec`

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 18 ++ 1 file changed, 18 insertions(+) diff

[PATCH 09/18] builtin rebase: support `--gpg-sign` option

2018-08-08 Thread Pratik Karki
This commit introduces support for `--gpg-sign` option which is used to GPG-sign commits. Signed-off-by: Pratik Karki --- builtin/rebase.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index 79ba65fd75..cd9caf4841 100644

[PATCH 10/18] builtin rebase: support `-C` and `--whitespace=`

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 23

[PATCH 08/18] builtin rebase: support `--autosquash`

2018-08-08 Thread Pratik Karki
. 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 --- builtin/rebase.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c

[PATCH 07/18] builtin rebase: support `keep-empty` option

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 24 1 file changed, 24 insertions(+) diff --git a/builtin

[PATCH 05/18] builtin rebase: support `ignore-whitespace` option

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index

[PATCH 04/18] builtin rebase: support --committer-date-is-author-date

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index

[PATCH 02/18] builtin rebase: support --signoff

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 17 + 1 file changed, 17 insertions(+) diff --git a/builtin

[PATCH 01/18] builtin rebase: allow selecting the rebase "backend"

2018-08-08 Thread Pratik Karki
nteractive" 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 --- builtin/rebase.c | 37 + 1 file changed,

[PATCH 03/18] builtin rebase: support --rerere-autoupdate

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 25 + 1 file changed, 25 insertions(+) diff --git

[PATCH 06/18] builtin rebase: support `ignore-date` option

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 8 1 file changed, 8 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index 7490d215ef

[GSoC] [PATCH 00/18] builtin rebase options

2018-08-08 Thread Pratik Karki
are built on top of each other, i.e. they depend on this order. Pratik Karki (18): builtin rebase: allow selecting the rebase "backend" builtin rebase: support --signoff builtin rebase: support --rerere-autoupdate builtin rebase: support --committer-date-is-author-date bui

[PATCH 7/7] builtin rebase: stop if `git am` is in progress

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 5 + 1 file changed, 5 insertions(+) diff --git a/builtin/rebase.c b/builtin

[PATCH 6/7] builtin rebase: actions require a rebase in progress

2018-08-08 Thread Pratik Karki
This commit prevents actions (such as --continue, --skip) from running when there is no rebase in progress. Signed-off-by: Pratik Karki --- builtin/rebase.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index e3dd2f511e..1344e071f3 100644

[PATCH 5/7] builtin rebase: support --edit-todo and --show-current-patch

2018-08-08 Thread Pratik Karki
). Signed-off-by: Pratik Karki --- builtin/rebase.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index 0d805480a1..e3dd2f511e 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -472,6 +472,8 @@ int cmd_rebase

[PATCH 1/7] builtin rebase: support --continue

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 115 +-- strbuf.c | 9

[GSoC] [PATCH 0/7] builtin rebase actions

2018-08-08 Thread Pratik Karki
hese patch series are built on top of each other, i.e. they depend on this order. Pratik Karki (7): builtin rebase: support --continue builtin rebase: support --skip builtin rebase: support --abort builtin rebase: support --quit builtin rebase: support --edit-todo and --show-current-patch

[PATCH 3/7] builtin rebase: support --abort

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 20 1 file changed, 20 insertions(+) diff --git a/builtin/rebase.c b/builtin/reba

[PATCH 2/7] builtin rebase: support --skip

2018-08-08 Thread Pratik Karki
This commit adds the option `--skip` which is used to restart rebase after skipping the current patch. Signed-off-by: Pratik Karki --- builtin/rebase.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index 10da4c978b..7a903838b1 100644

[PATCH 4/7] builtin rebase: support --quit

2018-08-08 Thread Pratik Karki
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

[PATCH 10/11] builtin rebase: only store fully-qualified refs in `options.head_name`

2018-08-08 Thread Pratik Karki
uld really only want a valid, fully-qualified ref name as value, and NULL for detached HEADs, using "detached HEAD" for display only. Make it so. Signed-off-by: Pratik Karki --- builtin/rebase.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/builti

[PATCH 09/11] builtin rebase: start a new rebase only if none is in progress

2018-08-08 Thread Pratik Karki
To run a new rebase, there needs to be a check to assure that no other rebase is in progress. New rebase operation cannot start until an ongoing rebase operation completes or is terminated. Signed-off-by: Pratik Karki --- builtin/rebase.c | 48 +++- 1

[PATCH 11/11] builtin rebase: support `git rebase `

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 48

[PATCH 07/11] builtin rebase: try to fast forward when possible

2018-08-08 Thread Pratik Karki
if, say, running an interactive rebase). Signed-off-by: Pratik Karki --- builtin/rebase.c | 72 1 file changed, 72 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index afef0b0046..52a218cd18 100644 --- a/builtin/rebase.c +++ b/builtin

[PATCH 08/11] builtin rebase: support --force-rebase

2018-08-08 Thread Pratik Karki
In this commit, we add support to `--force-rebase` option. The equivalent part of the shell script found in `git-legacy-rebase.sh` is converted as faithfully as possible to C. The --force-rebase option ensures that the rebase does not simply fast-forward even if it could. Signed-off-by: Pratik

[GSoC] [PATCH 00/11] A minimal builtin rebase

2018-08-08 Thread Pratik Karki
y GSoC mentors since, this is the final week of GSoC and other GSoC students most likely have submitted their respective works which will need lots of review. Pratik Karki (11): builtin rebase: support --onto builtin rebase: support `git rebase --onto A...B` builtin rebase: handle the pre-

[PATCH 05/11] builtin rebase: support the `verbose` and `diffstat` options

2018-08-08 Thread Pratik Karki
) git_default_config(). Signed-off-by: Pratik Karki --- builtin/rebase.c | 60 ++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index 19fa4d3fc4..2d3f1d65fb 100644 --- a/builtin/rebase.c +++ b/builtin

[PATCH 02/11] builtin rebase: support `git rebase --onto A...B`

2018-08-08 Thread Pratik Karki
r 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. Signed-off-by: Pratik Karki --- builtin/rebase.c | 8 +++- 1 file

[PATCH 01/11] builtin rebase: support --onto

2018-08-08 Thread Pratik Karki
introduces to the parse_options() call (which "eats" argv[0]), the argc is now expected to be lower by one after this patch, compared to before this patch: argv[0] no longer refers to the command name, but to the first (non-option) command-line parameter. Signed-off-by: Pratik Karki --- b

[PATCH 06/11] builtin rebase: require a clean worktree

2018-08-08 Thread Pratik Karki
This commit reads the index of the repository for rebase and checks whether the repository is ready for rebase. Signed-off-by: Pratik Karki --- builtin/rebase.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index 2d3f1d65fb..afef0b0046

[PATCH 03/11] builtin rebase: handle the pre-rebase hook (and add --no-verify)

2018-08-08 Thread Pratik Karki
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 --- builtin/rebase.c | 11 +++ 1 file changed, 11 insertions(+) diff

[PATCH 04/11] builtin rebase: support --quiet

2018-08-08 Thread Pratik Karki
(). Signed-off-by: Pratik Karki --- builtin/rebase.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/builtin/rebase.c b/builtin/rebase.c index b79f9b0a9f..19fa4d3fc4 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -79,6 +79,10 @@ struct rebase_options { int root

[GSoC] [PATCH v6 2/3] rebase: refactor common shell functions into their own file

2018-08-06 Thread Pratik Karki
in the following commits. Signed-off-by: Pratik Karki --- Unchanged since v5. .gitignore| 1 + Makefile | 1 + git-legacy-rebase.sh | 69 ++- git-rebase--common.sh | 68 ++ 4 files changed, 72

[GSoC] [PATCH v6 1/3] rebase: start implementing it as a builtin

2018-08-06 Thread Pratik Karki
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 `git -c rebase.useBuiltin=true rebase ...` Signed-off-by: Pratik Karki --- Unchanged since v5. .gitignore

[GSoC] [PATCH v6 0/3] rebase: rewrite rebase in C

2018-08-06 Thread Pratik Karki
but upcoming patches will add more functionality like moving or updating to original branch. - Lots of changes that fix bugs discovered while getting the test suite to pass with the patch series. Pratik Karki (3): rebase: start implementing it as a builtin rebase: refac

[GSoC] [PATCH v6 3/3] builtin/rebase: support running "git rebase "

2018-08-06 Thread Pratik Karki
ill handle and support all the wonderful rebase options. Signed-off-by: Pratik Karki --- builtin/rebase.c | 365 ++- 1 file changed, 364 insertions(+), 1 deletion(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index c44addb2a4..e695d8a

Re: What's cooking in git.git (Aug 2018, #01; Thu, 2)

2018-08-02 Thread Pratik Karki
Hi Junio, On Fri, Aug 3, 2018 at 4:47 AM Junio C Hamano wrote: > > * pk/rebase-in-c (2018-07-30) 3 commits > - builtin/rebase: support running "git rebase " > - rebase: refactor common shell functions into their own file > - rebase: start implementing it as a builtin > > Rewrite of the

Re: [GSoC] [PATCH v5 0/3] rebase: rewrite rebase in C

2018-07-31 Thread Pratik Karki
Hi Junio, During recent development, I found out that `v5` has some issues and shouldn't be merged into `next`. I implemented more options and ran a couple of regression tests from which I figured out that certain choices I made in those commits need to be reconsidered. During recent

[PATCH v5 3/3] builtin/rebase: support running "git rebase "

2018-07-30 Thread Pratik Karki
xt commits will handle and support all the wonderful rebase options. Signed-off-by: Pratik Karki --- builtin/rebase.c | 350 ++- 1 file changed, 349 insertions(+), 1 deletion(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index c44addb2a4..5863139

[PATCH v5 2/3] rebase: refactor common shell functions into their own file

2018-07-30 Thread Pratik Karki
in the following commits. Signed-off-by: Pratik Karki --- Unchanged since v4. .gitignore| 1 + Makefile | 1 + git-legacy-rebase.sh | 69 ++- git-rebase--common.sh | 68 ++ 4 files changed, 72

[PATCH v5 1/3] rebase: start implementing it as a builtin

2018-07-30 Thread Pratik Karki
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 `git -c rebase.useBuiltin=true rebase ...` Signed-off-by: Pratik Karki --- .gitignore| 1

[GSoC] [PATCH v5 0/3] rebase: rewrite rebase in C

2018-07-30 Thread Pratik Karki
(as pointed out by Duy Nguyen). - Fix the macro `GIT_PATH_FUNC` which expands to function definition and doesn't require semicolons (as pointed out by Beat Bolli). Pratik Karki (3): rebase: start implementing it as a builtin rebase: refactor common shell functions into their own file

Re: [PATCH] fixup! builtin/rebase: support running "git rebase "

2018-07-21 Thread Pratik Karki
> +static GIT_PATH_FUNC(merge_dir, "rebase-merge") > First of all, I apologize for not replying earlier to your review. I have already fixed this macro in my local repository. The new iteration of my patches was being held due to fixup of `detach_head_to()` and I will soon submit a new iteration of patch within a day or two. Thank you for pointing this out. Cheers, Pratik Karki

Re: [GSoC] GSoC with git, week 10

2018-07-11 Thread Pratik Karki
Hi, On Tue, Jul 10, 2018 at 10:05 PM Alban Gruin wrote: > > Hi, > > I published a new blog post: > > https://blog.pa1ch.fr/posts/2018/07/10/en/gsoc2018-week-10.html > Nice work. Sorry for late notification, my blog is up too. https://prertik.github.io/post/week-10 Cheers, Pratik

Re: [PATCH v4 3/4] sequencer: refactor the code to detach HEAD to checkout.c

2018-07-09 Thread Pratik Karki
Hi, On Mon, Jul 9, 2018 at 3:16 AM Johannes Schindelin wrote: > > Hi Pratik, > > On Sun, 8 Jul 2018, Pratik Karki wrote: > > > diff --git a/checkout.c b/checkout.c > > index bdefc888ba..da68915fd7 100644 > > --- a/checkout.c > > +++ b/checkout.c >

Re: [PATCH v4 3/4] sequencer: refactor the code to detach HEAD to checkout.c

2018-07-09 Thread Pratik Karki
On Mon, Jul 9, 2018 at 10:27 PM Junio C Hamano wrote: > > Pratik Karki writes: > > > In the upcoming builtin rebase, we will have to start by detaching > > the HEAD, just like shell script version does. Essentially, we have > > to do the same thing as `git ch

Re: [PATCH v4 1/4] rebase: start implementing it as a builtin

2018-07-09 Thread Pratik Karki
Hi, On Mon, Jul 9, 2018 at 2:21 PM Eric Sunshine wrote: > > On Mon, Jul 9, 2018 at 3:59 AM Andrei Rybak wrote: > > On 2018-07-08 20:01, Pratik Karki wrote: > > > +static int use_builtin_rebase(void) > > > +{ > > > + struct child_process cp = CHILD_PROC

[PATCH v4 4/4] builtin/rebase: support running "git rebase "

2018-07-08 Thread Pratik Karki
ause those variables would then be visible by processes spawned from the rebase backends. Instead, we work hard to set them in the shell script snippet. The next commits will handle and support all the wonderful rebase options. Signed-off-by: Pratik Karki --- builtin/reba

[PATCH v4 3/4] sequencer: refactor the code to detach HEAD to checkout.c

2018-07-08 Thread Pratik Karki
. It does not make a huge difference, and the upside is that this closes a few (unlikely) code paths where the index would not be unlocked upon error. Signed-off-by: Pratik Karki --- checkout.c | 64 + checkout.h | 3 +++ sequencer.c | 58

[PATCH v4 2/4] rebase: refactor common shell functions into their own file

2018-07-08 Thread Pratik Karki
in the following commits. Signed-off-by: Pratik Karki --- .gitignore| 1 + Makefile | 1 + git-legacy-rebase.sh | 69 ++- git-rebase--common.sh | 68 ++ 4 files changed, 72 insertions(+), 67

[PATCH v4 1/4] rebase: start implementing it as a builtin

2018-07-08 Thread Pratik Karki
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 `git -c rebase.useBuiltin=true rebase ...` Signed-off-by: Pratik Karki --- .gitignore| 1

[GSoC] [PATCH v4 0/4] rebase: rewrite rebase in C

2018-07-08 Thread Pratik Karki
a minimal builtin rebase which supports running `git rebase ` 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. Pratik Karki (4): rebase

[PATCH v3 4/4] builtin/rebase: support running "git rebase "

2018-07-06 Thread Pratik Karki
ause those variables would then be visible by processes spawned from the rebase backends. Instead, we work hard to set them in the shell script snippet. The next commits will handle and support all the wonderful rebase options. Signed-off-by: Pratik Karki --- builtin/reba

[PATCH v3 3/4] sequencer: refactor the code to detach HEAD to checkout.c

2018-07-06 Thread Pratik Karki
. It does not make a huge difference, and the upside is that this closes a few (unlikely) code paths where the index would not be unlocked upon error. Signed-off-by: Pratik Karki --- checkout.c | 64 + checkout.h | 3 +++ sequencer.c | 58

[PATCH v3 1/4] rebase: start implementing it as a builtin

2018-07-06 Thread Pratik Karki
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 `git -c rebase.useBuiltin=true rebase ...` Signed-off-by: Pratik Karki --- .gitignore| 1 + Makefile

  1   2   >