Skip to content

Commit 05882cd

Browse files
derrickstoleegitster
authored andcommitted
rebase: add rebase.updateRefs config option
The previous change added the --update-refs command-line option. For users who always want this mode, create the rebase.updateRefs config option which behaves the same way as rebase.autoSquash does with the --autosquash option. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 22457e1 commit 05882cd

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

Documentation/config/rebase.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ rebase.autoStash::
2121
`--autostash` options of linkgit:git-rebase[1].
2222
Defaults to false.
2323

24+
rebase.updateRefs::
25+
If set to true enable `--update-refs` option by default.
26+
2427
rebase.missingCommitsCheck::
2528
If set to "warn", git rebase -i will print a warning if some
2629
commits are removed (e.g. a line was deleted), however the

Documentation/git-rebase.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,10 @@ start would be overridden by the presence of
615615
are being rebased. Any branches that are checked out in a worktree
616616
or point to a `squash! ...` or `fixup! ...` commit are not updated
617617
in this way.
618+
+
619+
If the `--update-refs` option is enabled by default using the
620+
configuration variable `rebase.updateRefs`, this option can be
621+
used to override and disable this setting.
618622

619623
INCOMPATIBLE OPTIONS
620624
--------------------

builtin/rebase.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,11 @@ static int rebase_config(const char *var, const char *value, void *data)
802802
return 0;
803803
}
804804

805+
if (!strcmp(var, "rebase.updaterefs")) {
806+
opts->update_refs = git_config_bool(var, value);
807+
return 0;
808+
}
809+
805810
if (!strcmp(var, "rebase.reschedulefailedexec")) {
806811
opts->reschedule_failed_exec = git_config_bool(var, value);
807812
return 0;

t/t3404-rebase-interactive.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,11 @@ test_expect_success '--update-refs adds git branch commands' '
17681768
exec git update-ref refs/heads/no-conflict-branch HEAD $(git rev-parse M)
17691769
EOF
17701770
1771+
test_cmp expect todo &&
1772+
1773+
test_must_fail git -c rebase.autosquash=true \
1774+
-c rebase.updaterefs=true \
1775+
rebase -i primary >todo &&
17711776
test_cmp expect todo
17721777
)
17731778
'

0 commit comments

Comments
 (0)