1
0
mirror of https://github.com/git/git.git synced 2024-10-05 11:31:26 +02:00
Commit Graph

11945 Commits

Author SHA1 Message Date
Gerrit Pape
1ae14a6b52 git-config: handle --file option with relative pathname properly
When calling git-config not from the top level directory of a repository,
it changes directory before trying to open the config file specified
through the --file option, which then fails if the config file was
specified by a relative pathname.  This patch adjusts the pathname to
the config file if applicable.

The problem was noticed by Joey Hess, reported through
 http://bugs.debian.org/445208

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 21:07:38 -04:00
Johannes Schindelin
60fcc2e6ce clear_commit_marks(): avoid deep recursion
Before this patch, clear_commit_marks() recursed for each parent.  This
could be potentially very expensive in terms of stack space.  Probably
the only reason that this did not lead to problems is the fact that we
typically call clear_commit_marks() after marking a relatively small set
of commits.

Use (sort of) a tail recursion instead: first recurse on the parents
other than the first one, and then continue the loop with the first
parent.

Noticed by Shawn Pearce.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 21:05:22 -04:00
Jean-Luc Herren
7b40a4552a git add -i: Remove unused variables
Signed-off-by: Jean-Luc Herren <jlh@gmx.ch>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 21:00:40 -04:00
Jean-Luc Herren
7288ed8ebd git add -i: Fix parsing of abbreviated hunk headers
The unified diff format allows one-line ranges to be abbreviated
by omiting the size.  The hunk header "@@ -10,1 +10,1 @@" can be
expressed as "@@ -10 +10 @@", but this wasn't properly parsed in
all cases.

Such abbreviated hunk headers are generated when a one-line change
(add, remove or modify) appears without context; for example
because the file is a one-liner itself or because GIT_DIFF_OPTS
was set to '-u0'.  If the user then runs 'git add -i' and enters
the 'patch' command for that file, perl complains about undefined
variables.

Signed-off-by: Jean-Luc Herren <jlh@gmx.ch>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 21:00:40 -04:00
Frank Lichtenheld
a72c874e43 git-config: don't silently ignore options after --list
Error out if someone gives options after --list since that is
not a valid syntax.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 20:54:42 -04:00
Brandon Casey
729f50453c git-gc --auto: simplify "repack" command line building
Since "-a" is removed from the base repack command line,
we can simplify how we add additional options to this
command line when using --auto.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 20:50:05 -04:00
Brandon Casey
edb0e04e81 git-gc: by default use safer "-A" option to repack when not --prune'ing
This makes use of repack's new "-A" option which does not drop packed
unreachable objects. This makes git-gc safe to call at any time,
particularly when a repository is referenced as an alternate by
another repository.

git-gc --prune will use the "-a" option to repack instead of "-A", so
that packed unreachable objects will be removed.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 20:50:05 -04:00
Väinö Järvelä
f539d0d6c1 Added a test for fetching remote tags when there is not tags.
When a user runs "git fetch -t", git crashes when it doesn't find any
tags on the remote repository.

Signed-off-by: Väinö Järvelä <v@pp.inet.fi>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 20:40:51 -04:00
Alex Riesen
8f70a7657a Fix a crash in ls-remote when refspec expands into nothing
Originally-by: Väinö Järvelä <v@pp.inet.fi>
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 20:40:50 -04:00
Daniel Barkalow
2467a4fa03 Remove duplicate ref matches in fetch
If multiple refspecs matched the same ref, the update would be
processed multiple times. Now having the same destination for the same
source has no additional effect, and having the same destination for
different sources is an error.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 20:28:06 -04:00
Alex Riesen
2f27f8509e fix t5403-post-checkout-hook.sh: built-in test in dash does not have "=="
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 20:26:01 -04:00
Linus Torvalds
304b5af64f Clean up "git log" format with DIFF_FORMAT_NO_OUTPUT
This fixes an unnecessary empty line that we add to the log message when
we generate diffs, but don't actually end up printing any due to having
DIFF_FORMAT_NO_OUTPUT set.

This can happen with pickaxe or with rename following. The reason is that
we normally add an empty line between the commit and the diff, but we do
that even for the case where we've then suppressed the actual printing of
the diff.

This also updates a couple of tests that assumed the extraneous empty
line would exist at the end of output.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 20:24:27 -04:00
Linus Torvalds
99516e35d0 Fix embarrassing "git log --follow" bug
It turns out that I completely broke "git log --follow" with my recent
patch to revision.c ("Fix revision log diff setup, avoid unnecessary diff
generation", commit b7bb760d5ed4881422673d32f869d140221d3564).

Why? Because --follow obviously requires the diff machinery to function,
exactly the same way pickaxe does.

So everybody is away right now, but considering that nobody even noticed
this bug, I don't think it matters. But for the record, here's the trivial
one-liner fix (well, two, since I also fixed the comment).

Because of the nature of the bug, if you ask for patches when following
(which is one of the things I normally do), the bug is hidden, because
then the request for diff output will automatically also enable the diffs
themselves.

So while "git log --follow <filename>" didn't work, adding a "-p"
magically made it work again even without this fix.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-15 20:15:58 -04:00
Steffen Prohaska
96f11953c0 git-gui: accept versions containing text annotations, like 1.5.3.mingw.1
This commit teaches git-gui to accept versions with annotations
that start with text and optionally end with a dot followed by
a number.

This is needed by the current versioning scheme of msysgit,
which uses versions like 1.5.3.mingw.1. However, the changes
is not limited to this use case. Any version of the form
<numeric version>.<anytext>.<number> would be parsed and only
the starting <numeric version> used for validation.

[sp: Minor edit to remove unnecessary group matching]

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-07 17:15:27 -07:00
Paul Mackerras
8d73b242a5 gitk: Get rid of the diffopts variable
The only thing that could be specified with diffopts was the number
of lines of context, but there is already a spinbox for that.  So
this gets rid of it.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-06 20:22:00 +10:00
Paul Mackerras
308ff3d59d gitk: Fix bug where the last few commits would sometimes not be visible
We weren't calling showstuff for the last few commits under some
circumstances, causing the scrolling region not to be extended right
to the end of the graph.  This fixes it.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-06 20:17:59 +10:00
Paul Mackerras
9a7558f348 gitk: Add a font chooser
This adds buttons to the edit preferences window to allow the user to
choose the main font, the text font (used for the diff display window)
and the UI font.  Pressing those buttons pops up a font chooser window
that lets the user pick the font family, size, weight (bold/normal)
and slant (roman/italic).

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-06 20:16:06 +10:00
Paul Mackerras
0ed1dd3c77 gitk: Keep track of font attributes ourselves instead of using font actual
Unfortunately there seems to be a bug in Tk8.5 where font actual -size
sometimes gives the wrong answer (e.g. 12 for Bitstream Vera Sans 9),
even though the font is actually displayed at the right size.  This
works around it by parsing and storing the family, size, weight and
slant of the mainfont, textfont and uifont explicitly.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-06 18:27:37 +10:00
Paul Mackerras
9c311b3208 gitk: Use named fonts instead of the font specification
This replaces the use of $mainfont, $textfont and $uifont with named
fonts called mainfont, textfont and uifont.  We also have variants
called mainfontbold and textfontbold.  This makes it much easier to
make sure font size changes are reflected everywhere they should be,
since configuring a named font automatically changes all the widgets
that are using that font.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-04 22:27:13 +10:00
Paul Mackerras
64b5f146fd gitk: Fix bug causing Tcl error when changing find match type
When changing the selector for Exact/IgnCase/Regexp, we were getting
a Tcl error.  This fixes it.

It also adds a workaround for a bug in alpha versions of Tk8.5 where
wordprocessor-style tabs don't seem to work properly around column 1.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-04 22:19:24 +10:00
Junio C Hamano
58ba4f6ac8 Update state documentation link for 1.5.3.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-04 01:35:01 -07:00
Linus Torvalds
eb4d0e3f45 optimize diffcore-delta by sorting hash entries.
Here's a test-patch. I don't guarantee anything, except that when I did
the timings I also did a "wc" on the result, and they matched..

Before:
	[torvalds@woody linux]$ time git diff -l0 --stat -C v2.6.22.. | wc
	   7104   28574  438020

	real    0m10.526s
	user    0m10.401s
	sys     0m0.136s

After:
	[torvalds@woody linux]$ time ~/git/git diff -l0 --stat -C v2.6.22.. | wc
	   7104   28574  438020

	real    0m8.876s
	user    0m8.761s
	sys     0m0.128s

but the diff is fairly simple, so if somebody will go over it and say
whether it's likely to be *correct* too, that 15% may well be worth it.

[ Side note, without rename detection, that diff takes just under three
  seconds for me, so in that sense the improvement to the rename detection
  itself is larger than the overall 15% - it brings the cost of just
  rename detection from 7.5s to 5.9s, which would be on the order of just
  over a 20% performance improvement. ]

Hmm. The patch depends on half-way subtle issues like the fact that the
hashtables are guaranteed to not be full => we're guaranteed to have zero
counts at the end => we don't need to do any steenking iterator count in
the loop. A few comments might in order.

		Linus
2007-10-04 00:05:36 -07:00
Steven Walter
9ff74e95da Don't checkout the full tree if avoidable
In most cases of branching, the tree is copied unmodified from the trunk
to the branch.  When that is done, we can simply start with the parent's
index and apply the changes on the branch as usual.

[ew: rewritten from Steven's original to use SVN::Client instead
     of the command-line svn client.

     Since SVN::Client connects separately, we'll share our
     authentication providers array between our usages of
     SVN::Client and SVN::Ra, too.  Bypassing the high-level
     SVN::Client library can avoid this, but the code will be
     much more complex.  Regardless, any implementation of this
     seems to require restarting a connection to the remote
     server.

     Also of note is that SVN 1.4 and later allows a more
     efficient diff_summary to be done instead of a full diff,
     but since this code is only to support SVN < 1.4.4, we'll
     ignore it for now.]

Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-03 17:54:34 -07:00
Junio C Hamano
f94bf44041 builtin-apply: fix conversion error in strbuf series
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-03 17:42:52 -07:00
Junio C Hamano
cc61ae82ec Merge branch 'mv/unknown'
* mv/unknown:
  Don't use "<unknown>" for placeholders and suppress printing of empty user formats.
2007-10-03 04:28:24 -07:00
Junio C Hamano
66d4035e10 Merge branch 'ph/strbuf'
* ph/strbuf: (44 commits)
  Make read_patch_file work on a strbuf.
  strbuf_read_file enhancement, and use it.
  strbuf change: be sure ->buf is never ever NULL.
  double free in builtin-update-index.c
  Clean up stripspace a bit, use strbuf even more.
  Add strbuf_read_file().
  rerere: Fix use of an empty strbuf.buf
  Small cache_tree_write refactor.
  Make builtin-rerere use of strbuf nicer and more efficient.
  Add strbuf_cmp.
  strbuf_setlen(): do not barf on setting length of an empty buffer to 0
  sq_quote_argv and add_to_string rework with strbuf's.
  Full rework of quote_c_style and write_name_quoted.
  Rework unquote_c_style to work on a strbuf.
  strbuf API additions and enhancements.
  nfv?asprintf are broken without va_copy, workaround them.
  Fix the expansion pattern of the pseudo-static path buffer.
  builtin-for-each-ref.c::copy_name() - do not overstep the buffer.
  builtin-apply.c: fix a tiny leak introduced during xmemdupz() conversion.
  Use xmemdupz() in many places.
  ...
2007-10-03 03:06:02 -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
9b0185ca06 Merge branch 'js/rebase-i'
* js/rebase-i:
  rebase -i: work on a detached HEAD
2007-10-03 03:05:39 -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
e56f6359ff Merge branch 'je/hooks'
* je/hooks:
  post-checkout hook, tests, and docs
2007-10-03 03:03:40 -07:00
Junio C Hamano
5e5b2b98c8 Merge branch 'ap/dateformat'
* ap/dateformat:
  Add a test script for for-each-ref, including test of date formatting
  dateformat: parse %(xxdate) %(yydate:format) correctly
  Make for-each-ref's grab_date() support per-atom formatting
  Make for-each-ref allow atom names like "<name>:<something>"
  parse_date_format(): convert a format name to an enum date_mode
2007-10-03 03:03:22 -07:00
Junio C Hamano
fed276e752 Sync with GIT 1.5.3.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-03 03:03:15 -07:00
Junio C Hamano
4c75136f76 GIT 1.5.3.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
v1.5.3.4
2007-10-03 02:33:48 -07:00
Andy Parkins
96b2d4fa92 Add a test script for for-each-ref, including test of date formatting
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-03 01:34:25 -07:00
Carl Worth
54e1abce90 Add test case for ls-files --with-tree
This tests basic functionality and also exercises a bug noticed
by Keith Packard, (prune_cache followed by add_index_entry can
trigger an attempt to realloc a pointer into the middle of an
allocated buffer).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-03 00:53:24 -07:00
Keith Packard
95af39fcb2 Must not modify the_index.cache as it may be passed to realloc at some point.
The index cache is not static, growing as new entries are added. If
entries are added after prune_cache is called, cache will no longer
point at the base of the allocation, and realloc will not be happy.

I verified that this was the only place in the current source which
modified any index_state.cache elements aside from the alloc/realloc
calls in read-cache by changing the type of the element to 'struct
cache_entry ** const cache' and recompiling.

A more efficient patch would create a separate 'cache_base' value to
track the allocation and then fix things up when reallocation was
necessary, instead of the brute-force memmove used here.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 23:18:58 -07:00
Shawn O. Pearce
906ab7f6c0 git-gui: Don't crash when starting gitk from a browser session
If the user has started git-gui from the command line as a browser
we offer the gitk menu options but we didn't create the main status
bar widget in the "." toplevel.  Trying to access it while starting
gitk just results in Tcl errors.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-03 00:16:04 -04:00
Shawn O. Pearce
501e4c6f23 git-gui: Allow gitk to be started on Cygwin with native Tcl/Tk
gitk expects $env(GIT_DIR) to be valid as both a path that core Git
and Tcl/Tk can resolve to a valid directory, but it has no special
handling for Cygwin style UNIX paths and Windows style paths.  So
we need to do that for gitk and ensure that only relative paths are
fed to it, thus allowing both Cygwin style and UNIX style paths to
be resolved.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-03 00:14:18 -04:00
Daniel Barkalow
2b5a06edca Restore default verbosity for http fetches.
This adds a verbosity level below 0 for suppressing default messages
with --quiet, and makes the default for http be verbose instead of
quiet. This matches the behavior of the shell script version of git-fetch.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 21:12:01 -07:00
Robert Schiele
96e24abc9f the ar tool is called gar on some systems
Some systems that have only installed the GNU toolchain (prefixed with "g")
do not provide "ar" but only "gar".  Make configure find this tool as well.

Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 21:10:25 -07:00
Junio C Hamano
8ae92e6389 rename diff_free_filespec_data_large() to diff_free_filespec_blob()
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 21:02:09 -07:00
Jeff King
eede7b7d11 diffcore-rename: cache file deltas
We find rename candidates by computing a fingerprint hash of
each file, and then comparing those fingerprints. There are
inherently O(n^2) comparisons, so it pays in CPU time to
hoist the (rather expensive) computation of the fingerprint
out of that loop (or to cache it once we have computed it once).

Previously, we didn't keep the filespec information around
because then we had the potential to consume a great deal of
memory. However, instead of keeping all of the filespec
data, we can instead just keep the fingerprint.

This patch implements and uses diff_free_filespec_data_large
to accomplish that goal. We also have to change
estimate_similarity not to needlessly repopulate the
filespec data when we already have the hash.

Practical tests showed 4.5x speedup for a 10% memory usage
increase.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 21:02:03 -07:00
Johan Herland
2ff5e18a93 Mention 'cpio' dependency in INSTALL
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 17:35:29 -07:00
Federico Mena Quintero
8fc293cb1e Make git-pull complain and give advice when there is nothing to merge with
Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 17:27:48 -07:00
Federico Mena Quintero
46749204e9 Note that git-branch will not automatically checkout the new branch
Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 17:27:00 -07:00
Federico Mena Quintero
84d176cef6 Add documentation for --track and --no-track to the git-branch docs.
Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 17:26:52 -07:00
Federico Mena Quintero
ac150747d7 Say when --track is useful in the git-checkout docs.
The documentation used to say what the option does, but it
didn't mention a use case.

Signed-off-by: Federico Mena Quintero <federico@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 17:26:40 -07:00
Johannes Schindelin
6ea9c7eb27 Fix typo in config.txt
There was an 'l' (ell) instead of a '1' (one) in one of the gitlinks.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 15:26:57 -07:00
Junio C Hamano
9e1a2acfb2 for-each-ref: fix %(numparent) and %(parent)
The string value of %(numparent) was not returned correctly.
Also %(parent) misbehaved for the root commits (returned garbage)
and merge commits (returned first parent, followed by a space).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 15:12:05 -07:00
Junio C Hamano
070f6918d1 dateformat: parse %(xxdate) %(yydate:format) correctly
Andy Parkins noticed that parsing of the above would not
correctly notice that xxdate does not have any format
specifier.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-02 14:31:37 -07:00