summaryrefslogtreecommitdiff
path: root/git-rebase.sh
AgeCommit message (Collapse)AuthorFilesLines
2011-01-27Merge branch 'maint'Libravatar Junio C Hamano1-1/+2
* maint: rebase -i: clarify in-editor documentation of "exec" tests: sanitize more git environment variables fast-import: treat filemodify with empty tree as delete rebase: give a better error message for bogus branch rebase: use explicit "--" with checkout Conflicts: t/t9300-fast-import.sh
2011-01-26rebase: give a better error message for bogus branchLibravatar Jeff King1-0/+1
When you give a non-existent branch to git-rebase, it spits out the usage. This can be confusing, since you may understand the usage just fine, but simply have made a mistake in the branch name. Before: $ git rebase origin bogus Usage: git rebase ... After: $ git rebase origin bogus fatal: no such branch: bogus Usage: git rebase ... Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-01-26rebase: use explicit "--" with checkoutLibravatar Jeff King1-1/+1
In the case of a ref/pathname conflict, checkout will already do the right thing and checkout the ref. However, for a non-existant ref, this has two advantages: 1. If a file with that pathname exists, rebase will refresh the file from the index and then rebase the current branch instead of producing an error. 2. If no such file exists, the error message using an explicit "--" is better: # before $ git rebase -i origin bogus error: pathspec 'bogus' did not match any file(s) known to git. Could not checkout bogus # after $ git rebase -i origin bogus fatal: invalid reference: bogus Could not checkout bogus The problems seem to be trigger-able only through "git rebase -i", as regular git-rebase checks the validity of the branch parameter as a ref very early on. However, it doesn't hurt to be defensive. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-12-14Merge branch 'mz/rebase-abort-reflog-fix' into maintLibravatar Junio C Hamano1-9/+10
* mz/rebase-abort-reflog-fix: rebase --abort: do not update branch ref
2010-12-14Merge branch 'mz/maint-rebase-stat-config' into maintLibravatar Junio C Hamano1-1/+2
* mz/maint-rebase-stat-config: rebase: only show stat if configured to true
2010-12-12Merge branch 'mz/rebase-i-verify'Libravatar Junio C Hamano1-0/+3
* mz/rebase-i-verify: rebase: support --verify
2010-12-12Merge branch 'mz/rebase-abort-reflog-fix'Libravatar Junio C Hamano1-9/+10
* mz/rebase-abort-reflog-fix: rebase --abort: do not update branch ref
2010-12-12Merge branch 'mz/maint-rebase-stat-config'Libravatar Junio C Hamano1-1/+2
* mz/maint-rebase-stat-config: rebase: only show stat if configured to true
2010-11-29Merge branch 'rr/needs-clean-work-tree'Libravatar Junio C Hamano1-13/+1
* rr/needs-clean-work-tree: Porcelain scripts: Rewrite cryptic "needs update" error message
2010-11-29rebase: only show stat if configured to trueLibravatar Martin von Zweigbergk1-1/+2
If rebase.stat is set to true, a diffstat should be displayed. If it is not set, it should default to false. However, if it is explicitly set to false (or other value), a diffstat is still displayed, which is probably not what most users would expect. Show diffstat only if it is set to true. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-23rebase --abort: do not update branch refLibravatar Martin von Zweigbergk1-9/+10
If a non-interactive rebase of a ref fails at commit X and is aborted by the user, the ref will be updated twice. First to point at X (with the reflog message "rebase finished: $head_name onto $onto"), and then back to $orig_head. It should not be updated at all. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-23rebase: support --verifyLibravatar Martin von Zweigbergk1-0/+3
Interactive rebase allows the '--verify' option to be passed, but it will be ignored. Implement proper support for the option for both interactive and non-interactive rebase by making it override any previous '--no-verify'. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-10rebase -X: do not clobber strategyLibravatar Martin von Zweigbergk1-4/+0
If any strategy options are passed to -X, the strategy will always be set to 'recursive'. According to the documentation, it should default to 'recursive' if it is not set, but it should be possible to set it to other values. This fixes a regression introduced in v1.7.3-rc0~67^2 (2010-07-29). Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-28Porcelain scripts: Rewrite cryptic "needs update" error messageLibravatar Ramkumar Ramachandra1-13/+1
Although Git interally has the facility to differentiate between porcelain and plubmbing commands and appropriately print errors, several shell scripts invoke plubming commands triggering cryptic plumbing errors to be displayed on a porcelain interface. This patch replaces the "needs update" message in git-pull and git-rebase, when `git update-index` is run, with a more friendly message. Reported-by: Joshua Jensen <jjensen@workspacewhiz.com> Reported-by: Thore Husfeldt <thore.husfeldt@gmail.com> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13shell portability: no "export VAR=VAL"Libravatar Junio C Hamano1-1/+1
It is more portable to say "VAR=VAL && export VAR" instead. Noticed by Ævar. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-15Merge branch 'os/fix-rebase-diff-no-prefix'Libravatar Junio C Hamano1-0/+1
* os/fix-rebase-diff-no-prefix: Add --src/dst-prefix to git-formt-patch in git-rebase.sh
2010-09-09Add --src/dst-prefix to git-formt-patch in git-rebase.shLibravatar Oded Shimon1-0/+1
For the case of "diff.noprefix" in git-config, git-format-patch should still output diff with standard prefixes for git-am Signed-off-by: Oded Shimon <ods15@ods15.dyndns.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-20Merge branch 'jn/rebase-rename-am' into maintLibravatar Junio C Hamano1-1/+1
* jn/rebase-rename-am: rebase: protect against diff.renames configuration t3400 (rebase): whitespace cleanup Teach "apply --index-info" to handle rename patches t4150 (am): futureproof against failing tests t4150 (am): style fix
2010-08-18Merge branch 'ml/rebase-x-strategy'Libravatar Junio C Hamano1-1/+23
* ml/rebase-x-strategy: rebase: support -X to pass through strategy options
2010-08-18Merge branch 'jn/rebase-rename-am'Libravatar Junio C Hamano1-1/+1
* jn/rebase-rename-am: rebase: protect against diff.renames configuration t3400 (rebase): whitespace cleanup Teach "apply --index-info" to handle rename patches t4150 (am): futureproof against failing tests t4150 (am): style fix
2010-08-09git-rebase: fix typo when parsing --force-rebaseLibravatar Willy Tarreau1-1/+1
Due to two missing hyphens, The "force" keyword on the command line would be taken as an alias for the --force-rebase option. Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-03rebase: support -X to pass through strategy optionsLibravatar Mike Lundy1-1/+23
git-rebase calls out to merge strategies, but did not support merge strategy options so far. Add this, in the same style used in git-merge. Sadly we have to do the full quoting/eval dance here, since merge-recursive supports the --subtree=<path> option which potentially contains whitespace. This patch does not cover git rebase -i, which does not call any merge strategy directly except in --preserve-merges, and even then only for merges. [jc: with a trivial fix-up for 'expr'] Signed-off-by: Mike Lundy <mike@fluffypenguin.org> Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-28Fix git rebase --continue to work with touched filesLibravatar David D. Kilzer1-0/+1
When performing a non-interactive rebase, sometimes "git rebase --continue" will fail if an unmodified file is touched in the working directory: You must edit all merge conflicts and then mark them as resolved using git add This is caused by "git diff-files" reporting a difference between the index and the filesystem: :100644 100644 d00491...... 000000...... M file The fix is to run "git update-index --refresh" before "git diff-files" as is done in git-rebase--interactive. Signed-off-by: David D. Kilzer <ddkilzer@kilzer.net> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-23rebase: protect against diff.renames configurationLibravatar Junio C Hamano1-1/+1
We currently do not disable diff.renames configuration while rebase internally runs "format-patch" to feed "am -3". The end user configuration for "diff" should not affect the result produced by the higher level command that is related to "diff" only because internally it is implemented in terms of it. For that matter, I have a feeling that format-patch should not even look at diff.renames, but we seem to have been doing this for a long time so there is no easy way to fix this thinko. In any case, here is a much straightforward fix for "rebase". [jn: with test case from David] Reported-by: David D. Kilzer <ddkilzer@kilzer.net> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-31rebase: improve error message when upstream argument is missingLibravatar Jonathan Nieder1-9/+8
Strip out options before checking for a missing upstream argument. Before: $ git rebase -m shift: 426: can't shift that many After: $ git rebase -m Usage: git rebase ... While at it, fix the usage message to explain that the upstream argument is mandatory. Reported-by: Jon Dowland <jmtd@debian.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-04-03Merge branch 'mb/rebase-i-no-ff'Libravatar Junio C Hamano1-2/+2
* mb/rebase-i-no-ff: Teach rebase the --no-ff option. Conflicts: git-rebase--interactive.sh t/t3404-rebase-interactive.sh
2010-03-24Merge branch 'tr/notes-display'Libravatar Junio C Hamano1-0/+6
* tr/notes-display: git-notes(1): add a section about the meaning of history notes: track whether notes_trees were changed at all notes: add shorthand --ref to override GIT_NOTES_REF commit --amend: copy notes to the new commit rebase: support automatic notes copying notes: implement helpers needed for note copying during rewrite notes: implement 'git notes copy --stdin' rebase -i: invoke post-rewrite hook rebase: invoke post-rewrite hook commit --amend: invoke post-rewrite hook Documentation: document post-rewrite hook Support showing notes from more than one notes tree test-lib: unset GIT_NOTES_REF to stop it from influencing tests Conflicts: git-am.sh refs.c
2010-03-24Teach rebase the --no-ff option.Libravatar Marc Branchaud1-2/+2
For git-rebase.sh, --no-ff is a synonym for --force-rebase. For git-rebase--interactive.sh, --no-ff cherry-picks all the commits in the rebased branch, instead of fast-forwarding over any unchanged commits. --no-ff offers an alternative way to deal with reverted merges. Instead of "reverting the revert" you can use "rebase --no-ff" to recreate the branch with entirely new commits (they're new because at the very least the committer time is different). This obviates the need to revert the reversion, as you can re-merge the new topic branch directly. Added an addendum to revert-a-faulty-merge.txt describing the situation and how to use --no-ff to handle it. Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-12rebase: support automatic notes copyingLibravatar Thomas Rast1-0/+1
Luckily, all the support already happens to be there. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-12rebase: invoke post-rewrite hookLibravatar Thomas Rast1-0/+5
We have to deal with two separate code paths: a normal rebase, which actually goes through git-am; and rebase {-m|-s}. The only small issue with both is that they need to remember the original sha1 across a possible conflict resolution. rebase -m already puts this information in $dotest/current, and we just introduce a similar file for git-am. Note that in git-am, the hook really only runs when coming from git-rebase: the code path that sets the $dotest/original-commit file is guarded by a test for $dotest/rebasing. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-30rebase: don't invoke the pager for each commit summaryLibravatar Markus Heidelberg1-1/+1
This regression was introduced by commit 0aa958d (rebase: replace antiquated sed invocation, 2010-01-24), which changed the invocation of "git rev-list | sed" to "git log". It can be reproduced by something like this: $ git rebase -s recursive origin/master Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-25rebase: replace antiquated sed invocationLibravatar Stephen Boyd1-4/+2
Use the modern form of printing a commit subject instead of piping the output of rev-list to sed. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-18Merge branch 'jc/rerere'Libravatar Junio C Hamano1-1/+5
* jc/rerere: Teach --[no-]rerere-autoupdate option to merge, revert and friends
2010-01-13Merge branch 'jc/checkout-merge-base'Libravatar Junio C Hamano1-1/+23
* jc/checkout-merge-base: rebase -i: teach --onto A...B syntax rebase: fix --onto A...B parsing and add tests "rebase --onto A...B" replays history on the merge base between A and B "checkout A...B" switches to the merge base between A and B
2010-01-07rebase: fix --onto A...B parsing and add testsLibravatar Nanako Shiraishi1-14/+19
The previous patch didn't parse "rebase --onto A...B" correctly when A isn't an empty string. It also tried to be careful to notice a case in which there are more than one merge bases, but forgot to give --all option to merge-base, making the test pointless. Fix these problems and add a test script to verify. Improvements to the script to parse A...B syntax was taken from review comments by Johannes Schindelin. Signed-off-by: しらいし ななこ <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-04Teach --[no-]rerere-autoupdate option to merge, revert and friendsLibravatar Junio C Hamano1-1/+5
Introduce a command line option to override rerere.autoupdate configuration variable to make it more useful. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-25Merge branch 'rs/work-around-grep-opt-insanity'Libravatar Junio C Hamano1-1/+1
* rs/work-around-grep-opt-insanity: Protect scripted Porcelains from GREP_OPTIONS insanity mergetool--lib: simplify guess_merge_tool() Conflicts: git-instaweb.sh
2009-11-23Protect scripted Porcelains from GREP_OPTIONS insanityLibravatar Junio C Hamano1-1/+1
If the user has exported the GREP_OPTIONS environment variable, the output from "grep" and "egrep" in scripted Porcelains may be different from what they expect. For example, we may want to count number of matching lines, by "grep" piped to "wc -l", and GREP_OPTIONS=-C3 will break such use. The approach taken by this change to address this issue is to protect only our own use of grep/egrep. Because we do not unset it at the beginning of our scripts, hook scripts run from the scripted Porcelains are exposed to the same insanity this environment variable causes when grep/egrep is used to implement logic (e.g. "grep | wc -l"), and it is entirely up to the hook scripts to protect themselves. On the other hand, applypatch-msg hook may want to show offending words in the proposed commit log message using grep to the end user, and the user might want to set GREP_OPTIONS=--color to paint the match more visibly. The approach to protect only our own use without unsetting the environment variable globally will allow this use case. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-21"rebase --onto A...B" replays history on the merge base between A and BLibravatar Junio C Hamano1-1/+18
This is in spirit similar to "checkout A...B". To re-queue a new set of patches for a series that the original author prepared to apply on 'next' on the same base as before, you would do something like this: $ git checkout next^0 $ git am -s rerolled-series.mbox $ git rebase --onto next...jh/notes next The first two commands recreates commits to be rebased as the original author intended (i.e. applies directly on top of 'next'), and the rebase command replays that history on top of the same commit the series being replaced was built on (which is typically much older than the tip of 'next'). Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-24Use 'fast-forward' all over the placeLibravatar Felipe Contreras1-1/+1
It's a compound word. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-11rebase: use plumbing to show dirty stateLibravatar Jeff King1-1/+1
Commit 4cfbe06 introduced the use of "git diff" to show dirty state in a format more familiar to users. However, it should have used the plumbing "git diff-files" instead. Not only is it good practice in general to use plumbing in scripts, but in this case we really don't want the automatic pager to kick in for an error message. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-21Merge branch 'gb/apply-ignore-whitespace'Libravatar Junio C Hamano1-0/+3
* gb/apply-ignore-whitespace: git apply: option to ignore whitespace differences
2009-08-06rebase: consistent error messages for staged and unstaged changes.Libravatar Matthieu Moy1-2/+4
Previous version expose the output of the plumbing update-index to the user, which novice users have difficulty to understand. We still need to run update-index to refresh the cache (if diff.autorefreshindex is false, git diff won't do it). Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-05git apply: option to ignore whitespace differencesLibravatar Giuseppe Bilotta1-0/+3
Introduce --ignore-whitespace option and corresponding config bool to ignore whitespace differences while applying patches, akin to the 'patch' program. 'git am', 'git rebase' and the bash git completion are made aware of this option. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-01Merge branch 'sb/quiet-porcelains'Libravatar Junio C Hamano1-10/+38
* sb/quiet-porcelains: stash: teach quiet option am, rebase: teach quiet option submodule, repack: migrate to git-sh-setup's say() git-sh-setup: introduce say() for quiet options am: suppress apply errors when using 3-way t4150: test applying with a newline in subject
2009-06-18am, rebase: teach quiet optionLibravatar Stephen Boyd1-10/+38
git-am and git-rebase are talkative scripts. Teach them to be quiet when told, allowing them to speak only when they fail or experience errors. The quiet option is maintained when git-am or git-rebase fails to apply a patch. This means subsequent --resolved, --continue, --skip, --abort invocations will be quiet if the original invocation was quiet. Drop a handful of >&2 redirection; the rest of the program sends all the info messages to stdout, not to stderr. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-14pull, rebase: simplify to use die()Libravatar Stephen Boyd1-6/+3
Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-27rebase: fix typo (force_rebas -> force-rebas)Libravatar Michele Ballabio1-1/+1
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-18rebase: add options passed to git-amLibravatar Michele Ballabio1-0/+4
Add the options --committer-date-is-author-date and --ignore-date to git-rebase. They were introduced in commit a79ec62d0 for git-am. These options imply --force-rebase. Signed-off-by: Michele Ballabio <barra_cuda@katamail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-11Merge branch 'tv/rebase-stat'Libravatar Junio C Hamano1-7/+18
* tv/rebase-stat: git-pull: Allow --stat and --no-stat to be used with --rebase git-rebase: Add --stat and --no-stat for producing diffstat on rebase