Commit graph

7771 commits

Author SHA1 Message Date
Junio C Hamano 73c838e4c9 git-checkout: rewording comments regarding detached HEAD.
We used to say "you are not on a branch" before the initial
commit.  This is incorrect -- the user is on a branch yet to be
born, but its name has been already determined.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 03:02:11 -08:00
Junio C Hamano 648861040f git-checkout: do not warn detaching HEAD when it is already detached.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 03:02:11 -08:00
Junio C Hamano c847f53712 Detached HEAD (experimental)
This allows "git checkout v1.4.3" to dissociate the HEAD of
repository from any branch.  After this point, "git branch"
starts reporting that you are not on any branch.  You can go
back to an existing branch by saying "git checkout master", for
example.

This is still experimental.  While I think it makes sense to
allow commits on top of detached HEAD, it is rather dangerous
unless you are careful in the current form.  Next "git checkout
master" will obviously lose what you have done, so we might want
to require "git checkout -f" out of a detached HEAD if we find
that the HEAD commit is not an ancestor of any other branches.
There is no such safety valve implemented right now.

On the other hand, the reason the user did not start the ad-hoc
work on a new branch with "git checkout -b" was probably because
the work was of a throw-away nature, so the convenience of not
having that safety valve might be even better.  The user, after
accumulating some commits on top of a detached HEAD, can always
create a new branch with "git checkout -b" not to lose useful
work done while the HEAD was detached.

We'll see.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 03:02:11 -08:00
Lars Hjemli 0016a48251 git-branch: show detached HEAD
This makes git-branch show a detached HEAD as '* (no branch)'.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 03:02:11 -08:00
Junio C Hamano bda324cf61 git-status: show detached HEAD
This makes git-status to state when you are not on any branch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 03:02:10 -08:00
Martin Langhoff 4083c2fce8 cvsimport: cleanup temporary cvsps file
It is bad manners to leave these sizable files
around when we are done with them.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 03:01:35 -08:00
Martin Langhoff eec8496210 cvsimport: document -S and -L options
Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 03:01:32 -08:00
Martin Langhoff ded9f40059 cvsimport: skip commits that are too recent (option and documentation)
This makes the earlier "wait for 10 minutes before importing" safety
overridable with "-a(ll)" flag, and adds necessary documentation.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 03:01:16 -08:00
Junio C Hamano 4b441f47ce git-fetch: allow updating the current branch in a bare repository.
Sometimes, people have only fetch access into a bare repository
that is used as a back-up location (or a distribution point) but
does not have a push access for networking reasons, e.g. one end
being behind a firewall, and updating the "current branch" in
such a case is perfectly fine.

This allows such a fetch without --update-head-ok, which is a
flag that should never be used by end users otherwise.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 21:36:35 -08:00
Junio C Hamano 7d1864ce67 Introduce is_bare_repository() and core.bare configuration variable
This removes the old is_bare_git_dir(const char *) to ask if a
directory, if it is a GIT_DIR, is a bare repository, and
replaces it with is_bare_repository(void *).  The function looks
at core.bare configuration variable if exists but uses the old
heuristics: if it is ".git" or ends with "/.git", then it does
not look like a bare repository, otherwise it does.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 21:36:35 -08:00
Junio C Hamano 510c5a8ee3 Move initialization of log_all_ref_updates
The patches to prevent Porcelainish that require working tree
from doing any damage in a bare repository make a lot of sense,
and I want to make the is_bare_git_dir() function more reliable.

In order to allow the repository owner override the heuristic
implemented in is_bare_git_dir() if/when it misidentifies a
particular repository, it would make sense to introduce a new
configuration variable "[core] bare = true/false", and make
is_bare_git_dir() notice it.

The scripts would do a 'repo-config --bool --get core.bare' and
iff the command fails (i.e. there is no such variable in the
configuration file), it would use the heuristic implemented at
the script level [*1*].

However, setup_git_env() which is called a lot earlier than we
even read from the repository configuration currently makes a
call to is_bare_git_dir(), in order to change the default
setting for log_all_ref_updates.  It somehow feels that this is
a hack.

By the way, [*1*] is another thing I hate about the current
config mechanism.  "git-repo-config --get" does not know what
the possible configuration variables are, let alone what the
default values for them are.  It allows us not to maintain a
centralized configuration table, which makes it easy to
introduce ad-hoc variables and gives a warm fuzzy feeling of
being modular, but my feeling is that it is turning out to be a
rather high price to pay for scripts.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 21:36:35 -08:00
Eric Wong 9a5e4075a4 git-svn: pass an unambiguous ref to rev-list when grafting-branches
Some users apparently create local heads with the same basename
as the remote branch they're tracking.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 21:32:49 -08:00
Eric Wong ae41098714 git-svn: add --prefix= option to multi-init
Also, document --{trunk,branches,tags} options while we're
documenting multi-init options.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 21:32:49 -08:00
J. Bruce Fields 59b5f52047 Documentation: clarify definition of "reachable"
Clarify definition of "reachable" (what chain?)

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 21:32:49 -08:00
Sasha Khapyorsky 692167774a git-svnimport: fix edge revisions double importing
This fixes newly introduced bug when the incremental cycle edge revisions
are imported twice.

Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 18:20:19 -08:00
Martin Langhoff 6211988f77 cvsimport: skip commits that are too recent
With this patch, cvsimport will skip commits made
in the last 10 minutes. The recent-ness test is of
5 minutes + cvsps fuzz window (5 minutes default).

When working with a CVS repository that is in use,
importing commits that are too recent can lead to
partially incorrect trees. This is mainly due to

 - Commits that are within the cvsps fuzz window may later
   be found to have affected more files.

 - When performing incremental imports, clock drift between
   the systems may lead to skipped commits.

This commit helps keep incremental imports of in-use
CVS repositories sane.

Signed-off-by: Martin Langhoff <martin@catalyst.net.nz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 18:06:49 -08:00
Jakub Narebski 3faa541fa9 gitweb: Remove superfluous "|" in "commit" view
Remove superfluous trailing "|" separator from difftree part of "commit"
view for new files (created in given commit).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 18:06:45 -08:00
Jürgen Rühle 3368d11f30 Remove unnecessary git-rm --cached reference from status output
Since git-reset has learned restoring the absence of paths git-rm --cached is
no longer necessary. Therefore remove it from the cached content header hint.

Also remove the unfortunate wording 'Cached' from the header itself.

Signed-off-by: Jürgen Rühle <j-r@online.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 18:04:57 -08:00
Nicolas Pitre 515377ea9e "init-db" can really be just "init"
Make "init" the equivalent of "init-db". This should make first GIT
impression a little more friendly.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 18:03:07 -08:00
Junio C Hamano cf2999eb4c Merge branch 'sp/mmap'
* sp/mmap: (27 commits)
  Spell default packedgitlimit slightly differently
  Increase packedGit{Limit,WindowSize} on 64 bit systems.
  Update packedGit config option documentation.
  mmap: set FD_CLOEXEC for file descriptors we keep open for mmap()
  pack-objects: fix use of use_pack().
  Fix random segfaults in pack-objects.
  Cleanup read_cache_from error handling.
  Replace mmap with xmmap, better handling MAP_FAILED.
  Release pack windows before reporting out of memory.
  Default core.packdGitWindowSize to 1 MiB if NO_MMAP.
  Test suite for sliding window mmap implementation.
  Create pack_report() as a debugging aid.
  Support unmapping windows on 'temporary' packfiles.
  Improve error message when packfile mmap fails.
  Ensure core.packedGitWindowSize cannot be less than 2 pages.
  Load core configuration in git-verify-pack.
  Fully activate the sliding window pack access.
  Unmap individual windows rather than entire files.
  Document why header parsing won't exceed a window.
  Loop over pack_windows when inflating/accessing data.
  ...

Conflicts:

	cache.h
	pack-check.c
2007-01-07 00:12:47 -08:00
Junio C Hamano ecaebf4af1 Spell default packedgitlimit slightly differently
This is shorter and easier to read, and also makes sure the
constant expression does not overflow integer range.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 00:11:11 -08:00
Junio C Hamano e7bb17a475 Merge branch 'jr/status'
* jr/status:
  Improve cached content header of status output
  Support --amend on initial commit in status output
  Improve "nothing to commit" part of status output
  Clarify syntax and role of git-add in status output
2007-01-06 23:49:24 -08:00
Junio C Hamano 8f905eb139 Merge branch 'jc/remote'
* jc/remote:
  git-remote
2007-01-06 23:49:16 -08:00
Junio C Hamano bc8c0294c6 git-reset <tree> -- <path> restores absense of <path> in <tree>
When <path> exists in the index (either merged or unmerged), and
<tree> does not have it, git-reset should be usable to restore
the absense of it from the tree.  This implements it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:57:42 -08:00
Junio C Hamano e9c8409900 diff-index --cached --raw: show tree entry on the LHS for unmerged entries.
This updates the way diffcore represents an unmerged pair
somewhat.  It used to be that entries with mode=0 on both sides
were used to represent an unmerged pair, but now it has an
explicit flag.  This is to allow diff-index --cached to report
the entry from the tree when the path is unmerged in the index.

This is used in updating "git reset <tree> -- <path>" to restore
absense of the path in the index from the tree.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:57:42 -08:00
Junio C Hamano cd1f9c36be reflog --fix-stale: do not check the same trees and commits repeatedly.
Since we use the reachability tracking machinery now, we should
keep the already checked trees and commits whose completeness is
known, to avoid checking the same thing over and over again.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:57:34 -08:00
Junio C Hamano 1389d9ddaa reflog expire --fix-stale
The logic in an earlier round to detect reflog entries that
point at a broken commit was not sufficient.  Just like we do
not trust presense of a commit during pack transfer (we trust
only our refs), we should not trust a commit's presense, even if
the tree of that commit is complete.

A repository that had reflog enabled on some of the refs that
was rewound and then run git-repack or git-prune from older
versions of git can have reflog entries that point at a commit
that still exist but lack commits (or trees and blobs needed for
that commit) between it and some commit that is reachable from
one of the refs.

This revamps the logic -- the definition of "broken commit"
becomes: a commit that is not reachable from any of the refs and
there is a missing object among the commit, tree, or blob
objects reachable from it that is not reachable from any of the
refs.  Entries in the reflog that refer to such a commit are
expired.

Since this computation involves traversing all the reachable
objects, i.e. it has the same cost as 'git prune', it is enabled
only when a new option --fix-stale.  Fortunately, once this is
run, we should not have to ever worry about missing objects,
because the current prune and pack-objects know about reflogs
and protect objects referred by them.

Unfortunately, this will be absolutely necessary to help people
migrate to the newer prune and repack.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:57:34 -08:00
Junio C Hamano 94421474e0 Move traversal of reachable objects into a separate library.
This moves major part of builtin-prune into a separate file,
reachable.c.  It is used to mark the objects that are reachable
from refs, and optionally from reflogs.

The patch looks very large, but if you look at it with diff -C,
which this message is formatted in, most of them are copied
lines and there are very little additions.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:57:34 -08:00
Junio C Hamano ca4f293fb4 builtin-prune: separate ref walking from reflog walking.
This is necessary for the next step, because the reason I am
making the connectivity walker into a library is because I want
to use it for cleaning up stale reflog entries.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:57:34 -08:00
Junio C Hamano 2430481614 builtin-prune: make file-scope static struct to an argument.
I want to make the first part of 'git prune' that marks the
reachable objects callable as a library, so this starts the
first step toward the goal by making the callchain to pass
rev_info structure as an argument.

No functionality change should be in this step.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:57:34 -08:00
Jakub Narebski 13e86efbea gitweb: Fix split patches output (e.g. file to symlink)
Do not replace /dev/null in two-line from-file/to-file diff header for
split patches ("split" patch mean more than one patch per one
diff-tree raw line) by a/file or b/file link.

Split patches differ from pair of deletion/creation patch in git diff
header: both a/file and b/file are hyperlinks, in all patches in a
split.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:53:08 -08:00
Jakub Narebski ac8b0cd1cd Revert "gitweb: There can be empty patches (in git_patchset_body)"
This reverts commit 1ebb948f65,
as that patch quieted warning but was not proper solution.
The previous commit was.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:52:55 -08:00
Jakub Narebski 66399eff86 gitweb: Fix errors in git_patchset_body for empty patches
We now do not skip over empty patches in git_patchset_body (where
empty means that they consist only of git diff header, and of extended
diff header, for example "pure rename" patch).  This means that after
extended diff header there can be next patch (i.e. /^diff /) or end of
patchset, and not necessary patch body (i.e. /^--- /).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:52:54 -08:00
Jakub Narebski 2e1951f6ed gitweb: Fix error in "rename to"/"copy to" git diff header output
Fix error in git_patchset_body subroutine, which caused "rename to"/"copy
to" line in extended diff header to be displayed incorrectly.

While at it, fix align.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:52:52 -08:00
Jakub Narebski 62e4f26f3d gitweb: Fix error in git_patchest_body for file creation/deletion patch
$from_id, $to_id variables should be local per PATCH.

Fix error in git_patchset_body for file creation (deletion) patches,
where instead of /dev/null as from-file (to-file) diff header line, it
had link to previous file with current file name.  This error occured
only if there was another patch before file creation (deletion) patch.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:52:49 -08:00
Eric Wong fffe694d60 git-svn: fix show-ignore
Looks like I broke it in 747fa12cef
but never noticed.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:48:48 -08:00
J. Bruce Fields 84dee6bbc9 Documentation: tutorial editing
Edit for conciseness.

Add a "Making changes" section header.

When possible, make sure that stuff in text boxes could be entered literally.
(Don't use "..." unless we want a user to type that.)

Move 'commit -a' example into a literal code section, clarify that it finds
modified files automatically.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:48:41 -08:00
Eric Wong 2eff14259e Documentation/git-svn: clarify dcommit, rebase vs pull/merge
Clarify that dcommit creates a revision in SVN for every commit
in git.  Also, add 'merge' to the rebase vs pull section because
git-merge is now a first-class UI.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:48:21 -08:00
Sasha Khapyorsky 09c3a408da git-svnimport: clean svn path when accessing SVN repo
Clean svn path from leading '/' when accessing SVN repo.

Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:48:09 -08:00
Sasha Khapyorsky 40006ea039 git-svnimport: support for incremental import
This adds ability to do import "in chunks" (default 1000 revisions),
after each chunk git repo will be repacked. The option -R is used to
change default value of chunk size (or how often repository will
repacked).

Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 22:47:58 -08:00
Alexandre Julliard 9fa77a51a4 git.el: Avoid setting font lock keywords before entering log-edit mode.
Instead, reinitialize the keywords after the fact. This avoids
conflicts with other users of log-edit mode, like pcl-cvs.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 10:45:13 -08:00
Fredrik Kuivinen f281e3a1c5 instaweb: Nicer error message when the http daemon isn't found
Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 10:44:59 -08:00
Alexandre Julliard cdc0873a78 git.el: Don't use --info-only when resolving a file.
It doesn't make a difference for git.el, but it helps when interacting
with git-rebase and friends.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 10:44:51 -08:00
Alexandre Julliard e6d7b2f62e git-clean: Fix the -q option.
The 'quiet' flag is set by -q, but it's not used anywhere.
Remove it and set the 'echo1' variable instead.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 10:44:40 -08:00
Steven Grimm f9e8a43a00 Print a more accurate error message when we fail to create a lock file.
Signed-off-by: Steven Grimm <koreth@midwinter.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 10:42:49 -08:00
Steven Grimm 1170e8026a Describe git-clone's actual behavior in the summary
If a branch other than "master" is checked out in the origin repository,
git-clone makes a local copy of that branch rather than the origin's
"master"
branch. This patch describes the actual behavior.

Signed-off-by: Steven Grimm <koreth@midwinter.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 10:40:54 -08:00
René Scharfe f08b3b0e2e Set default "tar" umask to 002 and owner.group to root.root
In order to make the generated tar files more friendly to users who
extract them as root using GNU tar and its implied -p option, change
the default umask to 002 and change the owner name and group name to
root.  This ensures that a) the extracted files and directories are
not world-writable and b) that they belong to user and group root.

Before they would have been assigned to a user and/or group named
git if it existed.  This also answers the question in the removed
comment: uid=0, gid=0, uname=root, gname=root is exactly what we
want.

Normal users who let tar apply their umask while extracting are
only affected if their umask allowed the world to change their
files (e.g. a umask of zero).  This case is so unlikely and strange
that we don't need to support it.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 10:37:14 -08:00
Shawn O. Pearce 22bac0ea52 Increase packedGit{Limit,WindowSize} on 64 bit systems.
If we have a 64 bit address space we can easily afford to commit
a larger amount of virtual address space to pack file access.
So on these platforms we should increase the default settings of
core.packedGit{Limit,WindowSize} to something that will better
handle very large projects.

Thanks to Andy Whitcroft for pointing out that we can safely
increase these defaults on such systems.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 10:34:56 -08:00
Junio C Hamano 21afc41c36 Fix timestamp for test-tick
The earlier test timestamp was too old; I forgot that the bare
unixtime integer had to be after Jan 1, 2000.  This changes
test_tick to use the git-epoch timestamp.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-06 02:17:06 -08:00
Junio C Hamano 16157b8074 builtin-prune: memory diet.
Somehow we forgot to turn save_commit_buffer off while walking
the reachable objects.  Releasing the memory for commit object
data that we do not use matters for large projects (for example,
about 90MB is saved while traversing linux-2.6 history).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-05 13:31:43 -08:00