Commit Graph

13228 Commits

Author SHA1 Message Date
Alex Riesen
5f06573743 Allow selection of different cleanup modes for commit messages
Although we traditionally stripped away excess blank lines, trailing
whitespaces and lines that begin with "#" from the commit log message,
sometimes the message just has to be the way user wants it.

For instance, a commit message template can contain lines that begin with
"#", the message must be kept as close to its original source as possible
if you are converting from a foreign SCM, or maybe the message has a shell
script including its comments for future reference.

The cleanup modes are default, verbatim, whitespace and strip. The
default mode depends on if the message is being edited and will either
strip whitespace and comments (if editor active) or just strip the
whitespace (for where the message is given explicitely).

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 19:55:07 -08:00
Junio C Hamano
4803466f62 builtin-commit: avoid double-negation in the code.
The flag no_edit meant "we have got final message from the user
and will not editing it any further", but there were quite a few
places that needed to check !no_edit.  Rename the variable to
use_editor and reverse the logic everywhere.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 19:45:06 -08:00
Junio C Hamano
d616a23964 builtin-commit: fix amending of the initial commit
When amending initial commit without editor, the command
incorrectly barfed because the check to see if there is anything
to commit referenced the non-existent HEAD^1.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 19:45:06 -08:00
Junio C Hamano
7263881253 t7005: do not exit inside test.
The way to signal failure is to leave non-zero in $?, not abort
the entire test.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 19:45:06 -08:00
Jim Meyering
cc21682793 Don't dereference NULL upon lookup failure.
Instead, signal the error just like the case we do upon encountering
an object with an unknown type.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 11:15:38 -08:00
Wincent Colaiuta
97bc00a490 Emit helpful status for accidental "git stash" save
If the user types "git stash" mistakenly thinking that this will list
their stashes he/she may be surprised to see that it actually saved
a new stash and reset their working tree and index.

In the worst case they might not know how to recover the state. So
help them by telling them exactly what was saved and also how to
restore it immediately.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 11:15:22 -08:00
Pierre Habouzit
2f7ee089df parse-options: Add a gitcli(5) man page.
This page should hold every information about the git ways to parse command
lines, and best practices to be used for scripting.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2007-12-22 10:26:08 -08:00
Pierre Habouzit
c43a24834a Force the sticked form for options with optional arguments.
This forbids "git tag -n <number> -l" we allowed earlier, so
adjust t7004 while at it.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
2007-12-22 10:26:08 -08:00
Junio C Hamano
5e2de4f9bb Fix $EDITOR regression introduced by rewrite in C.
When git-tag and git-commit launches the editor, they used to
honor EDITOR="editor -options args..." but recent rewrite in C
insisted on $EDITOR to be the path to the editor executable.

This restores the older behaviour.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 10:26:08 -08:00
Stefan Sperling
77190eb9b8 Small comment fix for git-cvsimport.
Signed-off-by: Stefan Sperling <stsp@stsp.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 00:23:17 -08:00
Gustaf Hendeby
0e0278baad Make git send-email accept $EDITOR with arguments
Currently git send-email does not accept $EDITOR with arguments, eg,
emacs -nw, when starting an editor to produce a cover letter.  This
patch changes this by letting the shell handle the option parsing.

Signed-off-by:  Gustaf Hendeby <hendeby@isy.liu.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 00:21:30 -08:00
Pierre Habouzit
78d776a969 git-tag: fix -l switch handling regression.
The command itself takes an optional <pattern> argument that
limits the shown tags to the ones that match when in listing
mode that is triggered with '-l' option.  The <pattern> is not
an optional option-argument to '-l'.

With this fix, "git tag -l -n 4 v0.99" works as expected.

It also removes a few bogus tests in t7004.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22 00:05:02 -08:00
Junio C Hamano
56c3eb1732 Documentation: ls-files -v is about "assume unchanged".
And refer the reader to update-index documentation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-21 13:50:58 -08:00
Linus Torvalds
d2f82950a9 Re(-re)*fix trim_common_tail()
The tar-ball and the git archive itself is fine, but yes, the diff from
2.6.23 to 2.6.24-rc6 is bad. It's the "trim_common_tail()" optimization
that has caused way too much pain.

Very interesting breakage. The patch was actually "correct" in a (rather
limited) technical sense, but the context at the end was missing because
while the trim_common_tail() code made sure to keep enough common context
to allow a valid diff to be generated, the diff machinery itself could
decide that it could generate the diff differently than the "obvious"
solution.

Thee sad fact is that the git optimization (which is very important for
"git blame", which needs no context), is only really valid for that one
case where we really don't need any context.

[jc: since this is shared with "git diff -U0" codepath, context recovery
to the end of line needs to be done even for zero context case.]

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 20:54:23 -08:00
Jakub Narebski
d76a585d83 gitweb: fix whitespace in config_to_multi (indent with tab)
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 19:07:24 -08:00
Miklos Vajna
8a82b13354 everyday: replace 'prune' and 'repack' with 'gc'
In everyday tasks, "repack -a -d -f" won't be used, so there
is not much point mentioning "repack".  By showing the --prune
option to "gc", we can do without mentioning "git prune", too.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 17:11:20 -08:00
Charles Bailey
feb7f38b01 Remove old generated files from .gitignore.
Some entries in .gitignore are obselete.  These should be cleaned up
just for the sake of general tidiness and so that any developers who
have a working tree that was moved forward without a clean know that
they have old stuff in their work tree.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 17:05:31 -08:00
Jeff King
6a7f14c465 clean up 1.5.4 release notes
Mostly typo and small grammatical fixes with one or two rewordings for
clarity.  But note the important fix for status.relativepaths.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 17:04:58 -08:00
Johannes Schindelin
cdd859159e Mention git-shell's "cvs" substitution in the RelNotes
git shell became much more powerful for existing CVS setups.
We should not hide from those people who only read release
notes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 17:00:27 -08:00
Junio C Hamano
5d29275638 shell-scripts usage(): consistently exit with non-zero
Earlier conversion of shell scripts to parse-options made usage()
to run "git cmd -h" which in turn emit LONG_USAGE and exit with 0
status.  This is inconsistent with the scripts that do not use
parse-options, whose usage() died with the message, exiting with 1.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 12:58:06 -08:00
Shawn O. Pearce
03270628ed Reallow git-rebase --interactive --continue if commit is unnecessary
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-20 01:12:41 -08:00
Junio C Hamano
fbcf118402 fix git commit --amend -m "new message"
The prepare_log_message() function serves two purposes:

 - Prepares the commit log message template, to be given to the end
   user;

 - Return true if there is something committable;

7168624c35 (Do not generate full commit
log message if it is not going to be used) cheated to omit the former
when we know the log message template is not going to be used.  However,
its replacement logic to see if there is something committable was
botched.  When amending, it should compare the index with the parent of
the HEAD, not the current HEAD.  Otherwise you cannot run --amend to
fix only the message without changing the tree.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 01:11:53 -08:00
Junio C Hamano
885ed372d0 t4024: fix test script to use simpler sed pattern
The earlier test stripped away expected number of 'z' but the output
would have been very hard to read once somebody broke the common tail
optimization.  Instead, count the number of 'z' and show it, to help
diagnosing the problem better in the future.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 01:11:37 -08:00
Johannes Schindelin
eab9a40b6d Teach diff machinery to display other prefixes than "a/" and "b/"
With the new options "--src-prefix=<prefix>", "--dst-prefix=<prefix>"
and "--no-prefix", you can now control the path prefixes of the diff
machinery.  These used to by hardwired to "a/" for the source prefix
and "b/" for the destination prefix.

Initial patch by Pascal Obry.  Sane option names suggested by Linus.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-20 01:10:39 -08:00
Junio C Hamano
74f6b03c5c GIT 1.5.4-rc1
It's been a week since -rc0, and we have quite a lot of fixes,
so here it is.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-19 17:24:04 -08:00
Shawn O. Pearce
dbedf9729b Catch and handle git-commit failures in git-rebase --interactive
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-19 17:17:27 -08:00
Shawn O. Pearce
c5b09feb78 Avoid update hook during git-rebase --interactive
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-19 17:15:38 -08:00
Finn Arne Gangstad
20b178de7b Improved submodule merge support
When merging conflicting submodule changes from a supermodule, generate
a conflict message saying what went wrong. Also leave the tree in a state
where git status shows the conflict, and git submodule status gives the user
enough information to do the merge manally. Previously this would just fail.

Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-19 16:58:42 -08:00
Christian Stimming
eadcac9218 [PATCH] gitk i18n: Recode gitk from latin1 to utf8 so that the (c) copyright character is valid utf8.
When using translations, the target language must be encoded in utf-8
because almost all target languages will contain non-ascii characters.
For that reason, the non-translated strings should be in utf-8 as well
so that there isn't any encoding mixup inside the program.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-12-20 10:19:07 +11:00
Christian Stimming
b007ee20dc [PATCH] gitk i18n: More markup -- various options menus
Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-12-20 10:19:07 +11:00
Christian Stimming
15bc7bae91 [PATCH] gitk i18n: Initial German translation
Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-12-20 10:19:07 +11:00
Christian Stimming
d990cedf9c [PATCH] gitk i18n: Markup several strings for translation
This just marks up plain strings, that aren't used in any unusual way.

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-12-20 10:19:07 +11:00
Christian Stimming
663c3aa9c8 [PATCH] gitk i18n: Import msgcat for message string translation; load translation catalogs
By setting the environment variable GITK_MSGSDIR, one can manually set
the directory where the .msg files are located.  This is quite handy
during development with GITK_MSGSDIR=po.

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-12-20 10:19:07 +11:00
Christian Stimming
25ec938484 [PATCH] gitk i18n: Add Makefile with rules for po file creation and installation
The compiled .msg files will be installed into $(sharedir)/gitk/lib/msgs
according to Junio's mailing list proposal on 2007-07-28.

Signed-off-by: Christian Stimming <stimming@tuhh.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-12-20 10:19:07 +11:00
Sean
5909651ea2 Fix interactive rebase to preserve author email address
Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-19 14:59:19 -08:00
Nicolas Pitre
3f7701a4db make 'git describe --all --contains' work
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-19 14:59:19 -08:00
Charles Bailey
c569969363 Fix git-instaweb breakage on MacOS X due to the limited sed functionality
git-instaweb relied on a pipe in a sed script, but this is not supported
by MacOS X sed when using BREs.  git-instaweb relies on a working perl
in any case, and perl re are more consistent between platforms, so
replace sed invocation with an equivalent perl invocation.

Also, fix the documented -b "" to work without giving a spurious 'command
not found' error.

Signed-off-by: Charles Bailey <charles@hashpling.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-19 14:59:19 -08:00
Jeff King
ecaa0cff44 test "git clone -o"
This tests a recently fixed regression in which "git clone
-o" didn't work at all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-19 14:59:18 -08:00
Marco Roeland
9d81e03b5c clone: fix options '-o' and '--origin' to be recognised again
Due to a subtle typo in a shell case pattern neither alternative worked.

Signed-off-by: Marco Roeland <marco.roeland@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-19 14:59:18 -08:00
Johannes Schindelin
56122ed87a git show <tag>: show the tagger
For commit objects, the Author is shown, so do the equivalent for
tag objects, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-19 14:59:11 -08:00
Eric Wong
540424b263 git-svn: avoid warning when run without arguments
While we're in the area, finish writing a halfway-written
comment describing what that block does...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-12-19 00:33:15 -08:00
Eric Wong
7fc35e0e94 git-svn: workaround a for broken symlinks in SVN
It's possible for bad clients to commit symlinks without the
5-character "link " prefix in symlinks.  So guard around this
bug in SVN and make a best effort to create symlinks if the
"link " prefix is missing.

More information on this SVN bug is described here:
  http://subversion.tigris.org/issues/show_bug.cgi?id=2692

To be pedantic, there is still a corner case that neither we nor
SVN can handle:  If somebody made a link using a broken SVN
client where "link " is the first part of its path, e.g.
"link sausage", then we'd end up having a symlink which points
to "sausage" because we incorrectly stripped the "link ".
Hopefully this hasn't happened in practice, but if it has,
it's not our fault SVN is broken :)

Thanks to Benoit Sigoure and Sverre Johansen for reporting
and feedback.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-12-19 00:17:07 -08:00
Eric Wong
ad94802a7b git-svn: avoid leaving leftover committer/author info in rebase
We set the 6 environment variables for controlling
committer/author email/name/time for every commit.

We do this in the parent process to be passed to
git-commit-tree, because open3() doesn't afford us the control
of doing it only in the child process.  This means we leave them
hanging around in the main process until the next revision comes
around and all 6 environment variables are overwridden again.

Unfortunately, for the last commit, leaving them hanging around
means the git-rebase invocation will pick it up, rewriting the
rebased commit with incorrect author information.  This should fix
it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
2007-12-19 00:04:21 -08:00
Nicolas Pitre
ce85b053d8 fix style of a few comments in diff-delta.c
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-18 15:22:28 -08:00
Jim Meyering
e8a3f90994 git-filter-branch.sh: more portable tr usage: use \012, not \n.
I hesitate to suggest this, since GNU tr has accepted \n for 15 years,
but there are supposedly a few crufty vendor-supplied versions of tr still
in use.  Also, all of the other uses of tr-with-newline in git use \012.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-18 12:00:26 -08:00
Johannes Sixt
91c3aced4c filter-branch: Remove broken and unnecessary summary of rewritten refs.
There was an attempt to list the refs that were rewritten by filtering
the output of 'git show-ref' for 'refs/original'. But it got the
grep argument wrong, which did not account for the SHA1 that is listed
before the ref.

Moreover, right before this summary is the loop that actually does the
rewriting, and the rewritten refs are listed there anyway. So this extra
summary is plainly too verbose.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-18 12:00:26 -08:00
Ralf Wildenhues
02ff62504e Fix some documentation typos.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-18 12:00:18 -08:00
Junio C Hamano
4808ab8f87 builtin-blame.c: remove unneeded memclr()
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-18 01:46:04 -08:00
Linus Torvalds
f2fdd10ab7 unpack-trees: FLEX_ARRAY fix
In unpack-trees.c (line 593), we do

	..
	if (same(old, merge)) {
		*merge = *old;
	} else {
	..

and that "merge" is a cache_entry pointer. If we have a non-zero
FLEX_ARRAY size, it will cause us to copy the first few bytes of the
name too.

That is technically wrong even for FLEX_ARRAY being 1, but you'll never
notice, since the filenames should always be the same with the current
code.  But if we do the same thing for a rename, we'd be screwed.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-18 01:10:24 -08:00
Pierre Habouzit
f9c5a80cdf Fix segfault in diff-delta.c when FLEX_ARRAY is 1
aka don't do pointer arithmetics on structs that have a FLEX_ARRAY member,
or you'll end up believing your array is 1 cell off its real address.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-17 21:59:26 -08:00