Commit Graph

27 Commits

Author SHA1 Message Date
Junio C Hamano
23913dc713 honor GIT_REFLOG_ACTION in git-commit
This allows git-cherry-pick and git-revert to properly identify
themselves in the resulting reflog entries.  Earlier they were
recorded as what git-commit has done.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-03 15:17:49 -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
Shawn O. Pearce
6e2931a8ed Use nice names in conflict markers during cherry-pick/revert.
Always call the current HEAD 'HEAD', and name the patch being
cherry-picked or reverted by its oneline subject rather than
its SHA1.  This matches git am's behavior and is done because
users most commonly are cherry-picking by SHA1 rather than by
ref name.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-14 23:17:32 -08:00
Junio C Hamano
acb4441e0d Use merge-recursive in git-revert/git-cherry-pick
This makes revert and cherry-pick to use merge-recursive, to
allow them to notice renames.  A pair of test scripts
demonstrate that an old change before a rename happened can be
applied (reverted) after a rename with cherry-pick (with revert).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-14 22:00:34 -08:00
Junio C Hamano
f4b6c6b90f Merge branch 'jc/int'
* jc/int:
  More tests in t3901.
  Consistent message encoding while reusing log from an existing commit.
  t3901: test "format-patch | am" pipe with i18n
  Use log output encoding in --pretty=email headers.
2007-01-14 12:04:25 -08:00
Junio C Hamano
5ac2715f2e Consistent message encoding while reusing log from an existing commit.
The following commands can reuse log message from an existing
commit while creating a new commit:

	git-cherry-pick
	git-rebase (both with and without --merge)
	git-commit (-c and -C)

When the original commit was made in a different encoding from
the current i18n.commitencoding, "cat-file commit" would give a
string that is inconsistent with what the resulting commit will
claim to be in.  Replace them with "git show -s --encoding".

"git-rebase" without --merge is "git format-patch" piped to "git
am" in essence, and has been taken care of before this commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-13 13:33:07 -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
Bob Proulx
397dfe67c7 git-revert: Fix die before git-sh-setup defines it.
The code previously checked it's own name and called 'die' upon
an error.  However 'die' was not yet defined because git-sh-setup
had not been sourced yet.  Instead simply write the error message
to stderr and exit with an error as was originally desired.

Signed-off-by: Bob Proulx <bob@proulx.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-12 00:13:34 -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
Shawn O. Pearce
64646d1177 Suggest 'add' in am/revert/cherry-pick.
Now that we have decided to make 'add' behave like 'update-index'
(and therefore fully classify update-index as strictly plumbing)
the am/revert/cherry-pick family of commands should not steer the
user towards update-index.  Instead send them to the command they
probably already know, 'add'.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-21 20:33:49 -08:00
Junio C Hamano
58a1e0e83b Merge branch 'lj/refs'
* lj/refs: (63 commits)
  Fix show-ref usagestring
  t3200: git-branch testsuite update
  sha1_name.c: avoid compilation warnings.
  Make git-branch a builtin
  ref-log: fix D/F conflict coming from deleted refs.
  git-revert with conflicts to behave as git-merge with conflicts
  core.logallrefupdates thinko-fix
  git-pack-refs --all
  core.logallrefupdates create new log file only for branch heads.
  Remove bashism from t3210-pack-refs.sh
  ref-log: allow ref@{count} syntax.
  pack-refs: call fflush before fsync.
  pack-refs: use lockfile as everybody else does.
  git-fetch: do not look into $GIT_DIR/refs to see if a tag exists.
  lock_ref_sha1_basic does not remove empty directories on BSD
  Do not create tag leading directories since git update-ref does it.
  Check that a tag exists using show-ref instead of looking for the ref file.
  Use git-update-ref to delete a tag instead of rm()ing the ref file.
  Fix refs.c;:repack_without_ref() clean-up path
  Clean up "git-branch.sh" and add remove recursive dir test cases.
  ...
2006-11-01 08:48:50 -08:00
Luben Tuikov
a9cb3c6ecb git-revert with conflicts to behave as git-merge with conflicts
In a busy project, reverting a commit almost always results
in a conflict between one or more files (depending on the
commit being reverted).  It is useful to record this
conflict in the commit-to-be message of the resulting commit
(after the resolve).  The process now becomes:

git-revert <SHA-1>
<git complains and prints failed automatic>
<user manually resolves>
git-update-index <resolved files>
git-commit -s

And the commit message is now a merge of the revert commit
message and the conflict commit message, giving the user a
chance to edit it or add more information:

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-15 23:06:31 -07:00
Junio C Hamano
96779be48a Fix git-revert
Defaulting to $replay for the sake of fixing cherry-pick was not
done conditionally, which broke git-revert.

Noticed by Luben.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-09 19:19:45 -07:00
Junio C Hamano
abd6970aca cherry-pick: make -r the default
And introduce -x to expose (possibly) private commit object name
for people who cherry-pick between public branches.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-05 17:54:14 -07:00
Junio C Hamano
869659a6a1 Fix grammatical error in git-revert
We always talk about "commit xyz".

We never talk about "xyz commit", except when we end up talking
about a commit as a branch head (notably, I would say "the HEAD
commit", or possibly "the top-of-master commit", but here
$commit is a SHA1 name, not anything else).

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-12 22:51:25 -07:00
Linus Torvalds
d1802851b0 revert/cherry-pick: use aggressive merge.
After doing an in-index 3-way merge, we always do the stock
"merge-index merge-one-file" without doing anything fancy;
use of --aggressive helps performance quite a bit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-09 19:22:25 -07:00
Junio C Hamano
0f73e92ab7 cherry-pick/revert: error-help message rewording.
It said "after fixing up, commit the result using -F .msg", but
it was not clear for new people how "fix up" should be done.
Hint "git-update-index <path>".

We could recommend "git commit -a -F .msg" instead, but I am
hesitant to give that suggestion in the blind -- you could do a
cherry-pick, revert or a merge in general in a dirty working
tree as long as local modifications do not overlap with the
merge, but using "commit -a" would include them in the result.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-21 00:28:04 -08:00
Junio C Hamano
013049c985 revert/cherry-pick: handle single quote in author name.
The same fix as aa66c7ec77 is
needed here.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 20:45:11 -08:00
freku045@student.liu.se
4e7824b12e git-revert: Usage string clean-up
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-14 02:53:43 -08:00
Nikolai Weibull
674b28085e Add documentation for git-revert and git-cherry-pick.
* Added the -e option to the documentation of git-cherry-pick.
* Added the -e and --no-commit option to git-revert.
* Removed redundant case expression for -n as --no-edit (already taken by
  --no-commit).

Signed-off-by: Nikolai Weibull <nikolai@bitwi.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-08 15:50:14 -08:00
Petr Baudis
8bf14d6ef9 Document the --(no-)edit switch of git-revert and git-cherry-pick
This switch was not documented properly. I decided not to mention
the --no-edit switch in the git-cherry-pick documentation since
we always default to no editing.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-04 16:34:35 -08:00
Junio C Hamano
ae2b0f1518 git-sh-setup: die if outside git repository.
Now all the users of this script detect its exit status and die,
complaining that it is outside git repository.  So move the code
that dies from all callers to git-sh-setup script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 13:49:17 -08:00
Junio C Hamano
b7884981f8 git-revert: make --edit default.
Revert always should explain why, so make --edit the default,
unless stdin is not a terminal.  If you really don't want to say
anything, you can say "git-revert --no-edit $commit", or if you
are really sick, you could also say "git-revert $commit </dev/null".
But please don't.

You can also say "git-cherry-pick --edit $commit".  Not editting
the commit log message is the default for cherry-pick.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-23 17:19:37 -08:00
Linus Torvalds
30c7bb249e Allow editing of a revert-message
I think all commit operations should allow editing of the message (ie we
should do this for merges too), but that's _particularly_ true of doing a
"git revert".

We should always explain why we needed to revert something.

This patch adds a "-e" or "--edit" flag to "git revert", although I
actually suspect it should be on by default (and we should have a
"--no-edit" flag to disable it, probably together with an automatic
disable if stdin isn't a terminal).

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-23 16:52:52 -08:00
Junio C Hamano
e3e291fc07 Do not lose author name information to locale gotchas.
I noticed format-patch loses authorship information of Lukas' patch
when I run git tools with LC_LANG set to ja_JP.  It turns out that
the sed script to set environment variables were not working on his
name (encoded in UTF-8), which is unfortunate but technically correct.

Force sed invocation under C locale because we always want literal byte
semantics.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-11 00:37:34 -08:00
Junio C Hamano
e2f5f6ef67 Do not require clean tree when reverting and cherry-picking.
My stupidity deserved to be yelled at by Linus ... there is no reason
to require the working tree to be clean when merging -- the only
requirements are index to match HEAD commit and the paths involved in
merge are up to date in the working tree.  Revert and cherry-pick are
just specialized forms of merge, and the requirements should be the
same.

Remove the 'general purpose routine to make sure tree is clean' from
git-sh-setup, to prevent me from getting tempted again.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-26 18:04:17 -07:00
Junio C Hamano
215a7ad1ef Big tool rename.
As promised, this is the "big tool rename" patch.  The primary differences
since 0.99.6 are:

  (1) git-*-script are no more.  The commands installed do not
      have any such suffix so users do not have to remember if
      something is implemented as a shell script or not.

  (2) Many command names with 'cache' in them are renamed with
      'index' if that is what they mean.

There are backward compatibility symblic links so that you and
Porcelains can keep using the old names, but the backward
compatibility support  is expected to be removed in the near
future.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-07 17:45:20 -07:00