Commit graph

64 commits

Author SHA1 Message Date
Junio C Hamano f64d7fd267 git-fetch: exit with non-zero status when fast-forward check fails
When update_local_ref() refuses to update a branch head due to
fast-forward check, it was not propagated properly in the call
chain and the command did not exit with non-zero status as a
result.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-25 01:04:28 -08:00
Junio C Hamano 6c96c0f194 git-fetch: follow lightweit tags as well.
This side-ports commit fd19f620 from Cogito, in which I fixed
exactly the same bug.  Somehow nobody noticed this for a long
time in git.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-19 18:44:23 -08:00
Nicolas Pitre 576162a45f remove .keep pack lock files when done with refs update
This makes both git-fetch and git-push (fetch-pack and receive-pack)
safe against a possible race with aparallel git-repack -a -d that could
prune the new pack while it is not yet referenced, and remove the .keep
file after refs have been updated.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-03 00:24:07 -08:00
Nicolas Pitre 920ccbfc3b git-fetch can use both --thin and --keep with fetch-pack now
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-03 00:24:07 -08:00
Junio C Hamano e0d68cd5d9 Merge branch 'jc/refs-and-fetch'
* jc/refs-and-fetch:
  git-fetch: adjust to packed-refs.
2006-11-01 08:49:19 -08:00
Junio C Hamano 58a1e0e83b Merge branch 'lj/refs'
* lj/refs: (63 commits)
  Fix show-ref usagestring
  t3200: git-branch testsuite update
  sha1_name.c: avoid compilation warnings.
  Make git-branch a builtin
  ref-log: fix D/F conflict coming from deleted refs.
  git-revert with conflicts to behave as git-merge with conflicts
  core.logallrefupdates thinko-fix
  git-pack-refs --all
  core.logallrefupdates create new log file only for branch heads.
  Remove bashism from t3210-pack-refs.sh
  ref-log: allow ref@{count} syntax.
  pack-refs: call fflush before fsync.
  pack-refs: use lockfile as everybody else does.
  git-fetch: do not look into $GIT_DIR/refs to see if a tag exists.
  lock_ref_sha1_basic does not remove empty directories on BSD
  Do not create tag leading directories since git update-ref does it.
  Check that a tag exists using show-ref instead of looking for the ref file.
  Use git-update-ref to delete a tag instead of rm()ing the ref file.
  Fix refs.c;:repack_without_ref() clean-up path
  Clean up "git-branch.sh" and add remove recursive dir test cases.
  ...
2006-11-01 08:48:50 -08:00
Junio C Hamano 7756b1f1dc Merge branch 'maint'
* maint:
  xdiff: Match GNU diff behaviour when deciding hunk comment worthiness of lines
  Update cherry documentation.
  Refer to git-rev-parse:Specifying Revisions from git.txt
  git-fetch.sh printed protocol fix
  RPM package re-classification.
  Documentation: note about contrib/.
  git-svn: fix symlink-to-file changes when using command-line svn 1.4.0
  Set $HOME for selftests
2006-10-25 12:57:48 -07:00
Tuncer Ayaz ddaf73141c git-fetch.sh printed protocol fix
We have supported https:// protocol for some time and in 1.4.3
added ftp:// protocol.  The transfer were still reported to be
over http.

[jc: Tuncer used substring parameter substitution ${remote%%:*}
 but I am deferring it to a later day.  We should replace
 colon-expr with substring substitution after everybody's shell
 can grok it someday, but we are not in a hurry. ]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-25 11:26:48 -07:00
Junio C Hamano a4c6ae5a76 Merge branch 'sb/fetch'
* sb/fetch:
  merge and resolve: Output short hashes and .. in "Updating ..."
  fetch: Misc output cleanup
2006-10-18 22:08:29 -07:00
Junio C Hamano 9861718b30 git-fetch --update-head-ok typofix
Martin Waitz noticed that one of the case arms had an impossible
choice.  It turns out that what it was checking was redundant and
the typo did not have any effect.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-10 22:29:02 -07:00
Junio C Hamano 47292d65de git-fetch: do not look into $GIT_DIR/refs to see if a tag exists.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-03 02:08:19 -07:00
Junio C Hamano fbc72799a8 git-fetch: adjust to packed-refs.
The command checked the presence of a ref by directly looking
into $GIT_DIR/refs directory.  Update it to use show-ref.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-01 00:42:40 -07:00
Santi B,Ai(Bjar 20a3847d8a fetch: Misc output cleanup
In particular it removes duplicate information, uses short hashes (as
git-log and company) and uses .. for fast forwarding commits and ... for
not-fast-forwarding commits (shorter, easier to copy&paste). It also
reformat the output as:

1. the ones we store in our local ref (either branches or tags):

 1a) fast-forward

 * refs/heads/origin: fast forward to branch 'master' of ../git/
   old..new: 1ad7a06..bc1a580

 1b) same (only shown under -v)

 * refs/heads/next: same as branch 'origin/next' of ../git/
   commit: ce47b9f

 1c) non-fast-forward, forced

 * refs/heads/pu: forcing update to non-fast forward branch 'pu' of ../git/
   old...new: 7c733a8...5faa935

 1d) non-fast-forward, did not update because not forced

 * refs/heads/po: not updating to non-fast forward branch 'po' of ../git/
   old...new: 7c733a8...5faa935

 1e) creating a new local ref to store

 * refs/tags/v1.4.2-rc4: storing tag 'v1.4.2-rc4' of ../git/
   tag: 8c7a107
 * refs/heads/next: storing branch 'next' of ../git/
   commit: f8a20ae

2. the ones we do not store in our local ref (only shown under -v):

 * fetched branch 'master' of ../git
   commit: 695dffe
 * fetched tag 'v1.4.2-rc4' of ../git
   tag: 8c7a107

Signed-off-by: Santi B.ANijar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-30 22:02:36 -07:00
Santi Béjar 4839bd8a66 fetch: Reset remote refs list each time fetch_main is called
This prevents the fetch of the heads again in the second call of fetch_main.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-29 18:54:13 -07:00
Sasha Khapyorsky 3ea099d48b http/ftp: optionally ask curl to not use EPSV command
If http.noEPSV config variable is defined and true, or if
GIT_CURL_FTP_NO_EPSV environment variable is defined, disable using
of EPSV ftp command (PASV will be used instead). This is helpful with
some "poor" ftp servers which does not support EPSV mode.

Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-28 19:02:46 -07:00
Santi Béjar 648ad18f50 Fetch: default remote repository from branch properties
If in branch "foo" and this in config:

[branch "foo"]
       remote=bar

"git fetch" = "git fetch bar"
"git  pull" = "git pull  bar"

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-24 00:13:49 -07:00
Sasha Khapyorsky 38529e28a4 Trivial support for cloning and fetching via ftp://.
This adds trivial support for cloning and fetching via ftp://.

Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-13 23:39:43 -07:00
Junio C Hamano 09f5dc406a Merge branch 'jc/clone-bind-failure'
* jc/clone-bind-failure:
  fetch/clone: check return status from ls-remote
2006-07-25 13:19:54 -07:00
Santi Béjar 5e27e27e5d Defaulting fetch to origin when set in the repo-config
Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-24 00:32:24 -07:00
Junio C Hamano 482faa8daf git-fetch: fix --keep vs --thin
When --keep is specified there is no reason to pass --thin to git-fetch-pack,
which are mutually exclusive.  This does not hurt because fetch-pack disables
thin transfer when both are given internally, but still is confusing.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-17 13:01:27 -07:00
Sergey Vlasov 7eae7b993e Fix "git-fetch --tags" exit status when nothing has been changed
After commit 55b7835e1b git-fetch --tags
exits with status 1 when no tags have been changed, which breaks calling
git-fetch from scripts.

Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-14 11:33:14 -07:00
Junio C Hamano 57a39690b9 fetch/clone: check return status from ls-remote
Some callers of ls-remote did not check its return status.
2006-07-13 23:10:21 -07:00
Eric Wong ed0e078f96 git-fetch: fix a bashism (==)
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-11 14:14:09 -07:00
Shawn Pearce 55b7835e1b Log ref changes made by git-fetch and git-pull.
When git-fetch updates a reference record in the associated reflog
what type of update took place and who caused it (git-fetch or
git-pull, by invoking git-fetch).

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-10 21:21:27 -07:00
Michal Rokos d9bffc08fd Using 'perl' in *.sh
Some GIT's shell script are using bare 'perl' for perl invocation.
Use @@PERL@@ symbol and replace it with PERL_PATH_SQ everywhere.

Signed-off-by: Michal Rokos <michal.rokos@nextsoft.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-08 11:35:20 -07:00
Junio C Hamano ea5aeb07e9 fetch: do not report "same" unless -verbose.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-03 23:44:40 -07:00
Junio C Hamano 878ccb2694 git-fetch: avoid using "case ... in (arm)"
NetBSD ash chokes on the optional open parenthesis for case arms.  Inside
$(command substitution), however, bash barfs without.  So adjust things
accordingly.

Originally pointed out by Dennis Stosberg.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-28 19:24:28 -07:00
Nick Hengeveld 093b068891 git-fetch: resolve remote symrefs for HTTP transport
git-fetch validates that a remote ref resolves to a SHA1 prior to calling
git-http-fetch.  This adds support for resolving a few levels of symrefs
to get to the SHA1.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-26 17:16:11 -07:00
Junio C Hamano dfdcb558ec Fix-up previous expr changes.
The regexp on the right hand side of expr : operator somehow was
broken.

	expr 'z+pu:refs/tags/ko-pu' : 'z\+\(.*\)'

does not strip '+'; write 'z+\(.*\)' instead.

We probably should switch to shell based substring post 1.3.0;
that's not bashism but just POSIX anyway.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 19:05:38 -07:00
Mark Wooding f327dbced2 Shell utilities: Guard against expr' magic tokens.
Some words, e.g., `match', are special to expr(1), and cause strange
parsing effects.  Track down all uses of expr and mangle the arguments
so that this isn't a problem.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-13 16:45:48 -07:00
Junio C Hamano d3c4519a72 Merge branch 'jc/fetch' into next
* jc/fetch:
  fetch: exit non-zero when fast-forward check fails.
2006-03-17 14:11:10 -08:00
Junio C Hamano a9698bb22f fetch: exit non-zero when fast-forward check fails.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-17 14:10:36 -08:00
Eric Wong 687b8be8bb fetch,parse-remote,fmt-merge-msg: refs/remotes/* support
We can now easily fetch and merge things from heads in the
refs/remotes/ hierarchy in remote repositories.

The refs/remotes/ hierarchy is likely to become the standard for
tracking foreign SCMs, as well as the location of Pull: targets
for tracking remote branches in newly cloned repositories.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-10 22:31:20 -08:00
Lukas Sandström 9d7f73d43f git-fetch: print the new and old ref when fast-forwarding
Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-25 12:03:18 -08:00
Junio C Hamano f0b0af1b04 Merge branches 'jc/rev-list' and 'jc/pack-thin'
* jc/rev-list:
  rev-list --objects: use full pathname to help hashing.
  rev-list --objects-edge: remove duplicated edge commit output.
  rev-list --objects-edge

* jc/pack-thin:
  pack-objects: hash basename and direname a bit differently.
  pack-objects: allow "thin" packs to exceed depth limits
  pack-objects: use full pathname to help hashing with "thin" pack.
  pack-objects: thin pack micro-optimization.
  Use thin pack transfer in "git fetch".
  Add git-push --thin.
  send-pack --thin: use "thin pack" delta transfer.
  Thin pack - create packfile with missing delta base.

Conflicts:

	pack-objects.c (taking "next")
	send-pack.c (taking "next")
2006-02-24 21:55:23 -08:00
Junio C Hamano 6dc78e696b git-fetch: follow tag only when tracking remote branch.
Unless --no-tags flag was given, git-fetch tried to always
follow remote tags that point at the commits we picked up.

It is not very useful to pick up tags from remote unless storing
the fetched branch head in a local tracking branch.  This is
especially true if the fetch is done to merge the remote branch
into our current branch as one-shot basis (i.e. "please pull"),
and is even harmful if the remote repository has many irrelevant
tags.

This proposed update disables the automated tag following unless
we are storing the a fetched branch head in a local tracking
branch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-22 16:04:08 -08:00
Junio C Hamano b19696c2e7 Use thin pack transfer in "git fetch".
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-20 00:38:39 -08:00
Junio C Hamano 2796a9de31 git-fetch --upload-pack: disambiguate.
Johannes noticed the recent addition of this new flag
inadvertently took over existing --update-head-ok (-u).  Require
longer abbreviation to this new option which would be needed in
a rare setup.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-26 18:11:06 -08:00
Michal Ostrowski 96b086d618 git-{fetch,peek-remote} handling of --upload-pack
git-peek-remote needs to handle a -u|--upload-pack parameter just like
git-fetch (and git-fetch has to pass it on to git-peek-remote).

(This is actually a follow-up to my previous git-fetch patch.)

Signed-off-by: Michal Ostrowski <mostrows@heater.watson.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-24 23:17:26 -08:00
Michal Ostrowski 2c620a1ad1 git-fetch: pass --upload-pack to fetch-pack
Without this, there is no way to specify a remote executable when
invoking git-pull/git-fetch as there is for git-clone.

[jc: I have a mild suspicion that this is a broken environment (aka
 sysadmin disservice).  It may be legal to configure your sshd to
 spawn named program without involving shell at all, and if your
 sysadmin does so and you have your git programs under your home
 directory, you would need something like this, but then I suspect
 you would need such workaround everywhere, not just git. But we
 have these options we can use to work around the issue, so there
 is no strong reason not to reject this patch, either. ]

Signed-off-by: Michal Ostrowski <mostrows@watson.ibm.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-24 23:17:26 -08:00
Tom Prince 0f76f52621 Add --keep option to keep downloaded packs to git-fetch.
Signed-off-by: Tom Prince <tom.prince@ualberta.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-10 22:10:37 -08:00
Junio C Hamano 03febf99bc git-fetch: auto-following tags.
I added things to ls-remote so that Cogito can auto-follow tags
easily and correctly a while ago, but git-fetch did not use the
facility.  Recently added git-describe command relies on
repository keeping up-to-date set of tags, which made it much
more attractive to automatically follow tags, so we do that as
well.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-07 21:33:51 -08:00
Junio C Hamano 81214e4ddf git-fetch --tags: reject malformed tags.
When the other end was prepared with older git and has tags that
do not follow the naming convention (see check-ref-format), do not
barf but simply reject to copy them.

Initial fix by Simon Richter, but done differently.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-05 19:42:12 -08:00
Junio C Hamano 36cd2cc7d9 Do not mark tags fetched via --tags flag as mergeable
Otherwise "git pull --tags" would mistakenly try to merge all of
them, which is never what the user wants.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-27 11:52:51 -08:00
freku045@student.liu.se 87358b7a19 git-fetch: Usage string clean-up, emit usage string at unrecognized option
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-12-14 02:53:44 -08:00
Junio C Hamano ae2b0f1518 git-sh-setup: die if outside git repository.
Now all the users of this script detect its exit status and die,
complaining that it is outside git repository.  So move the code
that dies from all callers to git-sh-setup script.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-25 13:49:17 -08:00
Linus Torvalds 583122cd1b Make "git fetch" less verbose by default
When doing something like

	git fetch --tags origin

the excessively verbose output of git fetch makes the result totally
unreadable. It's impossible to tell if it actually fetched anything new or
not, since the screen will fill up with an endless supply of

   ...
   * committish: 9165ec17fd
     tag 'v0.99.7c' of master.kernel.org:/pub/scm/git/git
   * refs/tags/v0.99.7c: same as tag 'v0.99.7c' of master.kernel.org:/pub/scm/git/git
   ...

and any new tags that got fetched will be totally hidden.

So add a new "--verbose" flag to "git fetch" to enable this verbose mode,
but make the default be quiet.

NOTE! The quiet mode will still report about new or changed heads, so if
you are really fetching a new head, you'll see something like this:

   [torvalds@g5 git]$ git fetch --tags parent
   Packing 6 objects
   Unpacking 6 objects
    100% (6/6) done
   * refs/tags/v1.0rc2: storing tag 'v1.0rc2' of master.kernel.org:/pub/scm/git/git
   * refs/tags/v1.0rc3: storing tag 'v1.0rc3' of master.kernel.org:/pub/scm/git/git
   * refs/tags/v1.0rc1: storing tag 'v1.0rc1' of master.kernel.org:/pub/scm/git/git

which actually tells you something useful that isn't hidden by all the
useless crud that you already had.

Extensively tested (hey, for me, this _is_ extensive) by doing a

   rm .git/refs/tags/v1.0rc*

and re-fetching with both --verbose and without.

NOTE! This means that if the fetch didn't actually fetch anything at all,
git fetch will be totally quiet. I think that's much better than being so
verbose that you can't even tell whether something was fetched or not, but
some people might prefer to get a "nothing to fetch" message in that case.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-18 11:21:22 -08:00
Josef Weidendorfer 66c9ec2555 Let git-clone/git-fetch follow HTTP redirections
Otherwise, git-clone silently failed to clone a remote
repository where redirections (ie. a response with a
"Location" header line) are used.

This includes the fixes from Nick Hengeveld.

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-10 15:57:56 -08:00
Junio C Hamano f8765797a4 Even when overwriting tags, report if they are changed or not.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-18 18:42:14 -07:00
Junio C Hamano cdb3950801 Forward port the "funny ref avoidance" in clone and fetch from maint branch.
Somehow I forgot to forward port these fixes.  "git clone" from a
repository prepared with the latest update-server-info would fail
without this patch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-10-17 21:47:06 -07:00