1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-24 02:36:08 +02:00
Commit Graph

109 Commits

Author SHA1 Message Date
Stephan Beyer 1b1dd23f2d Make usage strings dash-less
When you misuse a git command, you are shown the usage string.
But this is currently shown in the dashed form.  So if you just
copy what you see, it will not work, when the dashed form
is no longer supported.

This patch makes git commands show the dash-less version.

For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
generates a dash-less usage string now.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13 14:12:48 -07:00
Brandon Casey 037e98f202 git-merge.sh: fix typo in usage message: sucesses --> succeeds
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-06-19 14:13:02 -07:00
Miklos Vajna c3170a83d6 git-merge: exclude unnecessary options from OPTIONS_SPEC
gitcli(5) already documents them, and there are no options named
--no-no-stat, --no-no-summary and --no-no-log.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-21 12:54:49 -07:00
SZEDER Gábor efb779f887 merge, pull: add '--(no-)log' command line option
These are the command line option equivalents of the 'merge.log' config
variable.

The patch also updates documentation and bash completion accordingly, and
adds a test.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 19:28:18 -07:00
SZEDER Gábor 3e6c0a3fe3 add 'merge.stat' config variable
This variable has the same effect, as 'merge.diffstat'.
Also mention it in the documentation.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 19:28:18 -07:00
SZEDER Gábor d8abe148be merge, pull: introduce '--(no-)stat' option
This option has the same effect as '--(no-)summary' (i.e. whether to
show a diffsat at the end of the merge or not), and it is consistent
with the '--stat' option of other git commands.

Documentation, tests, and bash completion are updaed accordingly, and the
old --summary option is marked as being deprected.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-12 19:28:18 -07:00
Denis Cheng 9225d7be0a specify explicit "--pretty=medium" with `git log/show/whatchanged`
The following patch will introduce a new configuration variable,
"format.pretty", from then on the pretty format without specifying
"--pretty" might not be the default "--pretty=medium", it depends on
the user's config. So all kinds of Shell/Perl/Emacs scripts that needs
the default medium pretty format must specify it explicitly.

Signed-off-by: Denis Cheng <crquan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-05 12:06:09 -08:00
Gerrit Pape e6d1f76ccf git-merge.sh: better handling of combined --squash,--no-ff,--no-commit options
git-merge used to use either the --squash,--no-squash, --no-ff,--ff,
--no-commit,--commit option, whichever came last in the command line.
This lead to some un-intuitive behavior, having

 git merge --no-commit --no-ff <branch>

actually commit the merge.  Now git-merge respects --no-commit together
with --no-ff, as well as other combinations of the options.  However,
this broke a selftest in t/t7600-merge.sh which expected to have --no-ff
completely override the --squash option, so that

 git merge --squash --no-ff <branch>

fast-forwards, and makes a merge commit; combining --squash with --no-ff
doesn't really make sense though, and is now refused by git-merge.  The
test is adapted to test --no-ff without the preceding --squash, and
another test is added to make sure the --squash --no-ff combination is
refused.

The unexpected behavior was reported by John Goerzen through
 http://bing.sdebian.org/468568

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-03 13:38:30 -08:00
Junio C Hamano 9f4c4eb0e1 Merge branch 'ph/parseopt-sh'
* 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-17 21:39:37 -08:00
Junio C Hamano 5e389c430d Merge branch 'jc/stash-create'
* jc/stash-create:
  git-stash: Fix listing stashes
  git-merge: no reason to use cpio anymore
  Revert "rebase: allow starting from a dirty tree."
  rebase: allow starting from a dirty tree.
  stash: implement "stash create"
2007-11-14 14:05:47 -08:00
Pierre Habouzit b0bf1d8b79 Migrate git-merge.sh to use git-rev-parse --parseopt
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-05 22:48:13 -08:00
Junio C Hamano a64d7784e8 git-merge: no reason to use cpio anymore
Now we have "git stash create", we can use it to safely stash
away the dirty state in the tree.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-01 14:30:52 -07:00
Junio C Hamano e66273a6ab Merge branch 'lh/merge'
* lh/merge:
  git-merge: add --ff and --no-ff options
  git-merge: add support for --commit and --no-squash
  git-merge: add support for branch.<name>.mergeoptions
  git-merge: refactor option parsing
  git-merge: fix faulty SQUASH_MSG
  Add test-script for git-merge porcelain
2007-10-03 03:05:58 -07:00
Junio C Hamano 0341091a9e Merge branch 'jc/autogc'
* 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-10-03 03:05:32 -07:00
Junio C Hamano 91d4b2ee81 Merge branch 'je/hooks'
* je/hooks:
  Added example hook script to save/restore permissions/ownership.
  Add post-merge hook, related documentation, and tests.
2007-09-23 22:51:03 -07:00
Lars Hjemli d66424c4ac git-merge: add --ff and --no-ff options
These new options can be used to control the policy for fast-forward
merges: --ff allows it (this is the default) while --no-ff will create
a merge commit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-23 17:14:03 -07:00
Lars Hjemli d08af0ad74 git-merge: add support for --commit and --no-squash
These options can be used to override --no-commit and --squash, which is
needed since --no-commit and --squash now can be specified as default merge
options in $GIT_DIR/config.

The change also introduces slightly different behavior for --no-commit:
when specified, it explicitly overrides --squash. Earlier,
'git merge --squash --no-commit' would result in a squashed merge (i.e. no
$GIT_DIR/MERGE_HEAD was created) but with this patch the command will
behave as if --squash hadn't been specified.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-23 17:14:03 -07:00
Lars Hjemli aec7b362ad git-merge: add support for branch.<name>.mergeoptions
This enables per branch configuration of merge options. Currently, the most
useful options to specify per branch are --squash, --summary/--no-summary
and possibly --strategy, but all options are supported.

Note: Options containing whitespace will _not_ be handled correctly. Luckily,
the only option which can include whitespace is --message and it doesn't
make much sense to give that option a default value.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-23 17:14:03 -07:00
Lars Hjemli d38eb710d9 git-merge: refactor option parsing
Move the option parsing into a separate function as preparation for reuse
by the next commit.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-23 17:14:03 -07:00
Lars Hjemli 2ae4fd7695 git-merge: fix faulty SQUASH_MSG
Only the first 'remote' head is currently specified as an argument to 'git
log' when generating a SQUSH_MSG, which makes the generated message fail
to mention every commit involved in the merge. This fixes the problem.

Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-23 17:14:03 -07:00
David Kastrup 822f7c7349 Supplant the "while case ... break ;; esac" idiom
A lot of shell scripts contained stuff starting with

	while case "$#" in 0) break ;; esac

and similar.  I consider breaking out of the condition instead of the
body od the loop ugly, and the implied "true" value of the
non-matching case is not really obvious to humans at first glance.  It
happens not to be obvious to some BSD shells, either, but that's
because they are not POSIX-compliant.  In most cases, this has been
replaced by a straight condition using "test".  "case" has the
advantage of being faster than "test" on vintage shells where "test"
is not a builtin.  Since none of them is likely to run the git
scripts, anyway, the added readability should be worth the change.

A few loops have had their termination condition expressed
differently.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-23 16:12:00 -07:00
Josh England 46232915d5 Add post-merge hook, related documentation, and tests.
The post-merge hook enables one to hook in for `git pull` operations in order
to check and/or change attributes of a work tree from the hook.  As an example,
it can be used in combination with a pre-commit hook to save/restore file
ownership and permissions data (or file ACLs) within the repository and
transparently update the working tree after a `git pull` operation.

Signed-off-by: Josh England <jjengla@sandia.gov>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-18 17:40:24 -07:00
Junio C Hamano d4bb43ee27 Invoke "git gc --auto" from commit, merge, am and rebase.
The point of auto gc is to pack new objects created in loose
format, so a good rule of thumb is where we do update-ref after
creating a new commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-06 00:08:56 -07:00
Junio C Hamano a005085240 git-merge: do up-to-date check also for all strategies
This clarifies the logic to omit fast-forward check and omit
trivial merge before running the specified strategy.

The "index_merge" variable started out as a flag to say "do not
do anything clever", but when recursive was changed to skip the
trivial merge, the semantics were changed and the variable alone
does not make sense anymore.

This splits the variable into two, allow_fast_forward (which is
almost always true, and avoids making a merge commit when the
other commit is a descendant of our branch, but is set to false
for ours and subtree) and allow_trivial_merge (which is false
for ours, recursive and subtree).

Unlike the earlier implementation, the "ours" strategy allows an
up-to-date condition.  When we are up-to-date, the result will
be our commit, and by definition, we will have our tree as the
result.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-27 23:48:28 -07:00
Johannes Schindelin b4372ef136 Enable "git rerere" by the config variable rerere.enabled
Earlier, "git rerere" was enabled by creating the directory
.git/rr-cache.  That is definitely not in line with most other
features, which are enabled by a config variable.

So, check the config variable "rerere.enabled". If it is set
to "false" explicitely, do not activate rerere, even if
.git/rr-cache exists. This should help when you want to disable
rerere temporarily.

If "rerere.enabled" is not set at all, fall back to detection
of the directory .git/rr-cache.

[jc: with minimum tweaks]

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-06 22:39:15 -07:00
Junio C Hamano 5be60078c9 Rewrite "git-frotz" to "git frotz"
This uses the remove-dashes target to replace "git-frotz" to "git frotz".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-02 22:52:14 -07:00
Junio C Hamano 8250465859 Merge branch 'ar/mergestat'
* ar/mergestat:
  Add a configuration option to control diffstat after merge
2007-05-29 00:38:52 -07:00
Junio C Hamano c56ed464b0 Merge branch 'maint'
* maint:
  Fix git-svn to handle svn not reporting the md5sum of a file, and test.
  Fix mishandling of $Id$ expanded in the repository copy in convert.c
  More echo "$user_message" fixes.
  Add tests for the last two fixes.
  git-commit: use printf '%s\n' instead of echo on user-supplied strings
  git-am: use printf instead of echo on user-supplied strings
  Documentation: Add definition of "evil merge" to GIT Glossary
  Replace the last 'dircache's by 'index'
  Documentation: Clean up links in GIT Glossary
2007-05-26 18:53:22 -07:00
Junio C Hamano d1c7c27ea3 Merge branch 'maint-1.5.1' into maint
* maint-1.5.1:
  Fix git-svn to handle svn not reporting the md5sum of a file, and test.
  More echo "$user_message" fixes.
  Add tests for the last two fixes.
  git-commit: use printf '%s\n' instead of echo on user-supplied strings
  git-am: use printf instead of echo on user-supplied strings
  Documentation: Add definition of "evil merge" to GIT Glossary
  Replace the last 'dircache's by 'index'
  Documentation: Clean up links in GIT Glossary
2007-05-26 01:30:40 -07:00
Jeff King a23bfaed7d More echo "$user_message" fixes.
Here are fixes to more uses of 'echo "$msg"' where $msg could contain
backslashed sequence.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-26 00:33:03 -07:00
Alex Riesen 51e7ecf4ec Add a configuration option to control diffstat after merge
The diffstat can be controlled either with command-line options
(--summary|--no-summary) or with merge.diffstat. The default is
left as it was: diffstat is active by default.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-24 21:37:08 -07:00
James Bowes fefe49d134 Add colour support in rebase and merge tree diff stats output.
The rebase and merge commands used diff-tree to display the summary stats of
what files had changed from the operation. diff-tree does not read the
diff ui configuration options, so the diff.color setting was not used.

Have rebase and merge call diff rather than diff-tree, which does read the
diff ui options.

Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 15:25:01 -07:00
Junio C Hamano 68faf68938 A new merge stragety 'subtree'.
This merge strategy largely piggy-backs on git-merge-recursive.
When merging trees A and B, if B corresponds to a subtree of A,
B is first adjusted to match the tree structure of A, instead of
reading the trees at the same level.  This adjustment is also
done to the common ancestor tree.

If you are pulling updates from git-gui repository into git.git
repository, the root level of the former corresponds to git-gui/
subdirectory of the latter.  The tree object of git-gui's toplevel
is wrapped in a fake tree object, whose sole entry has name 'git-gui'
and records object name of the true tree, before being used by
the 3-way merge code.

If you are merging the other way, only the git-gui/ subtree of
git.git is extracted and merged into git-gui's toplevel.

The detection of corresponding subtree is done by comparing the
pathnames and types in the toplevel of the tree.

Heuristics galore!  That's the git way ;-).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-07 02:29:40 -07:00
Michael S. Tsirkin 85295a52e6 git-merge: Put FETCH_HEAD data in merge commit message
This makes git-fetch <URL> && git-merge FETCH_HEAD produce the
same merge message as git-pull <URL>.

Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-22 03:01:43 -07:00
Santi Béjar 2be08a84ba git-merge: finish when git-read-tree fails
The message formating (commit v1.5.0.3-28-gbe242d5) broke the && chain.

Noticed by Dmitry Torokhov.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 04:34:17 -07:00
J. Bruce Fields be242d576c git-merge: warn when -m provided on a fast forward
Warn the user that the "-m" option is ignored in the case of a fast
forward.  That may save some confusion in the case where the user
doesn't know about fast forwards yet and may not realize that the
behavior here is intentional.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-11 23:49:20 -07:00
Junio C Hamano 7d79c860a6 git-merge: fail correctly when we cannot fast forward.
When we cannot fast forward the working tree and the current
branch, git-merge did not exit with non-zero status.

Noticed by Larry Streepy, the section to be fixed identfied by
Johannes Schindelin.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-03 13:04:54 -08:00
Junio C Hamano de6f0def50 git-merge: minor fix for no_trivial_merge_strategies.
The shell loop to determine if we should skip the trivial
in-index merge stage based on what strategy is given was not
prepared to have more than one strategy listed in the variable
$no_trivial_merge_strategies.

This does not trigger unless you use a modified git but the fix
is simple and straightforward, so let's fix it before 1.5.0.1.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-16 15:08:25 -08:00
Tom Prince e0d10e1c63 [PATCH] Rename git-repo-config to git-config.
Signed-off-by: Tom Prince <tom.prince@ualberta.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28 16:16:53 -08:00
Junio C Hamano 7f9acb2a16 git-merge: leave sensible reflog message when used as the first level UI.
It used to throw potentially multi-line log message at reflog.
Just record the heads that were given to be merged at the command
line and the action.

Revert the removal of the check in "git-update-ref -m" I made earlier
which was only a work-around for this.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-26 15:38:21 -08:00
Junio C Hamano 6de33478af Merge branch 'sp/merge' (early part)
* 'sp/merge' (early part):
  Improve merge performance by avoiding in-index merges.
2007-01-14 12:03:53 -08:00
Junio C Hamano 533b70390e Allow whole-tree operations to be started from a subdirectory
This updates five commands (merge, pull, rebase, revert and cherry-pick)
so that they can be started from a subdirectory.

This may not actually be what we want to do.  These commands are
inherently whole-tree operations, and an inexperienced user may
mistakenly expect a "git pull" from a subdirectory would merge
only the subdirectory the command started from.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-12 16:54:38 -08:00
Shawn O. Pearce c82d7117a1 Improve merge performance by avoiding in-index merges.
In the early days of Git we performed a 3-way read-tree based merge
before attempting any specific merge strategy, as our core merge
strategies of merge-one-file and merge-recursive were slower script
based programs which took far longer to execute.  This was a good
performance optimization in the past, as most merges were able to
be handled strictly by `read-tree -m -u`.

However now that merge-recursive is a C based program which performs
a full 3-way read-tree before it starts running we need to pay the
cost of the 3-way read-tree twice if we have to do any sort of file
level merging.  This slows down some classes of simple merges which
`read-tree -m -u` could not handle but which merge-recursive does
automatically.

For a really trivial merge which can be handled entirely by
`read-tree -m -u`, skipping the read-tree and just going directly
into merge-recursive saves on average 50 ms on my PowerPC G4 system.
May sound odd, but it does appear to be true.

In a really simple merge which needs to use merge-recursive to handle
a file that was modified on both branches, skipping the read-tree
in git-merge saves on average almost 100 ms (on the same PowerPC G4)
as we avoid doing some work twice.

We only avoid `read-tree -m -u` if the only strategy to use is
merge-recursive, as not all merge strategies perform as well as
merge-recursive does.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 15:57:44 -08:00
Shawn O. Pearce 7eff28a9b4 Disallow working directory commands in a bare repository.
If the user tries to run a porcelainish command which requires
a working directory in a bare repository they may get unexpected
results which are difficult to predict and may differ from command
to command.

Instead we should detect that the current repository is a bare
repository and refuse to run the command there, as there is no
working directory associated with it.

[jc: updated Shawn's original somewhat -- bugs are mine.]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-10 15:03:09 -08:00
Junio C Hamano d1014a1745 fail pull/merge early in the middle of conflicted merge
After a pull that results in a conflicted merge, a new user
often tries another "git pull" in desperation.  When the index
is unmerged, merge backends correctly bail out without touching
either index nor the working tree, so this does not make the
wound any worse.

The user will however see several lines of messsages during this
process, such as "filename: needs merge", "you need to resolve
your current index first", "Merging...", and "Entry ... would be
overwritten by merge. Cannot merge.".  They are unnecessarily
alarming, and cause useful conflict messages from the first pull
scroll off the top of the terminal.

This changes pull and merge to run "git-ls-files -u" upfront and
stop them much earlier than we currently do.  Old timers may
know better and would not to try pulling again before cleaning
things up; this change adds extra overhead that is unnecessary
for them.  But this would be worth paying for to save new people
from needless confusion.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-01 14:35:16 -08:00
Shawn O. Pearce de811948ba Honor pull.{twohead,octopus} in git-merge.
If git-merge is invoked without a strategy argument it is probably
being run as a porcelain-ish command directly and is not being run
from within git-pull.  However we still should honor whatever merge
strategy the user may have selected in their configuration, just as
`git-pull .` would have.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28 01:07:51 -08:00
Shawn O. Pearce f94741324e Use GIT_REFLOG_ACTION environment variable instead.
Junio rightly pointed out that the --reflog-action parameter
was starting to get out of control, as most porcelain code
needed to hand it to other porcelain and plumbing alike to
ensure the reflog contained the top-level user action and
not the lower-level actions it invoked.

At Junio's suggestion we are introducing the new set_reflog_action
function to all shell scripts, allowing them to declare early on
what their default reflog name should be, but this setting only
takes effect if the caller has not already set the GIT_REFLOG_ACTION
environment variable.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28 01:05:15 -08:00
Shawn O. Pearce e0ec18192d Display 'theirs' branch name when possible in merge.
Displaying the SHA1 of 'their' branch (the branch being merged into
the current branch) is not nearly as friendly as just displaying
the name of that branch, especially if that branch is already local
to this repository.

git-merge now sets the environment variable 'GITHEAD_%(sha1)=%(name)'
for each argument it gets passed, making the actual input name that
resolved to the commit '%(sha1)' easily available to the invoked
merge strategy.

git-merge-recursive makes use of these environment variables when
they are available by using '%(name)' whenever it outputs the commit
identification rather than '%(sha1)'.  This is most obvious in the
conflict hunks created by xdl_merge:

  $ git mege sideb~1
  <<<<<<< HEAD:INSTALL
     Good!
  =======
     Oops.
  >>>>>>> sideb~1:INSTALL

[jc: adjusted a test script and a minor constness glitch.]

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-23 01:29:37 -08:00
Junio C Hamano 228e2eb67e merge and reset: adjust for "reset --hard" messages
An earlier commit made "reset --hard" chattier but leaking its
message from "git rebase" (which calls it when first rewinding
the current branch to prepare replaying our own changes) without
explanation was confusing, so add an extra message to mention
it.  Inside restorestate in merge (which is rarely exercised
codepath, where more than one strategies are attempted),
resetting to the original state uses "reset --hard" -- this can
be squelched entirely.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-22 15:21:55 -08:00
Junio C Hamano b1bfcae438 merge: give a bit prettier merge message to "merge branch~$n"
This hacks the input to fmt-merge-msg to make the message for
merging early part of a branch a little easier to read.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-16 12:31:45 -08:00