1
0
mirror of https://github.com/git/git.git synced 2024-10-06 00:21:19 +02:00
Commit Graph

10897 Commits

Author SHA1 Message Date
Simon Hausmann
583e170706 Fix common path "calculation" from logs of multiple branches.
Need to use min instead of max for prev/cur to avoid out-of-bounds
string access. Also treat "i" as index of the last match instead of
a length because in case of a complete match of the two strings
i was off by one.

Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 09:37:13 +02:00
Simon Hausmann
845b42cb6c Fix support for "depot-path" in older git-p4 imports
Signed-off-by: Simon Hausmann <shausman@trolltech.com>
2007-06-07 09:19:34 +02:00
Junio C Hamano
a6080a0a44 War on whitespace
This uses "git-apply --whitespace=strip" to fix whitespace errors that have
crept in to our source files over time.  There are a few files that need
to have trailing whitespaces (most notably, test vectors).  The results
still passes the test, and build result in Documentation/ area is unchanged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07 00:04:01 -07:00
Alex Riesen
defe13a24a Fix clone to setup the origin if its name ends with .git
The problem is visible when cloning a local repo. The cloned
repository will have the origin url setup incorrectly: the origin name
will be copied verbatim in origin url of the cloned repository.
Normally, the name is to be expanded into absolute path.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:40:03 -07:00
Elvis Pranskevichus
5c08931dfc Use git-tag in git-cvsimport
Currently git-cvsimport tries to create tag objects directly via git-mktag
in a very broken way, e.g the stuff it writes into the tagger field of
the tag object doesn't really resemble the GIT_COMMITTER_IDENT. This makes
gitweb and possibly other tools that try to interpret tag objects to be
confused about tag date and authorship.

Fix this by calling git-tag instead. This also has a nice side effect of
not creating the tag object but only the lightweight tag as that's the only
thing CVS has anyways.

Signed-off-by: Elvis Pranskevichus <el@prans.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:14:28 -07:00
Matthias Lederhofer
9489d0f197 filter-branch: always export GIT_DIR if it is set
Currently filter-branch exports GIT_DIR only if it is an
relative path but git-sh-setup might also set GIT_DIR to an
absolute path that is not exported yet.  Additionally export
GIT_WORK_TREE with GIT_DIR to ensure that cwd is used as
working tree even for bare repositories.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:08:37 -07:00
Junio C Hamano
3270736bd1 Merge branch 'js/filter' into ei/worktree+filter
* js/filter:
  filter-branch: also don't fail in map() if a commit cannot be mapped
  filter-branch: Use rev-list arguments to specify revision ranges.
  filter-branch: fix behaviour of '-k'
  filter-branch: use $(($i+1)) instead of $((i+1))
  chmod +x git-filter-branch.sh
  filter-branch: prevent filters from reading from stdin
  t7003: make test repeatable
  Add git-filter-branch
2007-06-06 16:08:34 -07:00
Matthias Lederhofer
f4f51add27 setup_git_directory: fix segfault if repository is found in cwd
Additionally there was a similar part calling setenv and getenv
in the same way which missed a check if getenv succeeded.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Matthias Lederhofer
3ae4a867d3 test GIT_WORK_TREE
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Matthias Lederhofer
6c56049ff6 extend rev-parse test for --is-inside-work-tree
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Matthias Lederhofer
7ae3df8c0a Use new semantics of is_bare/inside_git_dir/inside_work_tree
Up to now to check for a working tree this was used:
	!is_bare && !inside_git_dir
(the check for bare is redundant because is_inside_git_dir
returned already 1 for bare repositories).
Now the check is:
	inside_work_tree && !inside_git_dir

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Matthias Lederhofer
892c41b98a introduce GIT_WORK_TREE to specify the work tree
setup_gdg is used as abbreviation for setup_git_directory_gently.

The work tree can be specified using the environment variable
GIT_WORK_TREE and the config option core.worktree (the environment
variable has precendence over the config option).  Additionally
there is a command line option --work-tree which sets the
environment variable.

setup_gdg does the following now:

GIT_DIR unspecified
repository in .git directory
    parent directory of the .git directory is used as work tree,
    GIT_WORK_TREE is ignored

GIT_DIR unspecified
repository in cwd
    GIT_DIR is set to cwd
    see the cases with GIT_DIR specified what happens next and
    also see the note below

GIT_DIR specified
GIT_WORK_TREE/core.worktree unspecified
    cwd is used as work tree

GIT_DIR specified
GIT_WORK_TREE/core.worktree specified
    the specified work tree is used

Note on the case where GIT_DIR is unspecified and repository is in cwd:
    GIT_WORK_TREE is used but is_inside_git_dir is always true.
    I did it this way because setup_gdg might be called multiple
    times (e.g. when doing alias expansion) and in successive calls
    setup_gdg should do the same thing every time.

Meaning of is_bare/is_inside_work_tree/is_inside_git_dir:

(1) is_bare_repository
    A repository is bare if core.bare is true or core.bare is
    unspecified and the name suggests it is bare (directory not
    named .git).  The bare option disables a few protective
    checks which are useful with a working tree.  Currently
    this changes if a repository is bare:
        updates of HEAD are allowed
        git gc packs the refs
        the reflog is disabled by default

(2) is_inside_work_tree
    True if the cwd is inside the associated working tree (if there
    is one), false otherwise.

(3) is_inside_git_dir
    True if the cwd is inside the git directory, false otherwise.
    Before this patch is_inside_git_dir was always true for bare
    repositories.

When setup_gdg finds a repository git_config(git_default_config) is
always called.  This ensure that is_bare_repository makes use of
core.bare and does not guess even though core.bare is specified.

inside_work_tree and inside_git_dir are set if setup_gdg finds a
repository.  The is_inside_work_tree and is_inside_git_dir functions
will die if they are called before a successful call to setup_gdg.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Matthias Lederhofer
dace6e44f6 test git rev-parse
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Matthias Lederhofer
493c774e58 rev-parse: introduce --is-bare-repository
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Matthias Lederhofer
4faac2468d rev-parse: document --is-inside-git-dir
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:07:53 -07:00
Alexandre Julliard
3af51928ab pack-check: Sort entries by pack offset before unpacking them.
Because of the way objects are sorted in a pack, unpacking them in
disk order is much more efficient than random access. Tests on the
Wine repository show a gain in pack validation time of about 35%.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 16:04:02 -07:00
Junio C Hamano
d44c782bbd Merge branch 'sv/objfixes'
* sv/objfixes:
  Don't assume tree entries that are not dirs are blobs
  git-cvsimport: Make sure to use $git_dir always instead of .git sometimes
  fix documentation of unpack-objects -n
  Accept dates before 2000/01/01 when specified as seconds since the epoch
2007-06-06 15:43:24 -07:00
Sam Vilain
e2ac7cb5fb Don't assume tree entries that are not dirs are blobs
When scanning the trees in track_tree_refs() there is a "lazy" test
that assumes that entries are either directories or files.  Don't do
that.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 15:43:18 -07:00
Michael Milligan
23fcdc7971 git-cvsimport: Make sure to use $git_dir always instead of .git sometimes
CVS import was failing on a couple repos I was trying to import.
I was setting GIT_DIR=newproj.git and using the -i flag, but this bug
was thwarting the effort...  evil CVS.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 15:23:35 -07:00
Sam Vilain
e59ade9f90 fix documentation of unpack-objects -n
unpack-objects -n didn't print the object list as promised on the
manual page, so alter the documentation to reflect the behaviour

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 15:20:13 -07:00
Johannes Sixt
a1a5a6347b Accept dates before 2000/01/01 when specified as seconds since the epoch
Tests with git-filter-branch on a repository that was converted from
CVS and that has commits reaching back to 1999 revealed that it is
necessary to parse dates before 2000/01/01 when they are specified
as seconds since 1970/01/01. There is now still a limit, 100000000,
which is 1973/03/03 09:46:40 UTC, in order to allow that dates are
represented as 8 digits.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 15:20:12 -07:00
Johannes Sixt
f07dfbad29 Makefile: Remove git-merge-base from PROGRAMS.
git-merge-base is a builtin.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 13:19:16 -07:00
Johannes Schindelin
3a86f36bed t5000: skip ZIP tests if unzip was not found
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 13:13:58 -07:00
Johannes Sixt
3520e1e868 filter-branch: also don't fail in map() if a commit cannot be mapped
The map() function can be used by filters to map a commit id to its
rewritten id. Such a mapping may not exist, in which case the identity
mapping is used (the commit is returned unchanged).

In the rewrite loop, this mapping is also needed, but was done
explicitly in the same way. Use the map() function instead.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 12:49:16 -07:00
Johannes Sixt
2766ce2815 filter-branch: Use rev-list arguments to specify revision ranges.
A subset of commits in a branch used to be specified by options (-k, -r)
as well as the branch tip itself (-s). It is more natural (for git users)
to specify revision ranges like 'master..next' instead. This makes it so.
If no range is specified it defaults to 'HEAD'.

As a consequence, the new name of the filtered branch must be the first
non-option argument. All remaining arguments are passed to 'git rev-list'
unmodified.

The tip of the branch that gets filtered is implied: It is the first
commit that git rev-list would print for the specified range.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 12:49:16 -07:00
Johannes Schindelin
9840906026 filter-branch: fix behaviour of '-k'
The option '-k' says that the given commit and _all_ of its ancestors
are kept as-is.

However, if a to-be-rewritten commit branched from an ancestor of an
ancestor of a commit given with '-k', filter-branch would fail.

Example:

	A - B
	  \
	    C

If filter-branch was called with '-k B -s C', it would actually keep
B (and A as its parent), but would rewrite C, and its parent.

Noticed by Johannes Sixt.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 12:49:16 -07:00
Johannes Schindelin
c12764b8b7 filter-branch: use $(($i+1)) instead of $((i+1))
The expression $((i+1)) is not portable at all: even some bash versions
do not grok it. So do not use it.

Noticed by Jonas Fonseca.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 12:31:56 -07:00
Lars Hjemli
211b7f19c7 git-submodule: clone during update, not during init
This teaches 'git-submodule init' to register submodule paths and urls in
.git/config instead of actually cloning them. The cloning is now handled
as part of 'git-submodule update'.

With this change it is possible to specify preferred/alternate urls for
the submodules in .git/config before the submodules are cloned.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 02:49:08 -07:00
Lars Hjemli
33aa6fff5d git-submodule: move cloning into a separate function
This is just a simple refactoring of modules_init() with no change in
functionality.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 02:49:08 -07:00
Andy Whitcroft
06baffd3df cvsimport: add <remote>/HEAD reference in separate remotes more
When in separate remote mode (via -r <remote>) we can now use
the name HEAD for the CVS HEAD.  In keeping with git-clone
remotes/<remote>/HEAD is creates as a symbolic ref to the user
specified name for the HEAD which defaults to master.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 02:35:49 -07:00
Andy Whitcroft
cbc9be5ca3 cvsimport: update documentation to include separate remotes option
Document the cvsimport -r <remote> option which switches cvsimport
to using a separate remote for tracking branches.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 02:35:49 -07:00
Andy Whitcroft
8b7f5fc1ca cvsimport: add support for new style remote layout
cvsimport creates any branches found in the remote CVS repository
in the refs/heads namespace.  This makes sense for a repository
conversion.  When using git as a sane interface to a remote CVS
repository, that repository may well remain as the 'master'
respository.  In this model it makes sense to import the CVS
repository into the refs/remotes namespace.

Add a new option '-r <remote>' to set the remote name for
this import.  When this option is specified branches are named
refs/remotes/<remote>/branch, with HEAD named as master matching
git-clone separate remotes layout.  Without branches are placed
ion refs/heads, with HEAD named origin as before.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 02:35:49 -07:00
Junio C Hamano
6abd0fb396 Merge branch 'mm/tag'
* mm/tag:
  Teach git-tag about showing tag annotations.
2007-06-06 02:29:41 -07:00
Matthias Lederhofer
d674ee4cfc chmod +x git-filter-branch.sh
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 01:29:52 -07:00
Junio C Hamano
11f68d9082 git-branch --track: fix tracking branch computation.
The original code did not take hierarchical branch names into account at all.

Tested-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 01:10:53 -07:00
Josh Triplett
2571ac6722 Fix typo in git-mergetool
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 00:40:50 -07:00
Jon Loeliger
e6ff0f42bb Add the --numbered-files option to git-format-patch.
With this option, git-format-patch will generate simple
numbered files as output instead of the default using
with the first commit line appended.

This simplifies the ability to generate an MH-style
drafts folder with each message to be sent.

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 00:35:15 -07:00
Pierre Habouzit
ec563e8153 $EMAIL is a last resort fallback, as it's system-wide.
$EMAIL is a system-wide setup that is used for many many many
applications. If the git user chose a specific user.email setup,
then _this_ should be honoured rather than $EMAIL.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 00:31:40 -07:00
Matthias Lederhofer
350d857529 filter-branch: prevent filters from reading from stdin
stdin is the list of commits when the env, tree and index
filter are executed.  The filters are not supposed to read
anything from stdin so the best is to give them /dev/null
for reading.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 00:29:47 -07:00
Matthias Lederhofer
d0f51a8b2a make clean should remove all the test programs too
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 00:28:24 -07:00
Matthias Lederhofer
aaa3ca7477 add git-filter-branch to .gitignore
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-06 00:28:10 -07:00
Shawn O. Pearce
0f32da53df git-gui: Favor the original annotations over the recent ones
Usually when you are looking at blame annotations for a region of
a file you are more interested in why something was originally
done then why it is here now.  This is because most of the time
when we get original annotation data we are looking at a simple
refactoring performed to better organize code, not to change its
semantic meaning or function.  Reorganizations are sometimes of
interest, but not usually.

We now show the original commit data first in the tooltip.  This
actually looks quite nice as the original commit will usually have an
author date prior to the current (aka move/copy) annotation's commit,
so the two commits will now tend to appear in chronological order.

I also found myself to always be clicking on the line of interest
in the file column but I always wanted the original tracking data
and not the move/copy data.  So I changed our default commit from
$asim_data (the simple move/copy annotation) to the more complex
$amov_data (the -M -C -C original annotation).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-06 03:22:22 -04:00
Shawn O. Pearce
949da61b9b git-gui: Improve our labeling of blame annotation types
It feels wrong to call the -M -C -C annotations "move/copy tracking"
as they are actually the original locations.  So I'm relabeling
the status bar to show "copy/move tracking annotations" for the
current file (no -M -C -C) as that set of annotations tells us who
put the hunk here (who moved/copied it).  I'm now calling the -M
-C -C pass "original location annotations" as that's what we're
really digging for.

I also tried to clarify some of the text in the hover tooltip.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-06 03:03:52 -04:00
Shawn O. Pearce
5d198d6766 git-gui: Use three colors for the blame viewer background
To prevent neighboring lines that are different commits from using
the same background color we now use 3 colors and assign them
by selecting the color that is not used before or after the line
in question.  We still color "on the fly" as we receive hunks from
git-blame, but we delay our color decisions until we are getting
the original location data (the slower -M -C -C pass) as that is
usually more fine-grained than the current location data.

Credit goes to Martin Waitz for the tri-coloring concept.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-06 02:53:36 -04:00
Shawn O. Pearce
0dfed77b3c git-gui: Jump to original line in blame viewer
When the user clicks on a commit link within one of the columns
in the blame viewer we now jump them not just to that commit/file
pair but also to the line of the original file.  This saves the
user a lot of time, as they don't need to search through the new
file data for the chunk they were previously looking at.

We also restore the prior view when the user clicks the back button
to return to a pior commit/file pair that they were looking at.

Turned out this was quite tricky to get working in Tk.  Every time
I tried to jump the text widgets to the correct locations by way
of the "yview moveto" or "see" subcommands Tk performed the change
until the current event finished dispatching, and then reset the
views back to 0, making the change never take place.  Forcing Tk
to run the pending events before we jump the UI resolves the issue.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-06 01:26:52 -04:00
Shawn O. Pearce
383d4e0f8b git-gui: Display both commits in our tooltips
If we have commit data from both the simple blame and the
rename/move tracking blame and they differ than there is a
bigger story to tell.  We now include data from both commits
so that the user can see that this link as moved, who moved
it, and where it originated from.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-06 01:26:52 -04:00
Shawn O. Pearce
172c92b475 git-gui: Run blame twice on the same file and display both outputs
We now perform two passes over any input file given to the blame
viewer.  Our first pass is a quick "git-blame" with no options,
getting the details of how each line arrived into this file.  We
are specifically ignoring/omitting the rename detection logic as
this first pass is to determine why things got into the state they
are in.

Once the first pass is complete and is displayed in the UI we run
a second pass, using the much more CPU intensive "-M -C -C" options
to perform extensive rename/movement detection.  The output of this
second pass is shown in a different column, allowing the user to see
for any given line how it got to be, and if it came from somewhere
else, where that is.

This is actually very instructive when run on our own lib/branch.tcl
script.  That file grew recently out of a very large block of code
in git-gui.sh.  The first pass shows when I created that file, while
the second pass shows the original commit information.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-06 01:26:51 -04:00
Shawn O. Pearce
debcd0fd02 git-gui: Display the "Loading annotation..." message in italic
If the user clicks on a line region that we haven't yet received
an annotation for from git-blame we show them "Loading annotation".
But I don't want the user to confuse this loading message with a
commit whose first line is "Loading annotation" and think we messed
up our display somehow.  Since we never use italics for anything
else, I'm going with the idea that italic slant can be used to show
data is missing/elided out at the time being.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-06 01:26:51 -04:00
Shawn O. Pearce
fc816d7b85 git-gui: Rename fields in blame viewer to better descriptions
Calling the commit message pane $w_cmit is a tad confusing when
we also have the $w_cgrp column that shows the abbreviated SHA-1s.

So w_cmit -> w_cviewer, as it is the "commit viewer"; and
w_cgrp -> w_amov as it is the "annotated commit + move tracking"
column.  Also changed line_data -> amov_data, as that list is
exactly the results shown in w_amov.

Why call the column "move tracking"?  Because this column holds
data from "git blame -M -C".  I'm considering adding an additional
column that holds the data from "git blame" without -M/-C, showing
who did the copy/move, and when they did it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-06 01:26:51 -04:00
Shawn O. Pearce
c5db65aef3 git-gui: Label the uncommitted blame history entry
If the user runs the blame viewer on a working directory file
instead of a specific commit-ish then we have no value for the
commit SHA1 or the summary line; this causes the history menu
to get an empty entry at the very bottom.  We now look for this
odd case and call the meny entry "Working Directory".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-06 01:26:50 -04:00