Commit graph

21 commits

Author SHA1 Message Date
Junio C Hamano 01754769ab Don't force everybody to call setup_ident().
Back when only handful commands that created commit and tag were
the only users of committer identity information, it made sense
to explicitly call setup_ident() to pre-fill the default value
from the gecos information.  But it is much simpler for programs
to make the call automatic when get_ident() is called these days,
since many more programs want to use the information when updating
the reflog.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28 01:58:50 -08:00
Andy Whitcroft 93d26e4cb9 short i/o: fix calls to read to use xread or read_in_full
We have a number of badly checked read() calls.  Often we are
expecting read() to read exactly the size we requested or fail, this
fails to handle interrupts or short reads.  Add a read_in_full()
providing those semantics.  Otherwise we at a minimum need to check
for EINTR and EAGAIN, where this is appropriate use xread().

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08 15:44:47 -08:00
David Rientjes 96f1e58f52 remove unnecessary initializations
[jc: I needed to hand merge the changes to the updated codebase,
 so the result needs to be checked.]

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-15 21:22:20 -07:00
Rene Scharfe 5bb1cda5f7 drop length argument of has_extension
As Fredrik points out the current interface of has_extension() is
potentially confusing.  Its parameters include both a nul-terminated
string and a length-limited string.

This patch drops the length argument, requiring two nul-terminated
strings; all callsites are updated.  I checked that all of them indeed
provide nul-terminated strings.  Filenames need to be nul-terminated
anyway if they are to be passed to open() etc.  The performance penalty
of the additional strlen() is negligible compared to the system calls
which inevitably surround has_extension() calls.

Additionally, change has_extension() to use size_t inside instead of
int, as that is the exact type strlen() returns and memcmp() expects.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-11 16:06:34 -07:00
Rene Scharfe 83a2b841d6 Add has_extension()
The little helper has_extension() documents through its name what we are
trying to do and makes sure we don't forget the underrun check.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-10 14:13:53 -07:00
Ramsay Jones 19c4588178 commit walkers: setup_ident() to record correct committer in ref-log.
The function pull() in fetch.c calls write_ref_sha1(), which may
need committer identity to update the ref-log, so they need to
call setup_ident() before calling git_config() function.

Acked-by: Shawn Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-05 13:51:58 -07:00
Petr Baudis 8e87ca6615 Teach git-local-fetch the --stdin switch
This makes it possible to fetch many commits (refs) at once, greatly
speeding up cg-clone.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-27 19:33:48 -07:00
Petr Baudis 4211e4d10c Make pull() support fetching multiple targets at once
pull() now takes an array of arguments instead of just one of each kind.
Currently, no users use the new capability, but that'll change.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-27 19:33:48 -07:00
Petr Baudis c6b69bdbc1 Make pull() take some implicit data as explicit arguments
Currently it's a bit weird that pull() takes a single argument
describing the commit but takes the write_ref from a global variable.
This makes it take that as a parameter as well, which might be nicer
for the libification in the future, but especially it will make for
nicer code when we implement pull()ing multiple commits at once.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-27 19:33:48 -07:00
Petr Baudis cc41cd2e60 Remove -d from *-fetch usage strings
This is a really ancient remnant of the short era of delta objects stored
directly in the object database.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-27 14:21:03 -07:00
Shawn Pearce d0740d92be Log ref updates made by fetch.
If a ref is changed by http-fetch, local-fetch or ssh-fetch
record the change and the remote URL/name in the log for the ref.
This requires loading the config file to check logAllRefUpdates.

Also fixed a bug in the ref lock generation; the log file name was
not being produced right due to a bad prefix length.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-19 15:02:52 -07:00
Junio C Hamano 5a3277133d Make networking commands to work from a subdirectory.
These are whole-tree operations and there is not much point
making them operable from within a subdirectory, but it is easy
to do so, and using setup_git_directory() upfront helps git://
proxy specification picked up from the correct place.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-28 23:13:02 -08:00
Junio C Hamano 52e4478dbd Do not mmap-copy the whole thing; just use copy_fd()
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-29 13:11:36 -07:00
Junio C Hamano 0ffdbbfe36 Teach local-fetch about lazy object directories.
The latest init-db does not create .git/objects/??/ directories
anymore and expects the users of the repository to create them
as they are needed.  local-fetch was not taught about it, which
broke local cloning with Cogito.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-29 13:02:18 -07:00
Nick Hengeveld 11f0dafe2b [PATCH] Don't fetch objects that exist in the local repository
Be sure not to fetch objects that already exist in the local repository.
The main process loop no longer performs this check, http-fetch now checks
prior to starting a new request queue entry and when fetch_object() is called,
and local-fetch now checks when fetch_object() is called.

As discussed in this thread: http://marc.theaimsgroup.com/?t=112854890500001

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
2005-10-10 23:22:01 -07:00
Daniel Barkalow 820eca68c2 [PATCH] Implement --recover for git-*-fetch
With the --recover option, we verify that we have absolutely
everything reachable from the target, not assuming that things
reachable from refs will be complete.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-27 00:16:40 -07:00
Sergey Vlasov 628cd5430f [PATCH] git-local-fetch: Avoid confusing error messages on packed repositories
If the source repository was packed, and git-local-fetch needed to
fetch a pack file, it spewed a misleading error message about not
being able to find the unpacked object.  Fixed by adding the
warn_if_not_exists argument to copy_file(), which controls printing
of error messages in case the source file does not exist.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:30:46 -07:00
Sergey Vlasov e2b77f026a [PATCH] Fix "git-local-fetch -s" with packed source repository
"git-local-fetch -s" did not work with a packed repository, because
symlink() happily created a link to a non-existing object file,
therefore fetch_file() always returned success, and fetch_pack() was
not called.  Fixed by calling stat() before symlink() to ensure the
file really exists.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:30:45 -07:00
Sergey Vlasov 1a951815dd [PATCH] git-local-fetch: Avoid calling close(-1)
After open() failure, copy_file() called close(ifd) with ifd == -1
(harmless, but causes Valgrind noise).  The same thing was possible
for the destination file descriptor.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:30:45 -07:00
Sergey Vlasov 8be707de55 [PATCH] git-local-fetch: Fix error checking and leak in setup_indices()
setup_indices() did not check the return value of opendir(), and
did not have a corresponding closedir() call.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-23 14:30:45 -07:00
Junio C Hamano 215a7ad1ef Big tool rename.
As promised, this is the "big tool rename" patch.  The primary differences
since 0.99.6 are:

  (1) git-*-script are no more.  The commands installed do not
      have any such suffix so users do not have to remember if
      something is implemented as a shell script or not.

  (2) Many command names with 'cache' in them are renamed with
      'index' if that is what they mean.

There are backward compatibility symblic links so that you and
Porcelains can keep using the old names, but the backward
compatibility support  is expected to be removed in the near
future.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-07 17:45:20 -07:00
Renamed from local-pull.c (Browse further)