Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-02-11rebase: factor out sub command handlingMartin von Zweigbergk
Factor out the common parts of the handling of the sub commands '--continue', '--skip' and '--abort'. The '--abort' handling can handled completely in git-rebase.sh. After this refactoring, the calls to git-rebase--am.sh, git-rebase--merge.sh and git-rebase--interactive.sh will be better aligned. There will only be one call to interactive rebase that will shortcut the very last part of git-rebase.sh. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: make -v a tiny bit more verboseMartin von Zweigbergk
To make it possible to later remove the handling of --abort from git-rebase--interactive.sh, align the implementation in git-rebase.sh with the former by making it a bit more verbose. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: extract am code to new source fileMartin von Zweigbergk
Extract the code for am-based rebase to git-rebase--am.sh. Suggested-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: extract merge code to new source fileMartin von Zweigbergk
Extract the code for merge-based rebase to git-rebase--merge.sh. Suggested-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: remove $branch as synonym for $orig_headMartin von Zweigbergk
The variables $branch and $orig_head were used as synonyms. To avoid confusion, remove $branch. The name 'orig_head' seems more suitable, since that is the name used when the variable is persisted. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: factor out reference parsingMartin von Zweigbergk
Remove the parsing and validation of references (onto, upstream, branch) from git-rebase--interactive.sh and rely on the information exported from git-rebase.sh. By using the parsing of the --onto parameter in git-rebase.sh, this improves the error message when the parameter is invalid. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase -i: support --statMartin von Zweigbergk
Move up the code that displays the diffstat if '--stat' is passed, so that it will be executed before calling git-rebase--interactive.sh. A side effect is that the diffstat is now displayed before "First, rewinding head to replay your work on top of it...". Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: reorder validation stepsMartin von Zweigbergk
Reorder validation steps in preparation for the validation to be factored out from git-rebase--interactive.sh into git-rebase.sh. The main functional difference is that the pre-rebase hook will no longer be run if the work tree is dirty. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: factor out call to pre-rebase hookMartin von Zweigbergk
Remove the call to the pre-rebase hook from git-rebase--interactive.sh and rely on the call in git-rebase.sh. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: factor out clean work tree checkMartin von Zweigbergk
Remove the check for clean work tree from git-rebase--interactive.sh and rely on the check in git-rebase.sh. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: factor out command line option processingMartin von Zweigbergk
Factor out the command line processing in git-rebase--interactive.sh to git-rebase.sh. Store the options in variables in git-rebase.sh and then source git-rebase--interactive.sh. Suggested-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: align variable contentMartin von Zweigbergk
Make sure to interpret variables with the same name in the same way in git-rebase.sh and git-rebase--interactive.sh. This will make it easier to factor out code from git-rebase.sh to git-rebase--interactive and export the variables. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: align variable namesMartin von Zweigbergk
git-rebase--interactive.sh will soon be sourced from git-rebase.sh. Align the names of variables used in these scripts to prepare for that. Some names in git-rebase--interactive.sh, such as "author_script" and "amend", are currently used in their upper case form to refer to a file and in their lower case form to refer to something else. In these cases, change the name of the existing lower case variable and downcase the name of the variable that refers to the file. Currently, git-rebase.sh uses mostly lower case variable names, while git-rebase--interactive.sh uses mostly upper case variable names. For consistency, downcase all variables, not just the ones that will be shared between the two script files. Helped-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: stricter check of standalone sub commandMartin von Zweigbergk
The sub commands '--continue', '--skip' or '--abort' may only be used standalone according to the documentation. Other options following the sub command are currently not accepted, but options preceeding them are. For example, 'git rebase --continue -v' is not accepted, while 'git rebase -v --continue' is. Tighten up the check and allow no other options when one of these sub commands are used. Only check that it is standalone for non-interactive rebase for now. Once the command line processing for interactive rebase has been replaced by the command line processing in git-rebase.sh, this check will also apply to interactive rebase. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: act on command line outside parsing loopMartin von Zweigbergk
To later be able to use the command line processing in git-rebase.sh for both interactive and non-interactive rebases, move anything that is specific to non-interactive rebase outside of the parsing loop. Keep only parsing and validation of command line options in the loop. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: improve detection of rebase in progressMartin von Zweigbergk
Detect early on if a rebase is in progress and what type of rebase it is (interactive, merge-based or am-based). This prepares for further refactoring where am-based rebase will be dispatched to git-rebase--am.sh and merge-based rebase will be dispatched to git-rebase--merge.sh. The idea is to use the same variables whether the type of rebase was detected from rebase-apply/ or rebase-merge/ directories or from the command line options. This will make the code more readable and will later also make it easier to dispatch to the type-specific scripts. Also show a consistent error message independent of the type of rebase that was in progress and remove the obsolete wording about being in the middle of a 'patch application', since that (an existing "$GIT_DIR"/rebase-apply/applying) aborts 'git rebase' at an earlier stage. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: remove unused rebase state 'prev_head'Martin von Zweigbergk
The state stored in $GIT_DIR/rebase-merge/prev_head was introduced in 58634db (rebase: Allow merge strategies to be used when rebasing, 2006-06-21), but it was never used and should therefore be removed. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: read state outside loopMartin von Zweigbergk
The 'onto_name' state used in 'git rebase --merge' is currently read once for each commit that need to be applied. It doesn't change between each iteration, however, so it should be moved out of the loop. This also makes the code more readable. Also remove the unused variable 'end'. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: refactor reading of stateMartin von Zweigbergk
The code reading the state saved in $merge_dir or $rebase_dir is currently spread out in many places, making it harder to read and to introduce additional state. Extract this code into one method that reads the state. Only extract the code associated with the state that is written when the rebase is initiated. Leave the state that changes for each commmit, at least for now. Currently, when resuming a merge-based rebase using --continue or --skip, move_to_original_branch (via finish_rb_merge) will be called without head_name and orig_head set. These variables are then lazily read in move_to_original_branch if head_name is not set (together with onto, which is unnecessarily read again). Change this by always eagerly reading the state, for both am-based and merge-based rebase, in the --continue and --skip cases. Note that this does not change the behavior for am-based rebase, which read the state eagerly even before this commit. Reading the state eagerly means that part of the state will sometimes be read unnecessarily. One example is when the rebase is continued, but stops again at another merge conflict. Another example is when the rebase is aborted. However, since both of these cases involve user interaction, the delay is hopefully not noticeable. The call_merge/continue_merge loop is not affected. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-11rebase: clearer names for directory variablesMartin von Zweigbergk
Instead of using the old variable name 'dotest' for "$GIT_DIR"/rebase-merge and no variable for "$GIT_DIR"/rebase-apply, introduce two variables 'merge_dir' and 'apply_dir' for these paths. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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-30rebase: 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-29Porcelain 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-04rebase: 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-29Fix 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-24rebase: 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-25Merge 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-25Teach 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>