summaryrefslogtreecommitdiff
path: root/git-rebase.sh
AgeCommit message (Collapse)Author
2011-01-27Merge branch 'maint'Junio C Hamano
* 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-27rebase: give a better error message for bogus branchJeff King
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-27rebase: use explicit "--" with checkoutJeff King
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 maintJunio C Hamano
* mz/rebase-abort-reflog-fix: rebase --abort: do not update branch ref
2010-12-14Merge branch 'mz/maint-rebase-stat-config' into maintJunio C Hamano
* mz/maint-rebase-stat-config: rebase: only show stat if configured to true
2010-12-13Merge branch 'mz/rebase-i-verify'Junio C Hamano
* mz/rebase-i-verify: rebase: support --verify
2010-12-13Merge branch 'mz/rebase-abort-reflog-fix'Junio C Hamano
* mz/rebase-abort-reflog-fix: rebase --abort: do not update branch ref
2010-12-13Merge branch 'mz/maint-rebase-stat-config'Junio C Hamano
* mz/maint-rebase-stat-config: rebase: only show stat if configured to true
2010-11-30Merge branch 'rr/needs-clean-work-tree'Junio C Hamano
* rr/needs-clean-work-tree: Porcelain scripts: Rewrite cryptic "needs update" error message
2010-11-29rebase: only show stat if configured to trueMartin von Zweigbergk
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-24rebase --abort: do not update branch refMartin von Zweigbergk
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 --verifyMartin von Zweigbergk
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 strategyMartin von Zweigbergk
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 messageRamkumar Ramachandra
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"Junio C Hamano
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'Junio C Hamano
* os/fix-rebase-diff-no-prefix: Add --src/dst-prefix to git-formt-patch in git-rebase.sh
2010-09-10Add --src/dst-prefix to git-formt-patch in git-rebase.shOded Shimon
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 maintJunio C Hamano
* 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'Junio C Hamano
* ml/rebase-x-strategy: rebase: support -X to pass through strategy options
2010-08-18Merge branch 'jn/rebase-rename-am'Junio C Hamano
* 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-rebaseWilly Tarreau
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 optionsMike Lundy
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 filesDavid D. Kilzer
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 configurationJunio C Hamano
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-06-01rebase: improve error message when upstream argument is missingJonathan Nieder
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'Junio C Hamano
* 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'Junio C Hamano
* 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.Marc Branchaud
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-13rebase: support automatic notes copyingThomas Rast
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-13rebase: invoke post-rewrite hookThomas Rast
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 summaryMarkus Heidelberg
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 invocationStephen Boyd
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-19Merge branch 'jc/rerere'Junio C Hamano
* jc/rerere: Teach --[no-]rerere-autoupdate option to merge, revert and friends
2010-01-13Merge branch 'jc/checkout-merge-base'Junio C Hamano
* 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 testsNanako Shiraishi
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 friendsJunio C Hamano
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'Junio C Hamano
* 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-24Protect scripted Porcelains from GREP_OPTIONS insanityJunio C Hamano
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 BJunio C Hamano
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-25Use 'fast-forward' all over the placeFelipe Contreras
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-12rebase: use plumbing to show dirty stateJeff King
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-22Merge branch 'gb/apply-ignore-whitespace'Junio C Hamano
* gb/apply-ignore-whitespace: git apply: option to ignore whitespace differences
2009-08-06rebase: consistent error messages for staged and unstaged changes.Matthieu Moy
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 differencesGiuseppe Bilotta
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-02Merge branch 'sb/quiet-porcelains'Junio C Hamano
* 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 optionStephen Boyd
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-15pull, rebase: simplify to use die()Stephen Boyd
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)Michele Ballabio
Signed-off-by: Michele Ballabio <barra_cuda@katamail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-19rebase: add options passed to git-amMichele Ballabio
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'Junio C Hamano
* 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