Commit graph

212 commits

Author SHA1 Message Date
Junio C Hamano b76c561a74 Merge branch 'jc/unseekable-bundle'
* jc/unseekable-bundle:
  bundle: add parse_bundle_header() helper function
  bundle: allowing to read from an unseekable fd

Conflicts:
	transport.c
2011-10-21 16:04:32 -07:00
Junio C Hamano afd6284a7f Merge branch 'ph/transport-with-gitfile'
* ph/transport-with-gitfile:
  Fix is_gitfile() for files too small or larger than PATH_MAX to be a gitfile
  Add test showing git-fetch groks gitfiles
  Teach transport about the gitfile mechanism
  Learn to handle gitfiles in enter_repo
  enter_repo: do not modify input
2011-10-21 16:04:32 -07:00
Junio C Hamano 2727b71f05 bundle: add parse_bundle_header() helper function
Move most of the code from read_bundle_header() to parse_bundle_header()
that takes a file descriptor that is already opened for reading, and make
the former responsible only for opening the file and noticing errors.

As a logical consequence of this, is_bundle() helper function can be
implemented as a non-complaining variant of read_bundle_header() that
does not return an open file descriptor, and can be used to tighten
the check used to decide the use of bundle transport in transport_get()
function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-13 15:50:21 -07:00
Johannes Schindelin 3ac6437016 Fix is_gitfile() for files too small or larger than PATH_MAX to be a gitfile
The logic to check whether a file is a gitfile used the heuristics that
a gitfile cannot be larger than PATH_MAX or smaller than 10 bytes (as
its contents is "gitdir: " followed by a path) and returned early.

But it returned with a wrong value. It should have said "this cannot
possibly be a gitfile" by returning 0, but it returned 1 instead.  Our
test cases do not cover this, as the bundle files produced are smaller
than PATH_MAX, except on Windows.

While at it, fix the faulty logic that the path stored in a gitfile cannot
be larger than PATH_MAX-sizeof("gitdir: ").

Problem identified by running the test suite in msysGit, offending commit
identified by Jörg Rosenkranz.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-11 13:46:20 -07:00
Junio C Hamano 9bd500048d Merge branch 'mh/check-ref-format-3'
* mh/check-ref-format-3: (23 commits)
  add_ref(): verify that the refname is formatted correctly
  resolve_ref(): expand documentation
  resolve_ref(): also treat a too-long SHA1 as invalid
  resolve_ref(): emit warnings for improperly-formatted references
  resolve_ref(): verify that the input refname has the right format
  remote: avoid passing NULL to read_ref()
  remote: use xstrdup() instead of strdup()
  resolve_ref(): do not follow incorrectly-formatted symbolic refs
  resolve_ref(): extract a function get_packed_ref()
  resolve_ref(): turn buffer into a proper string as soon as possible
  resolve_ref(): only follow a symlink that contains a valid, normalized refname
  resolve_ref(): use prefixcmp()
  resolve_ref(): explicitly fail if a symlink is not readable
  Change check_refname_format() to reject unnormalized refnames
  Inline function refname_format_print()
  Make collapse_slashes() allocate memory for its result
  Do not allow ".lock" at the end of any refname component
  Refactor check_refname_format()
  Change check_ref_format() to take a flags argument
  Change bad_ref_char() to return a boolean value
  ...
2011-10-10 15:56:18 -07:00
Michael Haggerty 8d9c50105f Change check_ref_format() to take a flags argument
Change check_ref_format() to take a flags argument that indicates what
is acceptable in the reference name (analogous to "git
check-ref-format"'s "--allow-onelevel" and "--refspec-pattern").  This
is more convenient for callers and also fixes a failure in the test
suite (and likely elsewhere in the code) by enabling "onelevel" and
"refspec-pattern" to be allowed independently of each other.

Also rename check_ref_format() to check_refname_format() to make it
obvious that it deals with refnames rather than references themselves.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05 13:45:29 -07:00
Junio C Hamano 9e3e789e70 Merge branch 'jc/maint-bundle-too-quiet'
* jc/maint-bundle-too-quiet:
  Teach progress eye-candy to fetch_refs_from_bundle()
2011-10-05 12:35:55 -07:00
Phil Hord 7ab8777e8d Teach transport about the gitfile mechanism
The transport_get() function assumes that a regular file is a
bundle rather than a local git directory. Look inside the file
for the telltale "gitlink: " header to see if it is actually a
gitfile.  If so, do not try to process it as a bundle, but
treat it as a local repository instead.

Signed-off-by: Phil Hord <hordp@cisco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-04 13:30:38 -07:00
Junio C Hamano be042aff24 Teach progress eye-candy to fetch_refs_from_bundle()
With the usual "git" transport, a large-ish transfer with "git fetch" and
"git pull" give progress eye-candy to avoid boring users.  However, not
when they are reading from a bundle. I.e.

    $ git pull ../git-bundle.bndl master

This teaches bundle.c:unbundle() to give "-v" option to index-pack and
tell it to give progress bar when transport decides it is necessary.

The operation in the other direction, "git bundle create", could also
learn to honor --quiet but that is a separate issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-19 11:07:21 -07:00
Junio C Hamano 29753cddc8 rename "match_refs()" to "match_push_refs()"
Yes, there is a warning that says the function is only used by push in big
red letters in front of this function, but it didn't say a more important
thing it should have said: what the function is for and what it does.

Rename it and document it to avoid future confusion.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-12 16:41:53 -07:00
Junio C Hamano 48f36dcd73 Sync with 1.7.6.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-06 11:42:12 -07:00
Junio C Hamano 5a277f3ff7 Revert "Merge branch 'cb/maint-quiet-push' into maint"
This reverts commit ffa69e61d3, reversing
changes made to 4a13c4d148.

Adding a new command line option to receive-pack and feed it from
send-pack is not an acceptable way to add features, as there is no
guarantee that your updated send-pack will be talking to updated
receive-pack. New features need to be added via the capability mechanism
negotiated over the protocol.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-09-06 11:10:41 -07:00
Junio C Hamano c63750abc3 Merge branch 'fg/submodule-ff-check-before-push'
* fg/submodule-ff-check-before-push:
  push: Don't push a repository with unpushed submodules
2011-09-02 13:07:58 -07:00
Fredrik Gustafsson d2b17b3220 push: Don't push a repository with unpushed submodules
When working with submodules it is easy to forget to push a
submodule to the server but pushing a super-project that
contains a commit for that submodule. The result is that the
superproject points at a submodule commit that is not available
on the server.

This adds the option --recurse-submodules=check to push. When
using this option git will check that all submodule commits that
are about to be pushed are present on a remote of the submodule.

To be able to use a combined diff, disabling a diff callback has
been removed from combined-diff.c.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Mentored-by: Jens Lehmann <Jens.Lehmann@web.de>
Mentored-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-20 23:03:52 -07:00
Clemens Buchacher 90a6c7d443 propagate --quiet to send-pack/receive-pack
Currently, git push --quiet produces some non-error output, e.g.:

 $ git push --quiet
 Unpacking objects: 100% (3/3), done.

Add the --quiet option to send-pack/receive-pack and pass it to
unpack-objects in the receive-pack codepath and to receive-pack in
the push codepath.

This fixes a bug reported for the fedora git package:

 https://bugzilla.redhat.com/show_bug.cgi?id=725593

Reported-by: Jesse Keating <jkeating@redhat.com>
Cc: Todd Zullinger <tmz@pobox.com>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-31 18:45:41 -07:00
Junio C Hamano fb674d7671 Merge branch 'maint'
* maint:
  git-submodule.sh: separate parens by a space to avoid confusing some shells
  Documentation/technical/api-diff.txt: correct name of diff_unmerge()
  read_gitfile_gently: use ssize_t to hold read result
  remove tests of always-false condition
  rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
2011-05-30 00:09:55 -07:00
Junio C Hamano 5b42477b59 Merge branch 'jm/maint-misc-fix' into maint
* jm/maint-misc-fix:
  read_gitfile_gently: use ssize_t to hold read result
  remove tests of always-false condition
  rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'
2011-05-30 00:09:41 -07:00
Jim Meyering 5dd564895e remove tests of always-false condition
* fsck.c (fsck_error_function): Don't test obj->sha1 == 0.
It can never be true, since that sha1 member is an array.
* transport.c (set_upstreams): Likewise for ref->new_sha1.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 11:24:24 -07:00
Jeff King 114a6a889f refactor refs_from_alternate_cb to allow passing extra data
The foreach_alt_odb function triggers a callback for each
alternate object db we have, with room for a single void
pointer as data. Currently, we always call refs_from_alternate_cb
as the callback function, and then pass another callback (to
receive each ref individually) as the void pointer.

This has two problems:

  1. C technically forbids stuffing a function pointer into
     a "void *". In practice, this probably doesn't matter
     on any architectures git runs on, but it never hurts to
     follow the letter of the law.

  2. There is no room for an extra data pointer. Indeed, the
     alternate_ref_fn that refs_from_alternate_cb calls
     takes a void* for data, but we always pass it NULL.

Instead, let's properly stuff our function pointer into a
data struct, which also leaves room for an extra
caller-supplied data pointer. And to keep things simple for
existing callers, let's make a for_each_alternate_ref
function that takes care of creating the extra struct.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-19 20:01:10 -07:00
Junio C Hamano 91b3c7ce8e Merge branch 'jc/maint-fetch-alt'
* jc/maint-fetch-alt:
  fetch-pack: objects in our alternates are available to us
  refs_from_alternate: helper to use refs from alternates

Conflicts:
	builtin/receive-pack.c
2011-03-22 21:37:53 -07:00
Stephen Boyd c2e86addb8 Fix sparse warnings
Fix warnings from 'make check'.

 - These files don't include 'builtin.h' causing sparse to complain that
   cmd_* isn't declared:

   builtin/clone.c:364, builtin/fetch-pack.c:797,
   builtin/fmt-merge-msg.c:34, builtin/hash-object.c:78,
   builtin/merge-index.c:69, builtin/merge-recursive.c:22
   builtin/merge-tree.c:341, builtin/mktag.c:156, builtin/notes.c:426
   builtin/notes.c:822, builtin/pack-redundant.c:596,
   builtin/pack-refs.c:10, builtin/patch-id.c:60, builtin/patch-id.c:149,
   builtin/remote.c:1512, builtin/remote-ext.c:240,
   builtin/remote-fd.c:53, builtin/reset.c:236, builtin/send-pack.c:384,
   builtin/unpack-file.c:25, builtin/var.c:75

 - These files have symbols which should be marked static since they're
   only file scope:

   submodule.c:12, diff.c:631, replace_object.c:92, submodule.c:13,
   submodule.c:14, trace.c:78, transport.c:195, transport-helper.c:79,
   unpack-trees.c:19, url.c:3, url.c:18, url.c:104, url.c:117, url.c:123,
   url.c:129, url.c:136, thread-utils.c:21, thread-utils.c:48

 - These files redeclare symbols to be different types:

   builtin/index-pack.c:210, parse-options.c:564, parse-options.c:571,
   usage.c:49, usage.c:58, usage.c:63, usage.c:72

 - These files use a literal integer 0 when they really should use a NULL
   pointer:

   daemon.c:663, fast-import.c:2942, imap-send.c:1072, notes-merge.c:362

While we're in the area, clean up some unused #includes in builtin files
(mostly exec_cmd.h).

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-22 10:16:54 -07:00
Junio C Hamano 36cfda1552 refs_from_alternate: helper to use refs from alternates
The receiving end of "git push" advertises the objects that the repository
itself does not use, but are at the tips of refs in other repositories
whose object databases are used as alternates for it. This helps it avoid
having to receive (and the pusher having to send) objects that are already
available to the receiving repository via the alternates mechanism.

Tweak the helper function that implements this feature, and move it to
transport.[ch] for future reuse by other programs.

The additional test demonstrates how this optimization is helping "git push",
and "git fetch" is ignorant about it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
2011-03-17 16:18:47 -07:00
Jeff King d7c411b71d push: pass --progress down to git-pack-objects
When pushing via builtin transports (like file://, git://), the
underlying transport helper (in this case, git-pack-objects) did not get
the --progress option, even if it was passed to git push.

Fix this, and update the tests to reflect this.

Note that according to the git-pack-objects documentation, we can safely
apply the usual --progress semantics for the transport commands like
clone and fetch (and for pushing over other smart transports).

Reported-by: Chase Brammer <cbrammer@gmail.com>
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-18 16:20:19 -07:00
Jeff King 638794cde0 make url-related functions reusable
The is_url function and url percent-decoding functions were
static, but are generally useful. Let's make them available
to other parts of the code.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-24 16:48:32 -07:00
Junio C Hamano 53997a30f8 Merge branch 'tc/transport-verbosity'
* tc/transport-verbosity:
  transport: update flags to be in running order
  fetch and pull: learn --progress
  push: learn --progress
  transport->progress: use flag authoritatively
  clone: support multiple levels of verbosity
  push: support multiple levels of verbosity
  fetch: refactor verbosity option handling into transport.[ch]
  Documentation/git-push: put --quiet before --verbose
  Documentation/git-pull: put verbosity options before merge/fetch ones
  Documentation/git-clone: mention progress in -v

Conflicts:
	transport.h
2010-03-15 00:58:42 -07:00
Junio C Hamano 66bce02ec4 Merge branch 'ld/push-porcelain'
* ld/push-porcelain:
  t5516: Use test_cmp when appropriate
  git-push: add tests for git push --porcelain
  git-push: make git push --porcelain print "Done"
  git-push: send "To <remoteurl>" messages to the standard output in --porcelain mode
  git-push: fix an advice message so it goes to stderr

Conflicts:
	transport.c
2010-03-15 00:58:24 -07:00
Junio C Hamano 92db3fb95c Merge branch 'il/loosen-remote-helper-names'
* il/loosen-remote-helper-names:
  Allow '+', '-' and '.' in remote helper names
2010-03-07 12:47:15 -08:00
Junio C Hamano bd282f58ad Merge branch 'ml/send-pack-transport-refactor'
* ml/send-pack-transport-refactor:
  refactor duplicated code in builtin-send-pack.c and transport.c
2010-03-02 12:44:09 -08:00
Larry D'Anna 77555854be git-push: make git push --porcelain print "Done"
The script calling git push --porcelain --dry-run can see clearly from the
output if an update was rejected.  However, it will probably need to distinguish
this condition from the push failing for other reasons, such as the remote not
being reachable.

This patch modifies git push --porcelain to print "Done" after the rest of its
output unless any errors have occurred.  For the purpose of the "Done" line,
knowing a ref will be rejected in a --dry-run does not count as an error.
Actual rejections in non --dry-run pushes do count as errors.

Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-28 10:39:30 -08:00
Larry D'Anna 60cfeb8e95 git-push: send "To <remoteurl>" messages to the standard output in --porcelain mode
git-push prints the line "To <remoteurl>" before above each of the ref status
lines.  In --porcelain mode, these "To <remoteurl>" lines go to the standard
error, but the ref status lines go to the standard output.  This makes it
difficult for the process reading standard output to know which ref status lines
correspond to which remote.  This patch sends the "To <remoteurl>" lines to the
the standard output instead.

Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-28 10:39:28 -08:00
Tay Ray Chuan d01b3c02e8 transport->progress: use flag authoritatively
Set transport->progress in transport.c::transport_set_verbosity() after
checking for the appropriate conditions (eg. --progress, isatty(2)),
and thereafter use it without having to check again.

The rules used are as follows (processing aborts when a rule is
satisfied):

  1. Report progress, if force_progress is 1 (ie. --progress).
  2. Don't report progress, if verbosity < 0 (ie. -q/--quiet).
  3. Report progress if isatty(2) is 1.

This changes progress reporting behaviour such that if both --progress
and --quiet are specified, progress is reported.

In two areas, the logic to determine whether to *not* show progress is
changed to simply use the negation of transport->progress. This changes
behaviour in some ways (see previous paragraph for details).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-24 08:35:44 -08:00
Tay Ray Chuan 8afd8dc065 push: support multiple levels of verbosity
Remove the flags TRANSPORT_PUSH_QUIET and TRANSPORT_PUSH_VERBOSE; use
transport->verbose instead to determine verbosity for pushing.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-24 08:35:44 -08:00
Tay Ray Chuan bde873c529 fetch: refactor verbosity option handling into transport.[ch]
transport_set_verbosity() is now provided to transport users.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-24 08:35:44 -08:00
Ilari Liusvaara 53a52ff33d Allow '+', '-' and '.' in remote helper names
According to relevant RFCs, in addition to alphanumerics, the following
characters are valid in URL scheme parts: '+', '-' and '.', but
currently only alphanumerics are allowed in remote helper names.

Allow those three characters in remote helper names (both 'foo://' and
'foo::' syntax).

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-23 13:19:10 -08:00
Michael Lukashov f1863d0d16 refactor duplicated code in builtin-send-pack.c and transport.c
The following functions are (almost) identical:

  verify_remote_names
  update_tracking_ref
  refs_pushed
  print_push_status

Move common versions of these functions to transport.c and rename
them, as suggested by Jeff King and Junio C Hamano.

These functions have been removed entirely from builtin-send-pack.c,
since they are only used internally by print_push_status():

  print_ref_status
  status_abbrev
  print_ok_ref_status
  print_one_push_status

Also, move #define SUMMARY_WIDTH to transport.h and rename it
TRANSPORT_SUMMARY_WIDTH as it is used in builtin-fetch.c and
transport.c

Signed-off-by: Michael Lukashov <michael.lukashov@gmail.com>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-17 15:07:15 -08:00
Tay Ray Chuan b0d66e156c transport: add got_remote_refs flag
transport_get_remote_refs() in tranport.c checks transport->remote_refs
to determine whether transport->get_refs_list() should be invoked.  The
logic is "if it is NULL, we haven't run ls-remote to find out yet".

However, transport->remote_refs could still be NULL while cloning from
an empty repository.  This causes get_refs_list() to be run unnecessarily.

Introduce a flag, transport->got_remote_refs, to more explicitly record
if we have run transport->get_refs_list() already.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-02-16 09:11:22 -08:00
Junio C Hamano cb21d8f032 transport_get(): drop unnecessary check for !remote
At the beginning of the function we make sure remote is not NULL, and
the remainder of the funciton already depends on it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-27 12:22:37 -08:00
Ilari Liusvaara 4da504608e Fix remote.<remote>.vcs
remote.<remote>.vcs causes remote->foreign_vcs to be set on entry to
transport_get(). Unfortunately, the code assumed that any such entry
is stale from previous round.

Fix this by making VCS set by URL to be volatile w.r.t. transport_get()
instead.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-27 12:05:04 -08:00
Junio C Hamano 533e8af50e Merge branch 'il/push-set-upstream'
* il/push-set-upstream:
  Add push --set-upstream

Conflicts:
	transport.c
2010-01-20 14:40:48 -08:00
Junio C Hamano 07301eaa76 Merge branch 'tr/http-push-ref-status'
* tr/http-push-ref-status:
  transport-helper.c::push_refs(): emit "no refs" error message
  transport-helper.c::push_refs(): ignore helper-reported status if ref is not to be pushed
  transport.c::transport_push(): make ref status affect return value
  refactor ref status logic for pushing
  t5541-http-push.sh: add test for unmatched, non-fast-forwarded refs
  t5541-http-push.sh: add tests for non-fast-forward pushes

Conflicts:
	transport-helper.c
2010-01-20 14:39:48 -08:00
Junio C Hamano 42aac96763 Merge branch 'tc/clone-v-progress'
* tc/clone-v-progress:
  clone: use --progress to force progress reporting
  clone: set transport->verbose when -v/--verbose is used
  git-clone.txt: reword description of progress behaviour
  check stderr with isatty() instead of stdout when deciding to show progress

Conflicts:
	transport.c
2010-01-17 15:58:58 -08:00
Junio C Hamano 561197238e Merge branch 'maint'
* maint:
  Fix uninitialized variable in get_refs_via_rsync().
  Document git-blame triple -C option
2010-01-16 17:30:18 -08:00
Ilari Liusvaara e9fcd1e212 Add push --set-upstream
Frequent complaint is lack of easy way to set up upstream (tracking)
references for git pull to work as part of push command. So add switch
--set-upstream (-u) to do just that.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-16 16:39:58 -08:00
Richard Weinberger b9cb07726a Fix uninitialized variable in get_refs_via_rsync().
This fixes a crash when cloning via rsync://.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-15 21:20:28 -08:00
Tay Ray Chuan 4232826771 transport.c::transport_push(): make ref status affect return value
Use push_had_errors() to check the refs for errors and modify the
return value.

Mark the non-fast-forward push tests to succeed.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-09 23:34:10 -08:00
Tay Ray Chuan 20e8b465a5 refactor ref status logic for pushing
Move the logic that detects up-to-date and non-fast-forward refs to a
new function in remote.[ch], set_ref_status_for_push().

Make transport_push() invoke set_ref_status_for_push() before invoking
the push_refs() implementation. (As a side-effect, the push_refs()
implementation in transport-helper.c now knows of non-fast-forward
pushes.)

Removed logic for detecting up-to-date refs from the push_refs()
implementation in transport-helper.c, as transport_push() has already
done so for it.

Make cmd_send_pack() invoke set_ref_status_for_push() before invoking
send_pack(), as transport_push() can't do it for send_pack() here.

Mark the test on the return status of non-fast-forward push to fail.
Git now exits with success, as transport.c::transport_push() does not
check for refs with status REF_STATUS_REJECT_NONFASTFORWARD nor does it
indicate rejected pushes with its return value.

Mark the test for ref status to succeed. As mentioned earlier, refs
might be marked as non-fast-forwards, triggering the push status
printing mechanism in transport.c.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-09 23:34:10 -08:00
Ilari Liusvaara 27a557a9ff Reset possible helper before reusing remote structure
If one had multiple URLs configured for remote with previous one
having forced helper but the subsequent one not, like:

url = foo::bar://baz
url = ssh://example/example.git

Then the subsequent URL is passed to foo helper, which isn't
correct. Fix it to be parsed normally by resetting foreign VCS
name before parsing the URL protocol.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-09 22:38:49 -08:00
Tay Ray Chuan 486a3d7164 check stderr with isatty() instead of stdout when deciding to show progress
Make transport code (viz. transport.c::fetch_refs_via_pack() and
transport-helper.c::standard_options()) that decides to show progress
check if stderr is a terminal, instead of stdout. After all, progress
reports (via the API in progress.[ch]) are sent to stderr.

Update the documentation for git-clone to say "standard error" as well.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-28 18:49:18 -08:00
Ilari Liusvaara 28ca0c9008 Remove special casing of http, https and ftp
HTTP, HTTPS and FTP are no longer special to transport code. Also
add support for FTPS (curl supports it so it is easy).

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-28 00:24:15 -08:00
Ilari Liusvaara b236752a87 Support remote archive from all smart transports
Previously, remote archive required internal (non remote-helper)
smart transport. Extend the remote archive to also support smart
transports implemented by remote helpers.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-28 00:24:15 -08:00
Junio C Hamano e74f43f9b7 Merge branch 'sr/vcs-helper'
* sr/vcs-helper:
  tests: handle NO_PYTHON setting
  builtin-push: don't access freed transport->url
  Add Python support library for remote helpers
  Basic build infrastructure for Python scripts
  Allow helpers to report in "list" command that the ref is unchanged
  Fix various memory leaks in transport-helper.c
  Allow helper to map private ref names into normal names
  Add support for "import" helper command
  Allow specifying the remote helper in the url
  Add a config option for remotes to specify a foreign vcs
  Allow fetch to modify refs
  Use a function to determine whether a remote is valid
  Allow programs to not depend on remotes having urls
  Fix memory leak in helper method for disconnect

Conflicts:
	Documentation/git-remote-helpers.txt
	Makefile
	builtin-ls-remote.c
	builtin-push.c
	transport-helper.c
2009-12-26 14:03:16 -08:00
Ilari Liusvaara 61b075bd3e Support taking over transports
Add support for taking over transports that turn out to be smart.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-09 12:40:42 -08:00
Ilari Liusvaara aa5af9749f Refactor git transport options parsing
Refactor the transport options parsing so that protocols that aren't
directly smart transports (file://, git://, ssh:// & co) can record
the smart transport options for the case if it turns that transport
can actually be smart.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-09 12:40:42 -08:00
Ilari Liusvaara 25d5cc488a Pass unknown protocols to external protocol handlers
Change URL handling to allow external protocol handlers to implement
new protocols without the '::' syntax if helper name does not conflict
with any built-in protocol.

foo:// now invokes git-remote-foo with foo:// as the URL.

Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-09 12:40:42 -08:00
Junio C Hamano a24a32ddb3 Merge branch 'master' into il/vcs-helper
* master: (334 commits)
  bash: update 'git commit' completion
  Git 1.6.5.5
  Fix diff -B/--dirstat miscounting of newly added contents
  reset: improve worktree safety valves
  Documentation: Avoid use of xmlto --stringparam
  archive: clarify description of path parameter
  rerere: don't segfault on failure to open rr-cache
  Prepare for 1.6.5.5
  gitweb: Describe (possible) gitweb.js minification in gitweb/README
  Documentation: xmlto 0.0.18 does not know --stringparam
  Fix crasher on encountering SHA1-like non-note in notes tree
  t9001: use older Getopt::Long boolean prefix '--no' rather than '--no-'
  t4201: use ISO8859-1 rather than ISO-8859-1
  Git 1.6.5.4
  Unconditionally set man.base.url.for.relative.links
  Documentation/Makefile: allow man.base.url.for.relative.link to be set from Make
  Git 1.6.6-rc1
  git-pull.sh: Fix call to git-merge for new command format
  Prepare for 1.6.5.4
  merge: do not add standard message when message is given with -m option
  ...

Conflicts:
	Documentation/git-remote-helpers.txt
	Makefile
	builtin-ls-remote.c
	builtin-push.c
	transport-helper.c

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-06 22:40:16 -08:00
Junio C Hamano 905bf7742c Merge branch 'sp/smart-http'
* sp/smart-http: (37 commits)
  http-backend: Let gcc check the format of more printf-type functions.
  http-backend: Fix access beyond end of string.
  http-backend: Fix bad treatment of uintmax_t in Content-Length
  t5551-http-fetch: Work around broken Accept header in libcurl
  t5551-http-fetch: Work around some libcurl versions
  http-backend: Protect GIT_PROJECT_ROOT from /../ requests
  Git-aware CGI to provide dumb HTTP transport
  http-backend: Test configuration options
  http-backend: Use http.getanyfile to disable dumb HTTP serving
  test smart http fetch and push
  http tests: use /dumb/ URL prefix
  set httpd port before sourcing lib-httpd
  t5540-http-push: remove redundant fetches
  Smart HTTP fetch: gzip requests
  Smart fetch over HTTP: client side
  Smart push over HTTP: client side
  Discover refs via smart HTTP server when available
  http-backend: more explict LocationMatch
  http-backend: add example for gitweb on same URL
  http-backend: use mod_alias instead of mod_rewrite
  ...

Conflicts:
	.gitignore
	remote-curl.c
2009-11-20 23:51:23 -08:00
Johannes Schindelin 87422439d1 Allow specifying the remote helper in the url
The common case for remote helpers will be to import some repository
which can be specified by a single URL.  Support this use case by
allowing users to say:

	git clone hg::https://soc.googlecode.com/hg/ soc

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-17 21:45:44 -08:00
Daniel Barkalow c578f51d52 Add a config option for remotes to specify a foreign vcs
If this is set, the url is not required, and the transport always uses
a helper named "git-remote-<value>".

It is a separate configuration option in order to allow a sensible
configuration for foreign systems which either have no meaningful urls
for repositories or which require urls that do not specify the system
used by the repository at that location. However, this only affects
how the name of the helper is determined, not anything about the
interaction with the helper, and the contruction is such that, if the
foreign scm does happen to use a co-named url method, a url with that
method may be used directly.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-17 21:45:44 -08:00
Daniel Barkalow 3714831189 Allow fetch to modify refs
This allows the transport to use the null sha1 for a ref reported to
be present in the remote repository to indicate that a ref exists but
its actual value is presently unknown and will be set if the objects
are fetched.

Also adds documentation to the API to specify exactly what the methods
should do and how they should interpret arguments.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-17 21:45:44 -08:00
Daniel Barkalow fb0cc87ec0 Allow programs to not depend on remotes having urls
For fetch and ls-remote, which use the first url of a remote, have
transport_get() determine this by passing a remote and passing NULL
for the url. For push, which uses every url of a remote, use each url
in turn if there are any, and use NULL if there are none.

This will allow the transport code to do something different if the
location is not specified with a url.

Also, have the message for a fetch say "foreign" if there is no url.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-17 21:45:44 -08:00
Junio C Hamano 4d8c325888 Merge branch 'fc/doc-fast-forward'
* fc/doc-fast-forward:
  Use 'fast-forward' all over the place

Conflicts:
	builtin-merge.c
2009-11-15 16:41:02 -08:00
Shawn O. Pearce de1a2fdd38 Smart push over HTTP: client side
The git-remote-curl backend detects if the remote server supports
the git-receive-pack service, and if so, runs git-send-pack in a
pipe to dump the command and pack data as a single POST request.

The advertisements from the server that were obtained during the
discovery are passed into git-send-pack before the POST request
starts.  This permits git-send-pack to operate largely unmodified.

For smaller packs (those under 1 MiB) a HTTP/1.0 POST with a
Content-Length is used, permitting interaction with any server.
The 1 MiB limit is arbitrary, but is sufficent to fit most deltas
created by human authors against text sources with the occasional
small binary file (e.g. few KiB icon image).  The configuration
option http.postBuffer can be used to increase (or shink) this
buffer if the default is not sufficient.

For larger packs which cannot be spooled entirely into the helper's
memory space (due to http.postBuffer being too small), the POST
request requires HTTP/1.1 and sets "Transfer-Encoding: chunked".
This permits the client to upload an unknown amount of data in one
HTTP transaction without needing to pregenerate the entire pack
file locally.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-04 17:58:15 -08:00
Daniel Barkalow c1d45cf7b0 Require a struct remote in transport_get()
cmd_ls_remote() was calling transport_get() with a NULL remote and a
non-NULL url in the case where it was run outside a git
repository. This involved a bunch of ill-tested special
cases. Instead, simply get the struct remote for the URL with
remote_get(), which works fine outside a git repository, and can also
take global options into account.

This fixes a tiny and obscure bug where "git ls-remote" without a repo
didn't support global url.*.insteadOf, even though "git clone" and
"git ls-remote" in any repo did.

Also, enforce that all callers provide a struct remote to transport_get().

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-03 21:39:28 -08:00
Shawn O. Pearce ae4efe1957 Move WebDAV HTTP push under remote-curl
The remote helper interface now supports the push capability,
which can be used to ask the implementation to push one or more
specs to the remote repository.  For remote-curl we implement this
by calling the existing WebDAV based git-http-push executable.

Internally the helper interface uses the push_refs transport hook
so that the complexity of the refspec parsing and matching can be
reused between remote implementations.  When possible however the
helper protocol uses source ref name rather than the source SHA-1,
thereby allowing the helper to access this name if it is useful.

>From Clemens Buchacher <drizzd@aon.at>:
 update http tests according to remote-curl capabilities

 o Pushing packed refs is now fixed.

 o The transport helper fails if refs are already up-to-date. Add
   a test for that.

 o The transport helper will notice if refs are already
   up-to-date. We therefore need to update server info in the
   unpacked-refs test.

 o The transport helper will purge deleted branches automatically.

 o Use a variable ($ORIG_HEAD) instead of full SHA-1 name.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
CC: Daniel Barkalow <barkalow@iabervon.org>
CC: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-30 19:20:54 -07:00
Felipe Contreras a75d7b5409 Use 'fast-forward' all over the place
It's a compound word.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-10-24 23:50:28 -07:00
Junio C Hamano 6e4ece61ff Merge branch 'maint'
* maint:
  push: Correctly initialize nonfastforward in transport_push.
2009-09-20 12:13:47 -07:00
Matthieu Moy bb8cccd017 push: Correctly initialize nonfastforward in transport_push.
The variable is assigned unconditionally in print_push_status, but
print_push_status is not reached by all codepaths. In particular, this
fixes a bug where "git push ... nonexisting-branch" was complaining about
non-fast forward.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-20 12:11:29 -07:00
Junio C Hamano cd03eebbfd Merge branch 'db/vcs-helper'
* db/vcs-helper:
  Makefile: remove remnant of separate http/https/ftp helpers
  Use a clearer style to issue commands to remote helpers
  Make the "traditionally-supported" URLs a special case
  Makefile: install hardlinks for git-remote-<scheme> supported by libcurl if possible
  Makefile: do not link three copies of git-remote-* programs
  Makefile: git-http-fetch does not need expat
  http-fetch: Fix Makefile dependancies
  Add transport native helper executables to .gitignore
  git-http-fetch: not a builtin
  Use an external program to implement fetching with curl
  Add support for external programs for handling native fetches
2009-09-13 01:31:55 -07:00
Daniel Barkalow c9e388bb48 Make the "traditionally-supported" URLs a special case
Instead of trying to make http://, https://, and ftp:// URLs
indicative of some sort of pattern of transport helper usage, make
them a special case which runs the "curl" helper, and leave the
mechanism by which arbitrary helpers will be chosen entirely to future
work.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-03 21:27:36 -07:00
Jeff King 2e5ed5f21b push: teach --quiet to suppress "Everything up-to-date"
This should have been part of 481c7a6, whose goal was to
make "git push -q" silent unless there is an error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-02 19:47:50 -07:00
Junio C Hamano 232d453766 Merge branch 'np/maint-1.6.3-deepen'
* np/maint-1.6.3-deepen:
  fix simple deepening of a repo

Conflicts:
	t/t5500-fetch-pack.sh
2009-08-28 19:38:56 -07:00
Nicolas Pitre 86386829d4 fix simple deepening of a repo
If all refs sent by the remote repo during a fetch are reachable
locally, then no further conversation is performed with the remote. This
check is skipped when the --depth argument is provided to allow the
deepening of a shallow clone which corresponding remote repo has no
changed.

However, some additional filtering was added in commit c29727d5 to
remove those refs which are equal on both sides.  If the remote repo has
not changed, then the list of refs to give the remote process becomes
empty and simply attempting to deepen a shallow repo always fails.

Let's stop being smart in that case and simply send the whole list over
when that condition is met.  The remote will do the right thing anyways.

Test cases for this issue are also provided.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-24 15:03:56 -07:00
Junio C Hamano 6ffd781226 Merge branch 'maint'
* maint:
  push: point to 'git pull' and 'git push --force' in case of non-fast forward
  Documentation: add: <filepattern>... is optional
  Change mentions of "git programs" to "git commands"
  Documentation: merge: one <remote> is required
  help.c: give correct structure's size to memset()
2009-08-12 16:36:04 -07:00
Matthieu Moy 07436e43da push: point to 'git pull' and 'git push --force' in case of non-fast forward
'git push' failing because of non-fast forward is a very common situation,
and a beginner does not necessarily understand "fast forward" immediately.

Add a new section to the git-push documentation and refer them to it.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-12 16:15:47 -07:00
Junio C Hamano 56b36b834d Merge branch 'jk/push-quiet'
* jk/push-quiet:
  transport: don't show push status if --quiet is given
  transport: pass "quiet" flag to pack-objects
  push: add --quiet flag
2009-08-10 22:18:21 -07:00
Junio C Hamano 08ac69685a Merge branch 'js/run-command-updates'
* js/run-command-updates:
  api-run-command.txt: describe error behavior of run_command functions
  run-command.c: squelch a "use before assignment" warning
  receive-pack: remove unnecessary run_status report
  run_command: report failure to execute the program, but optionally don't
  run_command: encode deadly signal number in the return value
  run_command: report system call errors instead of returning error codes
  run_command: return exit code as positive value
  MinGW: simplify waitpid() emulation macros
2009-08-10 22:14:57 -07:00
Jeff King 481c7a6db9 transport: don't show push status if --quiet is given
When --quiet is given, the user generally only wants to see
errors. So let's suppress printing the ref status table
unless there is an error, in which case we print out the
whole table.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-05 20:14:11 -07:00
Jeff King 120703292b transport: pass "quiet" flag to pack-objects
When pushing over the git protocol, pack-objects gives
progress reports about the pack being sent. If "push" is
given the --quiet flag, it now passes "-q" to pack-objects,
suppressing this output.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-05 20:14:09 -07:00
Daniel Barkalow a2d725b7bd Use an external program to implement fetching with curl
Use the transport native helper mechanism to fetch by http (and ftp, etc).

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-05 10:34:09 -07:00
Junio C Hamano 3125be17d6 Merge branch 'ld/push-porcelain-output-format'
* ld/push-porcelain-output-format:
  add --porcelain option to git-push
2009-07-09 01:07:54 -07:00
Junio C Hamano dd787c19c4 Merge branch 'tr/die_errno'
* tr/die_errno:
  Use die_errno() instead of die() when checking syscalls
  Convert existing die(..., strerror(errno)) to die_errno()
  die_errno(): double % in strerror() output just in case
  Introduce die_errno() that appends strerror(errno) to die()
2009-07-06 09:39:46 -07:00
Johannes Sixt c024beb56d run_command: report failure to execute the program, but optionally don't
In the case where a program was not found, it was still the task of the
caller to report an error to the user. Usually, this is an interesting case
but only few callers actually reported a specific error (though many call
sites report a generic error message regardless of the cause).

With this change the error is reported by run_command, but since there is
one call site in git.c that does not want that, an option is added to
struct child_process, which is used to turn the error off.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06 02:45:50 -07:00
Johannes Sixt 0ac77ec315 run_command: report system call errors instead of returning error codes
The motivation for this change is that system call failures are serious
errors that should be reported to the user, but only few callers took the
burden to decode the error codes that the functions returned into error
messages.

If at all, then only an unspecific error message was given. A prominent
example is this:

   $ git upload-pack . | :
   fatal: unable to run 'git-upload-pack'

In this example, git-upload-pack, the external command invoked through the
git wrapper, dies due to SIGPIPE, but the git wrapper does not bother to
report the real cause. In fact, this very error message is copied to the
syslog if git-daemon's client aborts the connection early.

With this change, system call failures are reported immediately after the
failure and only a generic failure code is returned to the caller. In the
above example the error is now to the point:

   $ git upload-pack . | :
   error: git-upload-pack died of signal

Note that there is no error report if the invoked program terminated with
a non-zero exit code, because it is reasonable to expect that the invoked
program has already reported an error. (But many run_command call sites
nevertheless write a generic error message.)

There was one special return code that was used to identify the case where
run_command failed because the requested program could not be exec'd. This
special case is now treated like a system call failure with errno set to
ENOENT. No error is reported in this case, because the call site in git.c
expects this as a normal result. Therefore, the callers that carefully
decoded the return value still check for this condition.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-07-06 02:44:49 -07:00
Larry D'Anna 1965ff744a add --porcelain option to git-push
If --porcelain is used git-push will produce machine-readable output.  The
output status line for each ref will be tab-separated and sent to stdout instead
of stderr.  The full symbolic names of the refs will be given.  For example

$ git push --dry-run --porcelain master :foobar 2>/dev/null \
  | perl -pe 's/\t/ TAB /g'

= TAB refs/heads/master:refs/heads/master TAB [up to date]
- TAB :refs/heads/foobar TAB [deleted]

Signed-off-by: Larry D'Anna <larry@elder-gods.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 22:26:58 -07:00
Thomas Rast 0721c314a5 Use die_errno() instead of die() when checking syscalls
Lots of die() calls did not actually report the kind of error, which
can leave the user confused as to the real problem.  Use die_errno()
where we check a system/library call that sets errno on failure, or
one of the following that wrap such calls:

  Function              Passes on error from
  --------              --------------------
  odb_pack_keep         open
  read_ancestry         fopen
  read_in_full          xread
  strbuf_read           xread
  strbuf_read_file      open or strbuf_read_file
  strbuf_readlink       readlink
  write_in_full         xwrite

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-27 11:14:53 -07:00
Junio C Hamano e2486193c5 Merge branch 'rc/http-push'
* rc/http-push: (22 commits)
  http*: add helper methods for fetching objects (loose)
  http*: add helper methods for fetching packs
  http: use new http API in fetch_index()
  http*: add http_get_info_packs
  http-push.c::fetch_symref(): use the new http API
  http-push.c::remote_exists(): use the new http API
  http.c::http_fetch_ref(): use the new http API
  transport.c::get_refs_via_curl(): use the new http API
  http.c: new functions for the http API
  http: create function end_url_with_slash
  http*: move common variables and macros to http.[ch]
  transport.c::get_refs_via_curl(): do not leak refs_url
  Don't expect verify_pack() callers to set pack_size
  http-push: do not SEGV after fetching a bad pack idx file
  http*: copy string returned by sha1_to_hex
  http-walker: verify remote packs
  http-push, http-walker: style fixes
  t5550-http-fetch: test fetching of packed objects
  http-push: fix missing "#ifdef USE_CURL_MULTI" around "is_running_queue"
  http-push: send out fetch requests on queue
  ...
2009-06-13 12:53:19 -07:00
Junio C Hamano 57c57a97e1 Merge branch 'cb/match_refs_internal_tail'
* cb/match_refs_internal_tail:
  match_refs: search ref list tail internally
2009-06-13 12:47:52 -07:00
Mike Hommey 28307b99dd transport.c::get_refs_via_curl(): use the new http API
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06 11:03:07 -07:00
Mike Hommey df005219dd transport.c::get_refs_via_curl(): do not leak refs_url
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06 10:56:27 -07:00
Clemens Buchacher 6d2bf96e55 match_refs: search ref list tail internally
Avoid code duplication by moving list tail search to match_refs().

This does not change the semantics, except for http-push, which now inserts
to the front of the ref list in order to get rid of the global remote_tail.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-01 19:41:24 -07:00
Junio C Hamano 44ee247f8d Merge branch 'fc/decorate-tag'
* fc/decorate-tag:
  Prettify log decorations even more
  Change prettify_ref to prettify_refname
2009-05-23 01:43:50 -07:00
Junio C Hamano 36587681b4 Merge branch 'ar/unlink-err'
* ar/unlink-err:
  print unlink(2) errno in copy_or_link_directory
  replace direct calls to unlink(2) with unlink_or_warn
  Introduce an unlink(2) wrapper which gives warning if unlink failed
2009-05-18 09:01:06 -07:00
Felipe Contreras 4577e48364 Change prettify_ref to prettify_refname
In preparation to be used when the ref object is not available

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-13 20:55:48 -07:00
Alex Riesen 691f1a28bf replace direct calls to unlink(2) with unlink_or_warn
This helps to notice when something's going wrong, especially on
systems which lock open files.

I used the following criteria when selecting the code for replacement:
- it was already printing a warning for the unlink failures
- it is in a function which already printing something or is
  called from such a function
- it is in a static function, returning void and the function is only
  called from a builtin main function (cmd_)
- it is in a function which handles emergency exit (signal handlers)
- it is in a function which is obvously cleaning up the lockfiles

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-29 18:37:41 -07:00
Andreas Ericsson 47abd85ba0 fetch: Strip usernames from url's before storing them
When pulling from a remote, the full URL including username
is by default added to the commit message. Since it adds
very little value but could be used by malicious people to
glean valid usernames (with matching hostnames), we're far
better off just stripping the username before storing the
remote URL locally.

Note that this patch has no lasting visible effect when
"git pull" does not create a merge commit. It simply
alters what gets written to .git/FETCH_HEAD, which is used
by "git merge" to automagically create its messages.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-21 00:05:21 -07:00
Junio C Hamano f23336f5c1 Merge branch 'db/push-cleanup'
* db/push-cleanup:
  Move push matching and reporting logic into transport.c
  Use a common function to get the pretty name of refs

Conflicts:
	transport.c
2009-03-26 00:28:46 -07:00
Johannes Schindelin 7efaeba2a8 rsync transport: allow local paths, and fix tests
Earlier, the rsync tests were disabled by default, as they needed a
running rsyncd daemon.  This was only due to the limitation that our
rsync transport only allowed full URLs of the form

	rsync://<host>/<path>

Relaxing the URLs to allow

	rsync:<path>

permitted the change in the tests to run whenever rsync is available,
without requiring a fully configured and running rsyncd.

While at it, the tests were fixed so that they run in directories with a
space in their name.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-10 23:17:56 -07:00
Daniel Barkalow 64fcef2daa Move push matching and reporting logic into transport.c
For native-protocol pushes (and other protocols as they are converted
to the new method), this moves the refspec match, tracking update, and
report message out of send-pack() and into transport_push(), where it
can be shared completely with other protocols. This also makes fetch
and push more similar in terms of what code is in what file.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-09 15:41:20 -07:00
Alexander Potashev 8ca12c0d62 add is_dot_or_dotdot inline function
A new inline function is_dot_or_dotdot is used to check if the
directory name is either "." or "..". It returns a non-zero value if
the given string is "." or "..". It's applicable to a lot of Git
source code.

Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-11 13:21:57 -08:00
Junio C Hamano 6af50f7536 Merge branch 'rs/alloc-ref'
* rs/alloc-ref:
  make alloc_ref_from_str() the new alloc_ref()
  use alloc_ref_from_str() everywhere
  add alloc_ref_with_prefix()
2008-10-21 17:58:01 -07:00