Commit Graph

7784 Commits

Author SHA1 Message Date
Junio C Hamano
c9a8992569 reflog gc: a tag that does not point at a commit is not a crime.
Although unusual, tags can point at any object.  Warning only
once is fine, but warning every time about the same tag gets
annoying.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 21:39:03 -08:00
Jeff King
222664e74d contrib/vim: update syntax for changed commit template
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 20:40:26 -08:00
Jeff King
90f70a910a format-patch: fix bug with --stdout in a subdirectory
We set the output directory to the git subdirectory prefix if one has
not already been specified. However, in the case of --stdout, we
explicitly _don't_ want the output directory to be set. The result was
that "git-format-patch --stdout" in a directory besides the project root
produced the "standard output, or directory, which one?" error message.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 19:46:19 -08:00
Junio C Hamano
83e24dce14 [PATCH] honor --author even with --amend, -C, and -c.
Earlier code discarded GIT_AUTHOR_DATE taken from the base
commit when --author was specified.  This was often wrong as
that use is likely to fix the spelling of author's name.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 19:40:57 -08:00
Junio C Hamano
5e207b4bf8 .mailmap: fix screw-ups in Uwe's name
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 16:25:15 -08:00
Eric Wong
cea70cf881 git-svn: remove leading slash when printing removed directories
Not sure why it was there in the first place, we always do our
work relative to the URL we're connected to; even if that URL is
the root of the repository, so the leading slash is pointless...
Lets be consistent when printing things for the user to see.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 13:15:50 -08:00
Peter Eriksen
8276c0070f sha1_file.c: Avoid multiple calls to find_pack_entry().
We used to call find_pack_entry() twice from read_sha1_file() in order
to avoid printing an error message, when the object did not exist.  This
is fixed by moving the call to error() to the only place it really
could be called.

Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 13:11:46 -08:00
Jakub Narebski
e136f33b5f Documentation/config.txt: Document config file syntax better
Separate part of Documentation/config.txt which deals with git config file
syntax into "Syntax" subsection, and expand it.  Add information about
subsections, boolean values, escaping and escape sequences in string
values, and continuing variable value on the next line.

Add also proxy settings to config file example to show example of
partially enclosed in double quotes string value.

Parts based on comments by Junio C Hamano, Johannes Schindelin,
config.c, and the smb.conf(5) man page.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 12:54:02 -08:00
Junio C Hamano
bf3f67ba71 cvsimport: activate -a option, really.
An earlier commit ded9f400 added $opt_a support to disable the
cvsps grace period mechanism, but forgot to tell the option
parser about it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 12:20:14 -08:00
Alex Riesen
67e4baf826 Cleanup uninitialized value in chomp
which happens if you use ActiveState Perl and a
pipe workaround specially for it.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 09:44:26 -08:00
Alex Riesen
bed118d6bb Force Activestate Perl to tie git command pipe handle to a handle class
Otherwise it tries to tie it to a scalar and complains about missing
method. Dunno why, may be ActiveState brokenness again.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 09:44:26 -08:00
Alex Riesen
d3b1785f3f Insert ACTIVESTATE_STRING in Git.pm
Also add "git" to the pipe parameters, otherwise it does not work at all, as
no git commands are usable out of git context.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-22 09:44:25 -08:00
Linus Torvalds
18af29f247 fsck-objects: refactor checking for connectivity
This separates the connectivity check into separate codepaths,
one for reachable objects and the other for unreachable ones,
while adding a lot of comments to explain what is going on.

When checking an unreachable object, unlike a reachable one, we
do not have to complain if it does not exist (we used to
complain about a missing blob even when the only thing that
references it is a tree that is dangling).  Also we do not have
to check and complain about objects that are referenced by an
unreachable object.

This makes the messages from fsck-objects a lot less noisy and
more useful.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-21 23:35:47 -08:00
Junio C Hamano
e3ff4b2447 git-gc: do not run git-prune by default.
git-prune is not safe when run uncontrolled in parallel while
other git operations are creating new objects.  To avoid
mistakes, do not run git-prune by default from git-gc.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-21 23:28:28 -08:00
Junio C Hamano
a0022eebf3 shallow repository: disable unsupported operations for now.
We currently do not support fetching/cloning from a shallow repository
nor pushing into one.  Make sure these are not attempted so that we
do not have to worry about corrupting repositories needlessly.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-21 22:23:58 -08:00
Junio C Hamano
f43117a6c1 is_repository_shallow(): prototype fix.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-21 22:22:23 -08:00
Junio C Hamano
ec587fde0a Make sure git_connect() always give two file descriptors.
Earlier, git_connect() returned the same fd twice or two
separate fds, depending on the way the connection was made (when
we are talking to the other end over a single socket, we used
the same fd twice, and when our end is connected to a pipepair
we used two).

This forced callers who do close() and dup() to really care
which was which, and most of the existing callers got this
wrong, although without much visible ill effect.  Many were
closing the same fd twice when we are talking over a single
socket, and one was leaking a fd.

This fixes it to uniformly use two separate fds, so if somebody
wants to close only reader side can just do close() on it
without worrying about it accidentally also closing the writer
side or vice versa.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-21 21:51:01 -08:00
Junio C Hamano
026aa93818 Revert "prune: --grace=time"
This reverts commit 9b088c4e39.

Protecting 'mature' objects does not make it any safer.  We should
admit that git-prune is inherently unsafe when run in parallel with
other operations without involving unwarranted locking overhead,
and with the latest git, even rebase and reset would not immediately
create crufts anyway.
2007-01-21 21:29:57 -08:00
Junio C Hamano
1bb914603a Documentation/tutorial-2: Fix interesting typo in an example.
Marco Candrian noticed that one cat-file example refers to a
blob object that is never used in the example sequence.

The bug is interesting in that the output from the botched
sample command is consistent with the incorrect blob object
name ;-).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-21 21:24:49 -08:00
Junio C Hamano
eaf6459e4d GIT v1.5.0-rc2
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 23:44:55 -08:00
Matthias Lederhofer
9b088c4e39 prune: --grace=time
This option gives grace period to objects that are unreachable
from the refs from getting pruned.

The default value is 24 hours and may be changed using
gc.prunegrace.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 23:29:49 -08:00
Johannes Schindelin
a6c730644b --walk-reflogs: do not crash with cyclic reflog ancestry
Since you can reset --hard to any revision you already had, when
traversing the reflog ancestry, we may not free() the commit buffer.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 22:58:42 -08:00
Johannes Schindelin
40ab7c33cd --walk-reflogs: actually find the right commit by date.
Embarassing thinko.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
2007-01-20 21:32:31 -08:00
Junio C Hamano
4d12a47123 Fix --walk-reflog with --pretty=oneline
Now, "git log --abbrev-commit --pretty=o --walk-reflogs HEAD" is
reasonably pleasant to use.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 21:32:31 -08:00
Junio C Hamano
53645a3a62 reflog-walk: build fixes
Dependency on reflog-walk.h was missing in the Makefile, and
reflog-walk.c did not even include it.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 21:32:31 -08:00
Junio C Hamano
911cedc95c log --walk-reflog: documentation
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 21:32:31 -08:00
Johannes Schindelin
db055e65d2 --walk-reflogs: disallow uninteresting commits
Do not allow uninteresting commits with --walk-reflogs, since it is
not clear what should be shown in these cases:

	$ git log --walk-reflogs master..next
	$ git log --walk-reflogs ^master

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
2007-01-20 21:32:31 -08:00
Johannes Schindelin
8860fd42fc Teach the revision walker to walk by reflogs with --walk-reflogs
When called with "--walk-reflogs", as long as there are reflogs
available, the walker will take this information into account, rather
than the parent information in the commit object.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 21:32:31 -08:00
Junio C Hamano
bcf3161876 git-rebase: allow rebasing a detached HEAD.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 21:31:00 -08:00
Junio C Hamano
11a6ddb2c8 branch -f: no reason to forbid updating the current branch in a bare repo.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 19:19:12 -08:00
Junio C Hamano
453c1e8575 git-tag -d: allow deleting multiple tags at once.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 19:19:12 -08:00
Johannes Schindelin
68025633e3 Do not verify filenames in a bare repository
For example, it makes no sense to check the presence of a file
named "HEAD" when calling "git log HEAD" in a bare repository.

Noticed by Han-Wen Nienhuys.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
2007-01-20 19:10:26 -08:00
Junio C Hamano
06f6228a90 Stop ignoring Documentation/README
We do not copy this file from elsewhere anymore.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 19:10:26 -08:00
Johannes Schindelin
cd554bb173 apply --cached: fix crash in subdirectory
The static variable "prefix" was shadowed by an unused parameter
of the same name. In case of execution in a subdirectory, the
static variable was accessed, leading to a crash.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
2007-01-20 19:05:20 -08:00
Junio C Hamano
16bfefeebc show-branch --reflog: fix show_date() call
Not passing tz to show_date() is not a fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-20 19:02:03 -08:00
Johannes Schindelin
da8f070cee show_date(): fix relative dates
We pass a timestamp (i.e. number of seconds elapsed since Jan 1 1970,
00:00:00 GMT) to the function. So there is no need to "fix" the
timestamp according to the timezone.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
2007-01-20 18:57:47 -08:00
Junio C Hamano
b15af07928 show-branch --reflog: tighten input validation.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-19 22:51:49 -08:00
Junio C Hamano
76a44c5c0b show-branch --reflog: show the reflog message at the top.
This changes the output so the list at the top shows the reflog
message, along with their relative timestamps.

You can use --reflog=<n> to show <n> most recent log entries, or
use --reflog=<n>,<b> to show <n> entries going back from the
entry <b>.  <b> can be either a number (so --reflog=4,20 shows 4
records starting from @{20}) or a timestamp (e.g. --reflog='4,1 day').

Here is a sample output (with --list option):

  $ git show-branch --reflog=10 --list jc/show-reflog
    [jc/show-reflog@{0}] (3 minutes ago) commit (amend): show-branch --ref
    [jc/show-reflog@{1}] (5 minutes ago) reset HEAD^
    [jc/show-reflog@{2}] (14 minutes ago) commit: show-branch --reflog: sho
    [jc/show-reflog@{3}] (14 minutes ago) commit: show-branch --reflog: sho
    [jc/show-reflog@{4}] (18 minutes ago) commit (amend): Extend read_ref_a
    [jc/show-reflog@{5}] (18 minutes ago) commit (amend): Extend read_ref_a
    [jc/show-reflog@{6}] (18 minutes ago) commit (amend): Extend read_ref_a
    [jc/show-reflog@{7}] (18 minutes ago) am: read_ref_at(): allow retrievi
    [jc/show-reflog@{8}] (18 minutes ago) reset --hard HEAD~4
    [jc/show-reflog@{9}] (61 minutes ago) commit: show-branch --reflog: use

This shows what I did more cleanly:

  $ git show-branch --reflog=10 jc/show-reflog
  ! [jc/show-reflog@{0}] (3 minutes ago) commit (amend): show-branch --ref
   ! [jc/show-reflog@{1}] (5 minutes ago) reset HEAD^
    ! [jc/show-reflog@{2}] (14 minutes ago) commit: show-branch --reflog:
     ! [jc/show-reflog@{3}] (14 minutes ago) commit: show-branch --reflog:
      ! [jc/show-reflog@{4}] (18 minutes ago) commit (amend): Extend read_
       ! [jc/show-reflog@{5}] (18 minutes ago) commit (amend): Extend read
        ! [jc/show-reflog@{6}] (18 minutes ago) commit (amend): Extend rea
         ! [jc/show-reflog@{7}] (18 minutes ago) am: read_ref_at(): allow
          ! [jc/show-reflog@{8}] (18 minutes ago) reset --hard HEAD~4
           ! [jc/show-reflog@{9}] (61 minutes ago) commit: show-branch --r
  ----------
  +          [jc/show-reflog@{0}] show-branch --reflog: show the reflog
    +        [jc/show-reflog@{2}] show-branch --reflog: show the reflog
   +++       [jc/show-reflog@{1}] show-branch --reflog: show the reflog
  +++++      [jc/show-reflog@{4}] Extend read_ref_at() to be usable fro
       +     [jc/show-reflog@{5}] Extend read_ref_at() to be usable fro
        +    [jc/show-reflog@{6}] Extend read_ref_at() to be usable fro
         +   [jc/show-reflog@{7}] read_ref_at(): allow retrieving the r
           + [jc/show-reflog@{9}] show-branch --reflog: use updated rea
           + [jc/show-reflog@{9}^] read_ref_at(): allow reporting the c
           + [jc/show-reflog@{9}~2] show-branch --reflog: show the refl
           + [jc/show-reflog@{9}~3] read_ref_at(): allow retrieving the
  ++++++++++ [jc/show-reflog@{8}] dwim_ref(): Separate name-to-ref DWIM

At @{9}, I had a commit to complete 5 patch series, but I wanted
to consolidate two commits that enhances read_ref_at() into one
(they were @{9}^ and @{9}~3), and another two that touch show-branch
into one (@{9} and @{9}~2).

I first saved them with "format-patch -4", and then did a reset
at @{8}.  At @{7}, I applied one of them with "am", and then
used "git-apply" on the other one, and amended the commit at
@{6} (so @{6} and @{7} has the same parent).  I did not like the
log message, so I amended again at @{5}.

Then I cherry-picked @{9}~2 to create @{3} (the log message
shows that it needs to learn to set GIT_REFLOG_ACTION -- it uses
"git-commit" and the log entry is attributed for it).  Another
cherry-pick built @{2} out of @{9}, but what I wanted to do was
to squash these two into one, so I did a "reset HEAD^" at @{1}
and then made the final commit by amending what was at the top.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-19 17:57:53 -08:00
Junio C Hamano
16d7cc90dd Extend read_ref_at() to be usable from places other than sha1_name.
You can pass an extra argument to the function to receive the
reflog message information.  Also when the log does not go back
beyond the point the user asked, the cut-off time and count are
given back to the caller for emitting the error messages as
appropriately.

We could later add configuration for get_sha1_basic() to make it
an error instead of it being just a warning.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-19 17:57:53 -08:00
Junio C Hamano
e86eb6668e dwim_ref(): Separate name-to-ref DWIM code out.
I'll be using this in another function to figure out what to
pass to resolve_ref().

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-19 17:57:53 -08:00
Johannes Schindelin
6f71686e0b config_set_multivar(): disallow newlines in keys
This will no longer work:

$ git repo-config 'key.with
newline' some-value

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
2007-01-19 17:55:14 -08:00
Uwe Kleine-König
d23842fd53 rename --exec to --receive-pack for push and send-pack
For now it's just to get a more descriptive name.  Later we might update the
push protocol to run more than one program on the other end.  Moreover this
matches better the corresponding config option remote.<name>. receivepack.

--exec continues to work

Signed-off-by: Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-19 17:54:33 -08:00
Uwe Kleine-König
060aafc11f make --exec=... option to git-push configurable
Having to specify git push --exec=... is annoying if you cannot have
git-receivepack in your PATH on the remote side (or don't want to).

This introduces the config item remote.<name>.receivepack to override
the default value (which is "git-receive-pack").

Signed-off-by: Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-19 17:54:33 -08:00
Uwe Kleine-König
18bd8821ca Update documentation of fetch-pack, push and send-pack
add all supported options to Documentation/git-....txt and the usage strings.

Signed-off-by: Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-19 17:54:32 -08:00
Junio C Hamano
89bf207758 Documentation/git.txt: command re-classification
This adds two new classes (pure-helpers and "Interacting with
Others") to the command list in the main manual page.  The
latter class is primarily about foreign SCM interface and is
placed before low-level (plumbing) commands.

Also it promotes a handful commands to mainporcelain category
while demoting some others.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-19 17:53:39 -08:00
Junio C Hamano
be93fc088f Documentation: generated cmds-*.txt does not depend on git.txt
Pointed out by Santi.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-19 11:33:27 -08:00
Junio C Hamano
cb48cb585f refs.c::read_ref_at(): fix bogus munmap() call.
The code uses mmap() to read reflog data, but moves the pointer around
while reading, and uses that updated pointer in the call to munmap().

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-19 00:41:37 -08:00
Junio C Hamano
2266bf27b3 for_each_reflog_ent: do not leak FILE *
The callback function can signal an early return by returning non-zero,
but the function leaked the FILE * opened on the reflog when doing so.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-18 23:25:54 -08:00
Junio C Hamano
72fe6a5989 Documentation: Generate command lists.
This moves the source of the list of commands and categorization
to the end of Documentation/cmd-list.perl, so that re-categorization
and re-ordering would become easier to manage.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-18 16:18:29 -08:00
Junio C Hamano
c3f0baacad Documentation: sync git.txt command list and manual page title
Also reorders a handful entries to make each list sorted
alphabetically.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-18 15:53:37 -08:00