summaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
AgeCommit message (Collapse)Author
2008-07-17Merge branch 'maint'Junio C Hamano
* maint: Start preparing 1.5.6.4 release notes git fetch-pack: do not complain about "no common commits" in an empty repo rebase-i: keep old parents when preserving merges t7600-merge: Use test_expect_failure to test option parsing Fix buffer overflow in prepare_attr_stack Fix buffer overflow in git diff Fix buffer overflow in git-grep git-cvsserver: fix call to nonexistant cleanupWorkDir() Documentation/git-cherry-pick.txt et al.: Fix misleading -n description Conflicts: RelNotes
2008-07-16rebase-i: keep old parents when preserving mergesStephan Beyer
When "rebase -i -p" tries to preserve merges of unrelated branches, it lost some parents: - When you have more than two parents, the commit in the new history ends up with fewer than expected number of parents and this breakage goes unnoticed; - When you are rebasing a merge with two parents and one is lost, the command tries to cherry-pick the original merge commit, and the command fails. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16Rename ".dotest/" to ".git/rebase" and ".dotest-merge" to "rebase-merge"Johannes Schindelin
Since the files generated and used during a rebase are never to be tracked, they should live in $GIT_DIR. While at it, avoid the rather meaningless term "dotest" to "rebase", and unhide ".dotest-merge". This was wished for on the mailing list, but so far unimplemented. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-15Merge branch 'jc/rebase-orig-head'Junio C Hamano
* jc/rebase-orig-head: Documentation: mention ORIG_HEAD in am, merge, and rebase Teach "am" and "rebase" to mark the original position with ORIG_HEAD
2008-07-13Make rebase--interactive use OPTIONS_SPECStephan Beyer
Also add some checks that --continue/--abort/--skip actions are used without --onto, -p, -t, etc. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-07Teach "am" and "rebase" to mark the original position with ORIG_HEADJunio C Hamano
"merge" and "reset" leave the original point in history in ORIG_HEAD, which makes it easy to go back to where you were before you inflict a major damage to your history and realize that you do not like the result at all. These days with reflog, we technically do not need to use ORIG_HEAD, but it is a handy way nevertheless. This teaches "am" and "rebase" (all forms --- the vanilla one that uses "am" as its backend, "-m" variant that cherry-picks, and "--interactive") to do the same. The original idea and a partial implementation to do this only for "rebase -m" was by Brian Gernhardt; this extends on his idea. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-08git-rebase -i: mention the short command aliases in the todo listMiklos Vajna
git rebase -i already supports 'p', 'e' and 's' as aliases for 'pick', 'edit' and 'squash', but one could know it only by reading the source code. If a user rebases a lot, it's quite handy, so mention these short forms as well. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-03rebase --interactive: Compute upstream SHA1 before switching branchesJohannes Sixt
If the upstream argument to rebase (the first argument) was relative to HEAD and the name of the branch to rebase (the second argument) was given, the upstream would have been interpreted relative to the second argument. In particular, this command git rebase -i HEAD topic would always finish with "Nothing to do". (a1bf91e fixed the same issue for non-interactive rebase.) Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-15Ignore dirty submodule states during rebase and stashJohannes Schindelin
When rebasing or stashing, chances are that you do not care about dirty submodules, since they are not updated by those actions anyway. So ignore the submodules' states. Note: the submodule states -- as committed in the superproject -- will still be stashed and rebased, it is _just_ the state of the submodule in the working tree which is ignored. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-13remove use of "tail -n 1" and "tail -1"Jeff King
The "-n" syntax is not supported by System V versions of tail (which prefer "tail -1"). Unfortunately "tail -1" is not actually POSIX. We had some of both forms in our scripts. Since neither form works everywhere, this patch replaces both with the equivalent sed invocation: sed -ne '$p' Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-13grep portability fix: don't use "-e" or "-q"Jeff King
System V versions of grep (such as Solaris /usr/bin/grep) don't understand either of these options. git's usage of "grep -e pattern" fell into one of two categories: 1. equivalent to "grep pattern". -e is only useful here if the pattern begins with a "-", but all of the patterns are hardcoded and do not begin with a dash. 2. stripping comments and blank lines with grep -v -e "^$" -e "^#" We can fortunately do this in the affirmative as grep '^[^#]' Uses of "-q" can be replaced with redirection to /dev/null. In many tests, however, "grep -q" is used as "if this string is in the expected output, we are OK". In this case, it is fine to just remove the "-q" entirely; it simply makes the "verbose" mode of the test slightly more verbose. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-27Prompt to continue when editing during rebase --interactiveJonathan del Strother
On hitting an edit point in an interactive rebase, git should prompt the user to run "git rebase --continue" Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-11rebase -i: accept -m as advertised in the man pageUwe Kleine-K,Av(Bnig
Signed-off-by: Uwe Kleine-K,Av(Bnig <Uwe.Kleine-Koenig@digi.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-15Squelch bogus progress output from git-rebase--interactiveJunio C Hamano
The command repeats "Rebasing (1/1)" many times even when there is only one task remaining, because mark_action_done() is called to skip comment and empty lines in the TODO file. This should fix it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-30git-rebase -i: clean-up error check codepath.Junio C Hamano
After replaying a single change, the code performed a number of checks, but some of them were for sanity checking, failures from which should make the command abort, and others were checks to see if it should make a new commit object. Stringing them together with "&&" was wrong. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-30git-rebase -i behaves better on commits with incomplete messagesJunio C Hamano
The commit message template when squashing multiple commits is prepared by concatenating the messages of existing commits together. If the messages from some of them end with incomplete lines, this would result in a suboptimal message template. Make sure that we add a terminating LF after each commit message. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20Reallow git-rebase --interactive --continue if commit is unnecessaryShawn O. Pearce
During git-rebase --interactive's --continue implementation we used to silently restart the rebase if the user had made the commit for us. This is common if the user stops to edit a commit and does so by amending it. My recent change to watch git-commit's exit status broke this behavior. Thanks to Bernt Hansen for catching it in 1.5.4-rc1. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20Catch and handle git-commit failures in git-rebase --interactiveShawn O. Pearce
If git-commit fails for any reason then git-rebase needs to stop and not plow through the rest of the series. Its unlikely that a future git-commit will succeed if the current attempt failed. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20Avoid update hook during git-rebase --interactiveShawn O. Pearce
If we are rebasing changes that contain potential whitespace errors that our .git/hooks/pre-commit hook looks for and fails on then git-commit will fail to commit that change. This causes git-rebase--interactive to squash commits together, even though it was not requested to do so by the todo file. Passing --no-verify to git-commit makes git-rebase -i behave more like git-rebase normally would in such conditions, providing more consistent behavior between the different rebase implementations. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-19Fix interactive rebase to preserve author email addressSean
Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-18rebase -p -i: handle "no changes" gracefullyJohannes Schindelin
Since commit 376ccb8cbb453343998e734d8a1ce79f57a4e092 (rebase -i: style fixes and minor cleanups), unchanged SHA-1s are no longer mapped via $REWRITTEN. But the updating phase was not prepared for the old head not being rewritten. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-03Merge branch 'js/rebase-i-rerere'Junio C Hamano
* js/rebase-i-rerere: rebase -i: give rerere a chance
2007-11-30revert/cherry-pick: Allow overriding the help text by the calling PorcelainWincent Colaiuta
A Porcelain command that uses cherry-pick or revert may make a commit out of resolved index itself, in which case telling the user to commit the result is not appropriate at all. This allows GIT_CHERRY_PICK_HELP environment variable to be set by the calling Porcelain in order to override the built-in help text. [jc: this is heavily modified from the original but should be equivalent in spirit] Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-29rebase -i: give rerere a chanceJohannes Schindelin
Like non-interactive rebase, interactive mode now calls rerere when appropriate. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-29Merge branch 'maint'Junio C Hamano
* maint: scripts: do not get confused with HEAD in work tree Improve description of git-branch -d and -D in man page.
2007-11-29scripts: do not get confused with HEAD in work treeJunio C Hamano
When you have a file called HEAD in your work tree, many commands that our scripts feed "HEAD" to would complain about the rev vs path ambiguity. A solution is to form command line more carefully by appending -- to them, which makes it clear that we mean HEAD rev not HEAD file. This patch would apply to maint. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22rebase -i: move help to end of todo fileJohannes Schindelin
[PATCH] rebase -i: move help to end of todo file Many editors start in the first line, so the 9-line help text was an annoyance. So move it to the end. Requested by Junio. While at it, add a hint how to abort the rebase. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-18Merge branch 'ph/parseopt-sh'Junio C Hamano
* ph/parseopt-sh: git-quiltimport.sh fix --patches handling git-am: -i does not take a string parameter. sh-setup: don't let eval output to be shell-expanded. git-sh-setup: fix parseopt `eval` string underquoting Give git-am back the ability to add Signed-off-by lines. git-rev-parse --parseopt scripts: Add placeholders for OPTIONS_SPEC Migrate git-repack.sh to use git-rev-parse --parseopt Migrate git-quiltimport.sh to use git-rev-parse --parseopt Migrate git-checkout.sh to use git-rev-parse --parseopt --keep-dashdash Migrate git-instaweb.sh to use git-rev-parse --parseopt Migrate git-merge.sh to use git-rev-parse --parseopt Migrate git-am.sh to use git-rev-parse --parseopt Migrate git-clone to use git-rev-parse --parseopt Migrate git-clean.sh to use git-rev-parse --parseopt. Update git-sh-setup(1) to allow transparent use of git-rev-parse --parseopt Add a parseopt mode to git-rev-parse to bring parse-options to shell scripts.
2007-11-09Merge branch 'maint'Junio C Hamano
* maint: Start preparing for 1.5.3.6 git-send-email: Change the prompt for the subject of the initial message. SubmittingPatches: improve the 'Patch:' section of the checklist instaweb: Minor cleanups and fixes for potential problems stop t1400 hiding errors in tests Makefile: add missing dependency on wt-status.h refresh_index_quietly(): express "optional" nature of index writing better Fix sed string regex escaping in module_name. Avoid a few unportable, needlessly nested "...`...". git-mailsplit: with maildirs not only process cur/, but also new/ Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-08Avoid a few unportable, needlessly nested "...`...".Ralf Wildenhues
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-06scripts: Add placeholders for OPTIONS_SPECJunio C Hamano
--text follows this line-- These commands currently lack OPTIONS_SPEC; allow people to easily list with "git grep 'OPTIONS_SPEC=$'" what they can help improving. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-31Merge branch 'maint' into HEADJunio C Hamano
* maint: Update GIT 1.5.3.5 Release Notes git-rebase--interactive.sh: Make 3-way merge strategies work for -p. git-rebase--interactive.sh: Don't pass a strategy to git-cherry-pick. Fix --strategy parsing in git-rebase--interactive.sh Make merge-recursive honor diff.renamelimit cherry-pick/revert: more compact user direction message core-tutorial: Use new syntax for git-merge. git-merge: document but discourage the historical syntax Prevent send-pack from segfaulting (backport from 'master') Documentation/git-cvsexportcommit.txt: s/mgs/msg/ in example Conflicts: git-rebase--interactive.sh
2007-10-31git-rebase--interactive.sh: Make 3-way merge strategies work for -p.Björn Steinbrink
git-rebase--interactive.sh used to pass all parents of a merge commit to git-merge, which means that we have at least 3 heads to merge: HEAD, first parent and second parent. So 3-way merge strategies like recursive wouldn't work. Fortunately, we have checked out the first parent right before the merge anyway, so that is HEAD. Therefore we can drop simply it from the list of parents, making 3-way strategies work for merge commits with only two parents. Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-31git-rebase--interactive.sh: Don't pass a strategy to git-cherry-pick.Björn Steinbrink
git-cherry-pick doesn't support a strategy paramter, so don't pass one. This means that --strategy for interactive rebases is a no-op for anything but merge commits, but that's still better than being broken. A correct fix would probably need to port the --merge behaviour from plain git-rebase.sh, but I have no clue how to integrate that cleanly. Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-31Fix --strategy parsing in git-rebase--interactive.shBjörn Steinbrink
For the --strategy/-s option, git-rebase--interactive.sh dropped the parameter which it was trying to parse. Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-16git-rebase--interactive.sh: Quote arguments to testMichael W. Olson
If /bin/sh is /bin/dash, then the script will display an error if $parent_sha1 is undefined. This patch works fixes the issue by quoting both arguments to `test'. Arguments composed solely of variable expansions should always be quoted, unless we know for certain that the contents are defined. Signed-off-by: Michael W. Olson <mwolson@gnu.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-16Merge branch 'maint'Shawn O. Pearce
* maint: Whip post 1.5.3.4 maintenance series into shape. rebase -i: use diff plumbing instead of porcelain Do not remove distributed configure script git-archive: document --exec git-reflog: document --verbose git-config: handle --file option with relative pathname properly clear_commit_marks(): avoid deep recursion git add -i: Remove unused variables git add -i: Fix parsing of abbreviated hunk headers git-config: don't silently ignore options after --list Clean up "git log" format with DIFF_FORMAT_NO_OUTPUT Fix embarrassing "git log --follow" bug Conflicts: RelNotes git-rebase--interactive.sh
2007-10-16rebase -i: use diff plumbing instead of porcelainJohannes Schindelin
When diff drivers are installed, calling "git diff <tree1>..<tree2>" calls those drivers. This borks the patch generation of rebase -i. So use "git diff-tree -p" instead, which does not call diff drivers. Noticed by Johannes Sixt. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-03Merge branch 'js/rebase-i'Junio C Hamano
* js/rebase-i: rebase -i: work on a detached HEAD
2007-10-03Merge branch 'jc/autogc'Junio C Hamano
* jc/autogc: git-gc --auto: run "repack -A -d -l" as necessary. git-gc --auto: restructure the way "repack" command line is built. git-gc --auto: protect ourselves from accumulated cruft git-gc --auto: add documentation. git-gc --auto: move threshold check to need_to_gc() function. repack -A -d: use --keep-unreachable when repacking pack-objects --keep-unreachable Export matches_pack_name() and fix its return value Invoke "git gc --auto" from commit, merge, am and rebase. Implement git gc --auto
2007-09-30Merge branch 'maint'Junio C Hamano
* maint: git-remote: exit with non-zero status after detecting errors. rebase -i: squash should retain the authorship of the _first_ commit git-add--interactive: Improve behavior on bogus input git-add--interactive: Allow Ctrl-D to exit
2007-09-30rebase -i: squash should retain the authorship of the _first_ commitJohannes Schindelin
It was determined on the mailing list, that it makes more sense for a "squash" to keep the author of the first commit as the author for the result of the squash. Make it so. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-30rebase -i: support single-letter abbreviations for the actionsJohannes Schindelin
When you do many rebases, you can get annoyed by having to type out the actions "edit" or "squash" in total. This commit helps that, by allowing you to enter "e" instead of "edit", "p" instead of "pick", or "s" instead of "squash". Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26rebase -i: work on a detached HEADJohannes Schindelin
Earlier, rebase -i refused to rebase a detached HEAD. Now it no longer does. Incidentally, this fixes "git gc --auto" shadowing the true exit status. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26Merge branch 'jc/autogc' into js/rebase-iJunio C Hamano
* jc/autogc: git-gc --auto: run "repack -A -d -l" as necessary. git-gc --auto: restructure the way "repack" command line is built. git-gc --auto: protect ourselves from accumulated cruft git-gc --auto: add documentation. git-gc --auto: move threshold check to need_to_gc() function. repack -A -d: use --keep-unreachable when repacking pack-objects --keep-unreachable Export matches_pack_name() and fix its return value Invoke "git gc --auto" from commit, merge, am and rebase. Implement git gc --auto Conflicts: builtin-pack-objects.c
2007-09-26rebase -i: create .dotest-merge after validating options.Matt Kraai
Creating .dotest-merge before validating the options prevents both --continue and --interactive from working if the options are invalid, so only create it after validating the options. [jc: however, just moving the creation of DOTEST breaks output] Signed-off-by: Matt Kraai <kraai@ftbfs.org> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26rebase -i: avoid exporting GIT_AUTHOR_* variablesJohannes Schindelin
It is somewhat unsafe to export the GIT_AUTHOR_* variables, since a later call to git-commit or git-merge could pick them up inadvertently. So avoid the export, using a recipe provided by Johannes Sixt. Incidentally, this fixes authorship of merges with "rebase --preserve -i". Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26rebase -i: Fix numbers in progress reportJohannes Schindelin
Instead of counting all lines in done and todo, we now count the actions before outputting "$Rebasing ($count/$total)". Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26rebase -i: style fixes and minor cleanupsJohannes Schindelin
This patch indents ";;" consistently with the rest of git's shell scripts, and makes sure that ";;" are before each "esac". It introduces a helper function "has_action", to make it easier to read the intentions of the code. Errors from "git rev-parse --verify" are no longer ignored. Spaces are quoted using single quotes instead of a backslash, for readability. A "test $preserve=f" (missing spaces) was fixed; hashes are no longer written to "$DOTEST"/rewritten/ unnecessarily. We used to quote the message for a squash, only to have "echo" unquote it. Now we use "printf" and do not need to quote to start with. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-26rebase -i: commit when continuing after "edit"Johannes Schindelin
When doing an "edit" on a commit, editing and git-adding some files, "git rebase -i" complained about a missing "author-script". The idea was that the user would call "git commit --amend" herself. But we can be nice and do that for the user. Noticed by Dmitry Potapov. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>