Commit Graph

9794 Commits

Author SHA1 Message Date
Junio C Hamano
667152528d Merge branch 'maint'
* maint:
  checkout: allow detaching to HEAD even when switching to the tip of a branch
  Updated documentation of hooks in git-receive-pack.
  Allow fetching references from any namespace
  tiny fix in documentation of git-clone
  Fix an unmatched comment end in arm/sha1_arm.S
2007-05-12 13:16:21 -07:00
Junio C Hamano
fdc99cbbdc checkout: allow detaching to HEAD even when switching to the tip of a branch
You cannot currently checkout the tip of an existing branch
without moving to the branch.

This allows you to detach your HEAD and place it at such a
commit, with:

    $ git checkout master^0

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-12 12:35:54 -07:00
Jan Hudec
cbb84e5d17 Updated documentation of hooks in git-receive-pack.
Added documentation of pre-receive and post-receive hooks and updated
documentation of update and post-update hooks.

[jc: with minor copy-editing]

Signed-off-by: Jan Hudec <bulb@ucw.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-12 11:13:08 -07:00
Junio Hamano
a25907dac4 t9400: Use the repository config and nothing else.
git-cvsserver has a bug in its configuration file output parser
that makes it choke if the configuration has these:

        [diff]
                color = auto
        [diff.color]
                whitespace = blue reverse

This needs to be fixed, but thanks to that bug, a separate bug
in t9400 test script was discovered.  The test discarded
GIT_CONFIG instead of pointing at the proper one to be used in
the exoprted repository.  This allowed user's .gitconfig and (if
exists) systemwide /etc/gitconfig to affect the outcome of the
test, which is a big no-no.

The patch fixes the problem in the test.  Fixing the
git-cvsserver's configuration parser is left as an exercise to
motivated volunteers ;-)

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-12 10:19:13 -07:00
Alex Riesen
96f12b54f7 Allow fetching references from any namespace
not only from the three defined: heads, tags and remotes.

Noticed when I tried to fetch the references created by git-p4-import.bat:
they are placed into separate namespace (refs/p4import/, to avoid showing
them in git-branch output). As canon_refs_list_for_fetch always prepended
refs/heads/ it was impossible, and annoying: it worked before. Normally,
the p4import references are useless anywhere but in the directory managed
by perforce, but in this special case the cloned directory was supposed
to be a backup, including the p4import branch: it keeps information about
where the imported perforce state came from.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-12 09:36:06 -07:00
Lars Hjemli
02851e0b9e git-archive: don't die when repository uses subprojects
Both archive-tar and archive-zip needed to be taught about subprojects.
The tar function died when trying to read the subproject commit object,
while the zip function reported "unsupported file mode".

This fixes both by representing the subproject as an empty directory.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-12 09:35:07 -07:00
Steffen Prohaska
a6e3768f64 tiny fix in documentation of git-clone
path in example was missing '../'

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-12 09:20:51 -07:00
Jakub Narebski
2206537c07 gitweb: Test if $from_id and $to_id are defined before comparison
Get rid of "Use of uninitialized value in string eq at
gitweb/gitweb.perl line 2320" warning caused by the fact that "empty"
patches, consisting only of extended git diff header and with patch
body empty, such as patch for pure rename, does not have "index" line
in extended diff header.  For such patches $from_id and $to_id, filled
from parsing extended diff header, are undefined.  But such patches
cannot be continuation patches.

Test if $from_id and $to_id are defined before comparing them with
$diffinfo.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-12 09:19:08 -07:00
Marco Costalba
7e9116b1d8 Fix an unmatched comment end in arm/sha1_arm.S
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-12 09:16:50 -07:00
Jeff King
93c44d493b git-add: allow path limiting with -u
Rather than updating all working tree paths, we limit
ourselves to paths listed on the command line.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-12 01:01:28 -07:00
Junio C Hamano
16a4c6176a read-tree -m -u: avoid getting confused by intermediate symlinks.
When switching from a branch with both x86_64/boot/Makefile and
i386/boot/Makefile to another branch that has x86_64/boot as a
symlink pointing at ../i386/boot, the code incorrectly removed
i386/boot/Makefile.

This was because we first removed everything under x86_64/boot
to make room to create a symbolic link x86_64/boot, then removed
x86_64/boot/Makefile which no longer exists but now is pointing
at i386/boot/Makefile, thanks to the symlink we just created.

This fixes it by using the has_symlink_leading_path() function
introduced previously for git-apply in the checkout codepath.
Earlier, "git checkout" was broken in t4122 test due to this
bug, and the test had an extra "git reset --hard" as a
workaround, which is removed because it is not needed anymore.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-11 22:33:31 -07:00
Junio C Hamano
64cab59159 apply: do not get confused by symlinks in the middle
HPA noticed that git-rebase fails when changes involve symlinks
in the middle of the hierarchy.  Consider:

 * The tree state before the patch is applied has arch/x86_64/boot
   as a symlink pointing at ../i386/boot/

 * The patch tries to remove arch/x86_64/boot symlink, and
   create bunch of files there: .gitignore, Makefile, etc.

git-apply tries to be careful while applying patches; it never
touches the working tree until it is convinced that the patch
would apply cleanly.  One of the check it does is that when it
knows a path is going to be created by the patch, it runs
lstat() on the path to make sure it does not exist.

This leads to a false alarm.  Because we do not touch the
working tree before all the check passes, when we try to make
sure that arch/x86_64/boot/.gitignore does not exist yet, we
haven't removed the arch/x86_64/boot symlink.  The lstat() check
ends up seeing arch/i386/boot/.gitignore through the
yet-to-be-removed symlink, and says "Hey, you already have a
file there, but what you fed me is a patch to create a new
file. I am not going to clobber what you have in the working
tree."

We have similar checks to see a file we are going to modify does
exist and match the preimage of the diff, which is done by
directly opening and reading the file.

For a file we are going to delete, we make sure that it does
exist and matches what is going to be removed (a removal patch
records the full preimage, so we check what you have in your
working tree matches it in full -- otherwise we would risk
losing your local changes), which again is done by directly
opening and reading the file.

These checks need to be adjusted so that they are not fooled by
symlinks in the middle.

 - To make sure something does not exist, first lstat().  If it
   does not exist, it does not, so be happy.  If it _does_, we
   might be getting fooled by a symlink in the middle, so break
   leading paths and see if there are symlinks involved.  When
   we are checking for a path a/b/c/d, if any of a, a/b, a/b/c
   is a symlink, then a/b/c/d does _NOT_ exist, for the purpose
   of our test.

   This would fix this particular case you saw, and would not
   add extra overhead in the usual case.

 - To make sure something already exists, first lstat().  If it
   does not exist, barf (up to this, we already do).  Even if it
   does seem to exist, we might be getting fooled by a symlink
   in the middle, so make sure leading paths are not symlinks.

   This would make the normal codepath much more expensive for
   deep trees, which is a bit worrisome.

This patch implements the first side of the check "making sure
it does not exist".  The latter "making sure it exists" check is
not done yet, so applying the patch in reverse would still
fail, but we have to start from somewhere.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-11 22:26:08 -07:00
Junio C Hamano
f859c846e9 Add has_symlink_leading_path() function.
When we are applying a patch that creates a blob at a path, or
when we are switching from a branch that does not have a blob at
the path to another branch that has one, we need to make sure
that there is nothing at the path in the working tree, as such a
file is a local modification made by the user that would be lost
by the operation.

Normally, lstat() on the path and making sure ENOENT is returned
is good enough for that purpose.  However there is a twist.  We
may be creating a regular file arch/x86_64/boot/Makefile, while
removing an existing symbolic link at arch/x86_64/boot that
points at existing ../i386/boot directory that has Makefile in
it.  We always first check without touching filesystem and then
perform the actual operation, so when we verify the new file,
arch/x86_64/boot/Makefile, does not exist, we haven't removed
the symbolic link arc/x86_64/boot symbolic link yet.  lstat() on
the file sees through the symbolic link and reports the file is
there, which is not what we want.

The function has_symlink_leading_path() function takes a path,
and sees if any of the leading directory component is a symbolic
link.

When files in a new directory are created, we tend to process
them together because both index and tree are sorted.  The
function takes advantage of this and allows the caller to cache
and reuse which symbolic link on the filesystem caused the
function to return true.

The calling sequence would be:

	char last_symlink[PATH_MAX];

        *last_symlink = '\0';
        for each index entry {
		if (!lose)
			continue;
		if (lstat(it))
			if (errno == ENOENT)
				; /* happy */
			else
				error;
		else if (has_symlink_leading_path(it, last_symlink))
			; /* happy */
		else
			error; /* would lose local changes */
		unlink_entry(it, last_symlink);
	}

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-11 22:11:07 -07:00
Junio C Hamano
211fb4fe78 Minor copyediting on Release Notes for 1.5.2
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 21:59:13 -07:00
Junio C Hamano
843142ada0 GIT v1.5.2-rc3
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 15:22:02 -07:00
Michael Hendricks
56822cc9ab Document 'git-log --decorate'
Signed-off-by: Michael Hendricks <michael@ndrix.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 15:21:54 -07:00
Shawn O. Pearce
1dcb3b6478 Correct error message in revert/cherry-pick
We now write to MERGE_MSG, not .msg.  I missed this earlier
when I changed the target we write to.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 15:21:50 -07:00
Junio C Hamano
2b93bfac0f Merge branch 'master' of git://repo.or.cz/git-gui
* 'master' of git://repo.or.cz/git-gui:
  git gui 0.7.0
  git-gui: Paperbag fix blame in subdirectory
  git-gui: Format author/committer times in ISO format
  git-gui: Cleanup minor nits in blame code
  git-gui: Generate blame on uncommitted working tree file
  git-gui: Smarter command line parsing for browser, blame
  git-gui: Use prefix if blame is run in a subdirectory
  git-gui: Convert blame to the "class" way of doing things
  git-gui: Don't attempt to inline array reads in methods
  git-gui: Convert browser, console to "class" format
  git-gui: Define a simple class/method system
  git-gui: Allow shift-{k,j} to select a range of branches to merge
  git-gui: Call changes "Staged" and "Unstaged" in file list titles.
2007-05-10 15:08:18 -07:00
Shawn O. Pearce
d6da71a9d1 git gui 0.7.0
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-10 17:54:45 -04:00
Shawn O. Pearce
6b3d8b97cb git-gui: Paperbag fix blame in subdirectory
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-10 17:53:34 -04:00
Junio C Hamano
ffcc952b33 Merge branch 'maint'
* maint:
  Fix documentation of tag in git-fast-import.txt
  Properly handle '0' filenames in import-tars
2007-05-10 14:48:04 -07:00
Junio C Hamano
a9d9a1bfdd Merge branch 'maint' of git://repo.or.cz/git/fastimport into maint
* 'maint' of git://repo.or.cz/git/fastimport:
  Fix documentation of tag in git-fast-import.txt
  Properly handle '0' filenames in import-tars
2007-05-10 14:47:14 -07:00
Richard P. Curnow
419ca50e4c Fix documentation of tag in git-fast-import.txt
The tag command does not take a trailing LF.

Signed-off-by: Richard P. Curnow <rc@rc0.org.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-10 17:32:40 -04:00
Shawn O. Pearce
da774e8272 Merge branch 'gfi-maint' into maint
* gfi-maint:
  Properly handle '0' filenames in import-tars
2007-05-10 17:31:27 -04:00
Petr Baudis
63fcbe00a6 gitweb: Do not use absolute font sizes
Avoid specifying font sizes in pixels, since that is just pure evil.
Pointed out by Chris Riddoch.

Note that this is pretty much just a proposal; I didn't test if everything
fits perfectly right, but things seem to be pretty much okay. repo.or.cz
uses it now as a test drive - if you find any visual quirks, please point
them out, with a patch if possible since I'm total CSS noob and debugging
CSS is an extremely painful experience for me.

Note that this patch actually does change visual look of gitweb in Firefox
with my resolution and default settings - everything is bigger and I can't
explain the joy of actually seeing gitweb text that is in _readable_ size;
also, my horizontal screen real estate feels better used now. But judging
from the look of most modern webpages on the 'net, most people prefer
reading the web with strained eyes and/or a magnifying glass (I wonder what
species of scientists should look into this mystifying phenomenon) - so,
please tell us what you think.

Maybe we might want to get rid of absolute sizes other than font sizes in
the CSS file too in the long term.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 14:13:29 -07:00
Petr Baudis
35c49eeae7 Git.pm: config_boolean() -> config_bool()
This patch renames config_boolean() to config_bool() for consistency with
the commandline interface and because it is shorter but still obvious. ;-)
It also changes the return value from some obscure string to real Perl
boolean, allowing for clean user code.

Signed-off-by: Petr Baudis <pasky@suse.cz>
2007-05-10 14:13:29 -07:00
Junio C Hamano
efa615ba08 Merge branch 'maint'
* maint:
  .mailmap: add some aliases
  SPECIFYING RANGES typo fix: it it => it is
  git-clone: don't get fooled by $PWD
  Fix documentation of tag in git-fast-import.txt
2007-05-10 13:52:54 -07:00
Junio C Hamano
b722b95855 .mailmap: add some aliases 2007-05-10 13:26:26 -07:00
Jari Aalto
e18ee576b1 SPECIFYING RANGES typo fix: it it => it is
Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 13:26:26 -07:00
Junio C Hamano
c2f599e09f git-clone: don't get fooled by $PWD
If you have /home/me/git symlink pointing at /pub/git/mine,
trying to clone from /pub/git/his/ using relative path would not
work as expected:

	$ cd /home/me
        $ cd git
        $ ls ../
        his    mine
        $ git clone -l -s -n ../his/stuff.git

This is because "cd ../his/stuff.git" done inside git-clone to
check if the repository is local is confused by $PWD, which is
set to /home/me, and tries to go to /home/his/stuff.git which is
different from /pub/git/his/stuff.git.

We could probably say "set -P" (or "cd -P") instead, if we know
the shell is POSIX, but the way the patch is coded is probably
more portable.

[jc: this is updated with Andy Whitcroft's improvements]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 13:26:14 -07:00
Gerrit Pape
7f9778b19b gitweb: choose appropriate view for file type if a= parameter missing
gitweb URLs use the a= parameter for the view to use on the given path, such
as "blob" or "tree".  Currently, if a gitweb URL omits the a= parameter,
gitweb just shows the top-level repository summary, regardless of the path
given.  gitweb could instead choose an appropriate view based on the file
type: blob for blobs (files), tree for trees (directories), and summary if
no path given (the URL included no f= parameter, or an empty f= parameter).

Apart from making gitweb more robust and supporting URL editing more easily,
this change would aid the creation of shortcuts to git repositories using
simple substitution, such as:
http://example.org/git/?p=path/to/repo.git;hb=HEAD;f=%s

With this patch, if given the hash through the h= parameter, or the hash
base (hb=) and a filename (f=), gitweb uses cat-file -t to automatically set
the a= parameter.

This feature was requested by Josh Triplett through
 http://bugs.debian.org/410465

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 00:42:43 -07:00
Quy Tonthat
7b6e0eb3c3 Added new git-gui library files to rpm spec
"make rpm" breaks without these files.

Signed-off-by: Quy Tonthat <qtonthat@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-10 00:09:28 -07:00
Richard P. Curnow
c69f405095 Fix documentation of tag in git-fast-import.txt
The tag command does not take a trailing LF.

Signed-off-by: Richard P. Curnow <rc@rc0.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-09 19:04:54 -07:00
Junio C Hamano
469be5b258 t9400: skip cvsserver test if Perl SQLite interface is unavailable
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-09 12:34:00 -07:00
Junio C Hamano
fba23c87fd Merge branch 'fl/cvsserver'
* fl/cvsserver:
  cvsserver: Add test cases for git-cvsserver
2007-05-09 00:33:40 -07:00
Junio C Hamano
9e6c7e0187 Merge branch 'jc/diffopt'
* jc/diffopt:
  diff -S: release the image after looking for needle in it
  diff -M: release the preimage candidate blobs after rename detection.
  diff.c: do not use a separate "size cache".
  diff: release blobs after generating textual diff.
2007-05-09 00:23:45 -07:00
Junio C Hamano
a626166854 Merge branch 'jn/gitweb'
* jn/gitweb:
  gitweb: Show combined diff for merge commits in 'commit' view
  gitweb: Show combined diff for merge commits in 'commitdiff' view
  gitweb: Make it possible to use pre-parsed info in git_difftree_body
  gitweb: Add combined diff support to git_patchset_body
  gitweb: Add combined diff support to git_difftree_body
  gitweb: Add parsing of raw combined diff format to parse_difftree_raw_line
2007-05-09 00:23:41 -07:00
Frank Lichtenheld
b3b5343970 cvsserver: Add test cases for git-cvsserver
Use the :fork: access method to force cvs to
call "$CVS_SERVER server" even when accessing a local
repository.

Add a basic test for checkout and some tests for update.

Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-08 23:55:58 -07:00
Junio C Hamano
467592ea92 Update documentation links to point at 1.5.1.4
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-08 23:47:35 -07:00
Theodore Ts'o
618e613a70 Increase pack.depth default to 50
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-08 22:47:17 -07:00
Theodore Ts'o
842aaf9323 Add pack.depth option to git-pack-objects.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-08 22:47:17 -07:00
Shawn O. Pearce
abda522777 Use .git/MERGE_MSG in cherry-pick/revert
Rather than storing the temporary commit message data in .msg (in
the working tree) we now store the message data in .git/MERGE_MSG.

By storing the message in the .git/ directory we are sure we will
never have a collision with a user file, should a project actually
have a ".msg" file in their top level tree.  We also don't need to
worry about leaving this stale file behind during a `reset --hard`
and have it show up in the output of status.

We are using .git/MERGE_MSG here to store the temporary message as
it is an already established convention between git-merge, git-am
and git-rebase that git-commit will default the user's edit buffer
to the contents of .git/MERGE_MSG.  If the user is going to need
to resolve this commit or wants to edit the message on their own
prepping that file with the desired message "just works".

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-08 22:47:09 -07:00
Junio C Hamano
4662231e56 Merge branch 'maint'
* maint:
  GIT v1.5.1.4
  Add howto files to rpm packages.
  wcwidth redeclaration
  user-manual: fix clone and fetch typos
2007-05-08 22:46:56 -07:00
Junio C Hamano
1cc202bd4e GIT v1.5.1.4
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-08 22:11:17 -07:00
Quy Tonthat
22f09585d4 Add howto files to rpm packages.
RPM packages did not include howto files which causes broken
links in howto-index.html

Signed-off-by: Quy Tonthat <qtonthat@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-08 22:09:04 -07:00
Shawn O. Pearce
76486bbefb git-gui: Format author/committer times in ISO format
This is a simple change to match what gitk does when it shows
a commit; we format using ISO dates (yyyy-mm-dd HH:MM:SS).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-09 00:48:27 -04:00
Shawn O. Pearce
0511798f06 git-gui: Cleanup minor nits in blame code
We can use [list ...] rather than "", especially when we are talking
about values as then they are properly escaped if necessary.  Small
nit, but probably not a huge deal as the only data being inlined here
is Tk paths.

Some of the lines in the parser code were longer than 80 characters
wide, and they actually were all the same value on the end part of
the line.  Rather than keeping the mess copied-and-pasted around we
can set the last argument into a local variable and reuse it many
times.

The commit display code was also rather difficult to read on an 80
character wide terminal, so I'm moving it all into a double quoted
string that is easier to read.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-09 00:36:25 -04:00
Shawn O. Pearce
a0db0d61fb git-gui: Generate blame on uncommitted working tree file
If the user doesn't give us a revision parameter to our blame
subcommand then we can generate blame against the working tree
file by passing the file path off to blame with the --contents
argument.  In this case we cannot obtain the contents of the
file from the ODB; instead we must obtain the contents by
reading the working directory file as-is.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-08 22:48:47 -04:00
Shawn O. Pearce
3e45ee1ef2 git-gui: Smarter command line parsing for browser, blame
The browser subcommand now optionally accepts a single revision
argument; if no revision argument is supplied then we use the
current branch as the tree to browse.  This is very common, so
its a nice option.

Our blame subcommand now tries to perform the same assumptions
as the command line git-blame; both the revision and the file
are optional.  We assume the argument is a filename if the file
exists in the working directory, otherwise we assume the argument
is a revision name.  A -- can be supplied between the two to force
parsing, or before the filename to force it to be a filename.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-08 22:36:01 -04:00
Shawn O. Pearce
c6127856eb git-gui: Use prefix if blame is run in a subdirectory
I think it was Andy Parkins who pointed out that git gui blame HEAD f
does not work if f is in a subdirectory and we are currently running
git-gui within that subdirectory.  This is happening because we did
not take the user's prefix into account when we computed the file
path in the repository.

We now assume the prefix as returned by rev-parse --show-prefix is
valid and we use that during the command line blame subcommand when
we apply the parameters.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-05-08 21:58:25 -04:00