Commit Graph

4182 Commits

Author SHA1 Message Date
Paul Mackerras
3e1a70d925 rev-parse: better error message for ambiguous arguments
Currently, if git-rev-parse encounters an argument that is neither a
recognizable revision name nor the name of an existing file or
directory, and it hasn't encountered a "--" argument, it prints an
error message saying "No such file or directory".  This can be
confusing for users, including users of programs such as gitk that
use git-rev-parse, who may then think that they can't ask about the
history of files that no longer exist.

This makes it print a better error message, one that points out the
ambiguity and tells the user what to do to fix it.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-04-24 22:22:29 -07:00
Linus Torvalds
34fd1c9ac5 git-log produces no output
When $PAGER is set to 'less -i', we used to fail because we
assumed the $PAGER is a command and simply exec'ed it.

Try exec first, and then run it through shell if it fails.  This
allows even funkier PAGERs like these ;-):

	PAGER='sed -e "s/^/`date`: /" | more'
	PAGER='contrib/colordiff.perl | less -RS'

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-21 13:00:10 -07:00
Nicolas Pitre
0dec30b978 fix pack-object buffer size
The input line has 40 _chars_ of sha1 and no 20 _bytes_. It should also
account for the space before the pathname, and the terminating \n and \0.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-21 00:45:10 -07:00
Junio C Hamano
757319309a mailinfo: decode underscore used in "Q" encoding properly.
Quoted-Printable (RFC 2045) and the "Q" encoding (RFC 2047) are
subtly different; the latter is used on the mail header and an
underscore needs to be decoded to 0x20.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-21 00:09:28 -07:00
Santi_Béjar
d598075e52 Reintroduce svn pools to solve the memory leak.
Introduced in 4802426.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-20 23:41:24 -07:00
Junio C Hamano
f527cb8c38 pack-objects: do not stop at object that is "too small"
Because we sort the delta window by name-hash and then size,
hitting an object that is too small to consider as a delta base
for the current object does not mean we do not have better
candidate in the window beyond it.

Noticed by Shawn Pearce, analyzed by Nico, Linus and me.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-20 23:36:22 -07:00
Junio C Hamano
6a74642c50 git-commit --amend: two fixes.
When running "git commit --amend" only to fix the commit log
message without any content change, we mistakenly showed the
git-status output that says "nothing to commit" without
commenting it out.

If you have already run update-index but you want to amend the
top commit, "git commit --amend --only" without any paths should
have worked, because --only means "starting from the base
commit, update-index these paths only to prepare the index to
commit, and perform the commit".  However, we refused -o without
paths.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-20 02:51:12 -07:00
Junio C Hamano
61c2bcbd11 pre-commit hook: complain about conflict markers.
Several <<< or === or >>> characters at the beginning of a line
is very likely to be leftover conflict markers from a failed
automerge the user resolved incorrectly, so detect them.

As usual, this can be defeated with "git commit --no-verify" if
you really do want to have those files, just like changes that
introduce trailing whitespaces.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-19 15:37:40 -07:00
Junio C Hamano
50ac740801 git-merge: a bit more readable user guidance.
We said "fix up by hand" after failed automerge, which was a big
"Huh?  Now what?".  Be a bit more explicit without being too
verbose. Suggested by Carl Worth.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-19 15:37:36 -07:00
Shawn Pearce
23edecbc9a Document git-clone --reference
The new --reference flag introduced to git-clone in
GIT 1.3.0 was not documented but is rather handy.
So document it.

Also corrected a minor issue with the documentation for the
-s flag; the info/alternates file name was spelled wrong.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-18 17:56:53 -07:00
Jonas Fonseca
8d6e10327d Fix filename scaling for binary files
Set maximum filename length for binary files so that scaling won't be
triggered and result in invalid string access.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-18 14:44:58 -07:00
Junio C Hamano
4baff50551 GIT 1.3.0
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-18 13:15:18 -07:00
Jonas Fonseca
8f2b72a936 Add git-annotate(1) and git-blame(1)
[jc: with entries in git.txt]

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-18 12:06:55 -07:00
Junio C Hamano
f56ef54174 diff --stat: make sure to set recursive.
Just like "patch" format always needs recursive, "diffstat"
format does not make sense without setting recursive.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-18 11:29:33 -07:00
Herbert Valerio Riedel
08ddd4f764 git-svnimport symlink support
added svn:special symlink support for access methods other than
direct-http

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Acked-by: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-18 02:26:52 -07:00
Junio C Hamano
2855d58079 packed_object_info_detail(): check for corrupt packfile.
Serge E. Hallyn noticed that we compute how many input bytes are
still left, but did not use it for sanity checking.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 17:46:07 -07:00
Serge E. Hallyn
bb996614de cleanups: remove unused variable from exec_cmd.c
Not sure whether it should be removed, or whether
execv_git_cmd() should return it rather than -1 at bottom.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:06:40 -07:00
Serge E. Hallyn
dafc88b136 cleanups: prevent leak of two strduped strings in config.c
Config_filename and lockfile are strduped and then leaked in
git_config_set_multivar.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:06:37 -07:00
Serge E. Hallyn
ecc13e73cf cleanups: Remove impossible case in quote.c
The switch is inside an if statement which is false if
the character is ' '.  Either the if should be <=' '
instead of <' ', or the case should be removed as it could
be misleading.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:06:25 -07:00
Serge E. Hallyn
310f8b5b6d cleanups: Remove unused vars from combine-diff.c
Mod_type in particular sure looks like it wants to be used, but isn't.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:06:16 -07:00
Serge E. Hallyn
da2a95b2a8 cleanups: Fix potential bugs in connect.c
The strncmp for ACK was ACK does not include the final space.
Presumably either we should either remove the trailing space,
or compare 4 chars (as this patch does).

'path' is sometimes strdup'ed, but never freed.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 15:05:33 -07:00
Junio C Hamano
6feba7cb74 Merge branch 'jc/boundary'
* jc/boundary:
  rev-list --boundary: show boundary commits even when limited otherwise.
2006-04-17 15:03:11 -07:00
Junio C Hamano
e190bc5543 Merge branch 'jc/bottomless'
* jc/bottomless:
  rev-list --bisect: limit list before bisecting.
2006-04-17 15:03:10 -07:00
Yann Dirson
360204c324 Allow empty lines in info/grafts
In addition to the existing comment support, that just allows the user
to use a convention that works pretty much everywhere else.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-17 14:17:50 -07:00
Junio C Hamano
1b65a5aa44 rev-list --boundary: show boundary commits even when limited otherwise.
The boundary commits are shown for UI like gitk to draw them as
soon as topo-order sorting allows, and should not be omitted by
get_revision() filtering logic.  As long as their immediate
child commits are shown, we should not filter them out.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16 22:05:38 -07:00
A Large Angry SCM
e6bfaf3e33 Makefile fixups.
Signed-off-by: A Large Angry SCM <gitzilla@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16 20:42:37 -07:00
Junio C Hamano
1a17ee22a2 Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Fix bug caused by missing commitlisted elements
2006-04-16 18:59:30 -07:00
Paul Mackerras
e7da347520 gitk: Fix bug caused by missing commitlisted elements
This bug was reported by Yann Dirson, and results in an 'Error:
expected boolean value but got ""' dialog when scrolling to the bottom
of the graph under some circumstances.  The issue is that git-rev-list
isn't outputting all the boundary commits when it is asked for commits
affecting only certain files.  We already cope with that by adding the
missing boundary commits in addextraid, but there we weren't adding a
0 to the end of the commitlisted list when we added the extra id to
the end of the displayorder list.

This fixes it by appending 0 to commitlisted in addextraid, thus keeping
commitlisted and displayorder in sync.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-04-17 10:27:59 +10:00
Junio C Hamano
5bc4ce5896 reading $GIT_DIR/info/graft - skip comments correctly.
Noticed by Yann Dirson.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16 14:24:56 -07:00
Johannes Schindelin
402461aab1 pager: do not fork a pager if PAGER is set to empty.
This skips an extra pipe, and helps debugging tremendously.

[jc: PAGER=cat is a questionable hack and should be done as a separate
patch. ]

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-16 01:40:04 -07:00
Johannes Schindelin
2935327394 diff-options: add --patch-with-stat
With this option, git prepends a diffstat in front of the patch.

Since I really, really do not know what a diffstat of a combined diff
("merge diff") should look like, the diffstat is not generated for these.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 19:30:27 -07:00
Junio C Hamano
cbdda02404 diff-files --stat: do not dump core with unmerged index.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 19:22:48 -07:00
Linus Torvalds
1cd95087c3 Support "git cmd --help" syntax
The "--help" argument is special, in that it is (along with "--version")
in that is taken by the "git" program itself rather than the sub-command,
and thus we've had the syntax "git --help cmd".

However, as anybody who has ever used CVS or some similar devil-spawn
program, it's confusing as h*ll when options before the sub-command act
differently from options after the sub-command, so this quick hack just
makes it acceptable to do "git cmd --help" instead, and get the exact same
result.

It may be hacky, but it's simple and does the trick.

Of course, this does not help if you use one of the non-builtin commands
without using the "git" helper. Ie you won't be getting a man-page just
because you do "git-rev-list --help". Don't expect us to be quite _that_
helpful.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 18:17:46 -07:00
Junio C Hamano
6f4780f9df diff --stat: do not do its own three-dashes.
I missed that "git-diff-* --stat" spits out three-dash separator
on its own without being asked.  Remove it.

When we output commit log followed by diff, perhaps --patch-with-stat,
for downstream consumer, we _would_ want the three-dash between
the message and the diff material, but that logic belongs to the
caller, not diff generator.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 14:06:42 -07:00
Junio C Hamano
5069b1cf61 diff-tree: typefix.
Recent diff_tree_setup_paths() update made it take a second
argument of type "struct diff_options", but we passed another
struct that happenes to have that type at the beginning by
mistake.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-15 03:22:00 -07:00
Junio C Hamano
42b5c78845 GIT v1.3.0-rc4
I've merged everything I think is ready for 1.3.0, so this is
the final round -- hopefully I can release this with minimum
last-minute fixup as v1.3.0 early next week.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 23:21:34 -07:00
Junio C Hamano
170abc81a0 Merge branch 'dl/xdiff'
* dl/xdiff:
  xdiff: post-process hunks to make them consistent.
2006-04-14 22:58:17 -07:00
Junio C Hamano
afcb536f28 Merge branch 'js/diffstat'
* js/diffstat:
  diff --stat: no need to ask funcnames nor context.
  diff-options: add --stat (take 2)
  diff-options: add --stat (take 2)
2006-04-14 21:55:23 -07:00
Junio C Hamano
a3cc31fb05 Merge branch 'jc/fix5500'
* jc/fix5500:
  t5500: test fix
2006-04-14 21:55:22 -07:00
Junio C Hamano
4e1dc64009 rev-list --bisect: limit list before bisecting.
I noticed bisect does not work well without both good and bad.
Running this script in git.git repository would give you quite
different results:

	#!/bin/sh
        initial=e83c5163316f89bfbde7d9ab23ca2e25604af290

        mid0=`git rev-list --bisect ^$initial --all`

        git rev-list $mid0 | wc -l
        git rev-list ^$mid0 --all | wc -l

        mid1=`git rev-list --bisect --all`

        git rev-list $mid1 | wc -l
        git rev-list ^$mid1 --all | wc -l

The $initial commit is the very first commit you made.  The
first midpoint bisects things evenly as designed, but the latter
does not.

The reason I got interested in this was because I was wondering
if something like the following would help people converting a
huge repository from foreign SCM, or preparing a repository to
be fetched over plain dumb HTTP only:

        #!/bin/sh

        N=4
        P=.git/objects/pack
        bottom=

        while test 0 \< $N
        do
                N=$((N-1))
                if test -z "$bottom"
                then
                        newbottom=`git rev-list --bisect --all`
                else
                        newbottom=`git rev-list --bisect ^$bottom --all`
                fi
                if test -z "$bottom"
                then
                        rev_list="$newbottom"
                elif test 0 = $N
                then
                        rev_list="^$bottom --all"
                else
                        rev_list="^$bottom $newbottom"
                fi
                p=$(git rev-list --unpacked --objects $rev_list |
                    git pack-objects $P/pack)
                git show-index <$P/pack-$p.idx | wc -l
                bottom=$newbottom
        done

The idea is to pack older half of the history to one pack, then
older half of the remaining history to another, to continue a
few times, using finer granularity as we get closer to the tip.

This may not matter, since for a truly huge history, running
bisect number of times could be quite time consuming, and we
might be better off running "git rev-list --all" once into a
temporary file, and manually pick cut-off points from the
resulting list of commits.  After all we are talking about
"approximately half" for such an usage, and older history does
not matter much.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 21:52:50 -07:00
Linus Torvalds
40c2fe003c Clean up trailing whitespace when pretty-printing commits
Partly because we've messed up and now have some commits with trailing
whitespace, but partly because this also just simplifies the code, let's
remove trailing whitespace from the end when pretty-printing commits.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 21:46:08 -07:00
Junio C Hamano
cad1ed9535 "git cmd -h" for shell scripts.
Wrappers that use sh-setup took --help but not -h.  Noticed by
Sébastien Pierre.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 15:54:51 -07:00
Junio C Hamano
e51c3b5006 git-log <diff-options> <paths> documentation
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 12:59:09 -07:00
Junio C Hamano
e3a125a94d Retire git-log.sh (take #4)
Noticed by Johannes.  We do not install it anymore, but still have
been shipping the source, which was crazy.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 12:48:45 -07:00
Junio C Hamano
5cf7e21fbc stripspace: incomplete line fix (take #2)
This fixes f4ee3eb689 breakage, which
added an extra trailing blank line after stripping trailing blank lines
by mistake.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-14 12:41:51 -07:00
Junio C Hamano
7f732c632f t5500: test fix
Relying on eye-candy progress bar was fragile to begin with.
Run fetch-pack with -k option, and count the objects that are in
the pack that were transferred from the other end.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 22:28:06 -07:00
Junio C Hamano
84981f9ad9 diff --stat: no need to ask funcnames nor context.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 21:35:54 -07:00
Junio C Hamano
dfdcb558ec Fix-up previous expr changes.
The regexp on the right hand side of expr : operator somehow was
broken.

	expr 'z+pu:refs/tags/ko-pu' : 'z\+\(.*\)'

does not strip '+'; write 'z+\(.*\)' instead.

We probably should switch to shell based substring post 1.3.0;
that's not bashism but just POSIX anyway.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 19:05:38 -07:00
Johannes Schindelin
ece634d147 diff-options: add --stat (take 2)
... and a fix for an invalid free():


Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 16:50:02 -07:00
Davide Libenzi
295ba2fb89 xdiff: post-process hunks to make them consistent. 2006-04-13 16:48:45 -07:00