1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 00:37:55 +01:00
Commit graph

99 commits

Author SHA1 Message Date
Santi Béjar
08727ea8bb git-fetch: Fix single_force in append_fetch_head
This fixes the single force (+) when fetched with fetch_per_ref.

Also use $LF as separator because IFS is $LF.

Signed-off-by: Santi Béjar <sbejar@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-20 01:52:11 -07:00
Paolo Bonzini
9debc3241b git-fetch, git-branch: Support local --track via a special remote '.'
This patch adds support for a dummy remote '.' to avoid having
to declare a fake remote like

        [remote "local"]
                url = .
                fetch = refs/heads/*:refs/heads/*

Such a builtin remote simplifies the operation of "git-fetch",
which will populate FETCH_HEAD but will not pretend that two
repositories are in use, will not create a thin pack, and will
not perform any useless remapping of names.  The speed
improvement is around 20%, and it should improve more if
"git-fetch" is converted to a builtin.

To this end, git-parse-remote is grown with a new kind of
remote, 'builtin'.  In git-fetch.sh, we treat the builtin remote
specially in that it needs no pack/store operations.  In fact,
doing git-fetch on a builtin remote will simply populate
FETCH_HEAD appropriately.

The patch also improves of the --track/--no-track support,
extending it so that branch.<name>.remote items referring '.'
can be created.  Finally, it fixes a typo in git-checkout.sh.

Signed-off-by: Paolo Bonzini  <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-16 02:10:12 -07:00
Junio C Hamano
c1f5086e23 Merge branch 'jc/fetch'
* jc/fetch:
  .gitignore: add git-fetch--tool
  builtin-fetch--tool: fix reflog notes.
  git-fetch: retire update-local-ref which is not used anymore.
  builtin-fetch--tool: make sure not to overstep ls-remote-result buffer.
  fetch--tool: fix uninitialized buffer when reading from stdin
  builtin-fetch--tool: adjust to updated sha1_object_info().
  git-fetch--tool takes flags before the subcommand.
  Use stdin reflist passing in git-fetch.sh
  Use stdin reflist passing in parse-remote
  Allow fetch--tool to read from stdin
  git-fetch: rewrite expand_ref_wildcard in C
  git-fetch: rewrite another shell loop in C
  git-fetch: move more code into C.
  git-fetch--tool: start rewriting parts of git-fetch in C.
  git-fetch: split fetch_main into fetch_dumb and fetch_native
2007-03-14 01:40:19 -07:00
Junio C Hamano
3ddad98b74 Merge branch 'js/fetch-progress' (early part)
* 'js/fetch-progress' (early part):
  Fixup no-progress for fetch & clone
  fetch & clone: do not output progress when not on a tty

Conflicts:

	git-fetch.sh
2007-03-04 17:31:21 -08:00
Junio C Hamano
e6eebbb3ae git-fetch: retire update-local-ref which is not used anymore.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-28 17:01:00 -08:00
Junio C Hamano
77b50ab009 Merge branch 'js/bundle'
* js/bundle:
  bundle: reword missing prerequisite error message
  git-bundle: record commit summary in the prerequisite data
  git-bundle: fix 'create --all'
  git-bundle: avoid fork() in verify_bundle()
  git-bundle: assorted fixes
  Add git-bundle: move objects and references by archive
2007-02-28 14:38:36 -08:00
Junio C Hamano
88459358cd Merge branch 'np/types' into jc/fetch
* np/types: (253 commits)
  get rid of lookup_object_type()
  convert object type handling from a string to a number
  formalize typename(), and add its reverse type_from_string()
  sha1_file.c: don't ignore an error condition in sha1_loose_object_info()
  sha1_file.c: cleanup "offset" usage
  sha1_file.c: cleanup hdr usage
  git-apply: do not fix whitespaces on context lines.
  diff --cc: integer overflow given a 2GB-or-larger file
  mailinfo: do not get confused with logical lines that are too long.
  Documentation: link in 1.5.0.2 material to the top documentation page.
  Documentation: document remote.<name>.tagopt
  GIT 1.5.0.2
  git-remote: support remotes with a dot in the name
  Documentation: describe "-f/-t/-m" options to "git-remote add"
  diff --cc: fix display of symlink conflicts during a merge.
  merge-recursive: fix longstanding bug in merging symlinks
  merge-index: fix longstanding bug in merging symlinks
  diff --cached: give more sensible error message when HEAD is yet to be created.
  Update tests to use test-chmtime
  Add test-chmtime: a utility to change mtime on files
  ...
2007-02-27 02:27:26 -08:00
Junio C Hamano
fee7c2c71d git-fetch--tool takes flags before the subcommand.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-24 04:35:31 -08:00
Johannes Schindelin
2e0afafebd Add git-bundle: move objects and references by archive
Some workflows require use of repositories on machines that cannot be
connected, preventing use of git-fetch / git-push to transport objects and
references between the repositories.

git-bundle provides an alternate transport mechanism, effectively allowing
git-fetch and git-pull to operate using sneakernet transport. `git-bundle
create` allows the user to create a bundle containing one or more branches
or tags, but with specified basis assumed to exist on the target
repository. At the receiving end, git-bundle acts like git-fetch-pack,
allowing the user to invoke git-fetch or git-pull using the bundle file as
the URL. git-fetch and git-ls-remote determine they have a bundle URL by
checking that the URL points to a file, but are otherwise unchanged in
operation with bundles.

The original patch was done by Mark Levedahl <mdl123@verizon.net>.

It was updated to make git-bundle a builtin, and get rid of the tar
format: now, the first line is supposed to say "# v2 git bundle", the next
lines either contain a prerequisite ("-" followed by the hash of the
needed commit), or a ref (the hash of a commit, followed by the name of
the ref), and finally the pack. As a result, the bundle argument can be
"-" now.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-22 22:30:33 -08:00
Johannes Schindelin
83a5ad6126 fetch & clone: do not output progress when not on a tty
This adds the option "--no-progress" to fetch-pack and upload-pack,
and makes fetch and clone pass this option when stdout is not a tty.

While at documenting that option, also document --strict and --timeout
options for upload-pack.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-19 19:20:05 -08:00
Junio C Hamano
24424fc2f7 remotes.not-origin.tagopt
With a configuration entry like this:

	[remote "alt-git"]
        	url = git://repo.or.cz/alt.git/git/
                fetch = +refs/heads/*:refs/remotes/alt-git/*
                tagopt = --no-tags

you do not have to say "git pull --no-tags alt-git".  Just
saying "git pull alt-git" would suffice.

Obviously, if you want to get the tag from such an alternate
remote in a separate namespace, you could also do something like:

	[remote "alt-git"]
        	url = git://repo.or.cz/alt.git/git/
                fetch = +refs/heads/*:refs/remotes/alt-git/*
                fetch = +refs/tags/*:refs/remote-tags/alt-git/*
                tagopt = --no-tags

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-15 01:52:14 -08:00
Julian Phillips
617669da4f Use stdin reflist passing in git-fetch.sh
Use the new stdin reflist passing mechanism for the call to
fetch--tool parse-reflist, allowing passing of more than ~128K
of reflist data.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-13 21:43:53 -08:00
Junio C Hamano
d1e0ef6cc8 git-fetch: rewrite another shell loop in C
Move another shell loop that canonicalizes the list of refs for
underlying git-fetch-pack and fetch-native-store into C.

This seems to shave the runtime for the same 1000 branch
repository from 30 seconds down to 15 seconds (it used to be 2
and half minutes with the original version).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-13 21:43:53 -08:00
Junio C Hamano
fbe2687eba git-fetch: move more code into C.
This adds "native-store" subcommand to git-fetch--tool to
move a huge loop implemented in shell into C.  This shaves about
70% of the runtime to fetch and update 1000 tracking branches
with a single fetch.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-13 21:43:53 -08:00
Junio C Hamano
d4289fff87 git-fetch--tool: start rewriting parts of git-fetch in C.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-13 21:43:52 -08:00
Junio C Hamano
b74e8cbd80 git-fetch: split fetch_main into fetch_dumb and fetch_native
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-13 21:43:52 -08:00
Junio C Hamano
85b1f98871 "git-fetch --tags $URL" should not overwrite existing tags
Use the same --exclude-existing filter as we use for automatic
tag following to avoid overwriting existing tags with replacement
ones the other side created.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-12 23:31:00 -08:00
Shawn O. Pearce
4a91a1f37e Escape --upload-pack from expr.
Recent commit ae1dffcb28 by Junio
changed the way --upload-pack was passed around between clone,
fetch and ls-remote and modified the handling of the command
line parameter parsing.

Unfortunately FreeBSD 6.1 insists that the expression

  expr --upload-pack=git-upload-pack : '-[^=]*=\(.*\)'

is illegal, as the --upload-pack option is not supported by their
implementation of expr.

Elsewhere in Git we use z as a leading prefix of both arguments,
ensuring the -- isn't seen by expr.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-31 13:09:58 -08:00
Tom Prince
e0d10e1c63 [PATCH] Rename git-repo-config to git-config.
Signed-off-by: Tom Prince <tom.prince@ualberta.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28 16:16:53 -08:00
Uwe Kleine-König
5dee29ac0f make --upload-pack option to git-fetch configurable
This introduces the config item remote.<name>.uploadpack to override the
default value (which is "git-upload-pack").

Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-24 23:06:30 -08:00
Junio C Hamano
ae1dffcb28 ls-remote and clone: accept --upload-pack=<path> as well.
This makes them consistent with other commands that take the
path to the upload-pack program.  We also pass --upload-pack
instead of --exec to the underlying fetch-pack, although it is
not strictly necessary.

[jc: original motivation from Uwe]

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-24 16:12:15 -08:00
Junio C Hamano
514c09fdcf Use cd_to_toplevel in scripts that implement it by hand.
This converts scripts that do "cd $(rev-parse --show-cdup)" by
hand to use cd_to_toplevel.

I think git-fetch does not have to go to the toplevel, but that
should be dealt with in a separate patch.

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

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

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-07 21:36:35 -08:00
Junio C Hamano
ac9c1108d8 git-fetch: remove .keep file at the end.
Removal of them is needed regardless of errors.  The original
code had the removal outside of the process which sets the flag
to tell the later step what to remove, but it runs as a
downstream of a pipeline and its effect was lost.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-01 14:36:01 -08:00
Junio C Hamano
b11bd57a38 Merge branch 'js/shallow'
* js/shallow:
  fetch-pack: Do not fetch tags for shallow clones.
  get_shallow_commits: Avoid memory leak if a commit has been reached already.
  git-fetch: Reset shallow_depth before auto-following tags.
  upload-pack: Check for NOT_SHALLOW flag before sending a shallow to the client.
  fetch-pack: Properly remove the shallow file when it becomes empty.
  shallow clone: unparse and reparse an unshallowed commit
  Why didn't we mark want_obj as ~UNINTERESTING in the old code?
  Why does it mean we do not have to register shallow if we have one?
  We should make sure that the protocol is still extensible.
  add tests for shallow stuff
  Shallow clone: do not ignore shallowness when following tags
  allow deepening of a shallow repository
  allow cloning a repository "shallowly"
  support fetching into a shallow repository
  upload-pack: no longer call rev-list
2006-12-28 01:25:43 -08:00
Shawn O. Pearce
f94741324e Use GIT_REFLOG_ACTION environment variable instead.
Junio rightly pointed out that the --reflog-action parameter
was starting to get out of control, as most porcelain code
needed to hand it to other porcelain and plumbing alike to
ensure the reflog contained the top-level user action and
not the lower-level actions it invoked.

At Junio's suggestion we are introducing the new set_reflog_action
function to all shell scripts, allowing them to declare early on
what their default reflog name should be, but this setting only
takes effect if the caller has not already set the GIT_REFLOG_ACTION
environment variable.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-28 01:05:15 -08:00
Junio C Hamano
37818d7db0 Merge branch 'master' into js/shallow
This is to adjust to:

  count-objects -v: show number of packs as well.

which will break a test in this series.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-27 02:43:46 -08:00
Nicolas Pitre
b3d9899324 make git a bit less cryptic on fetch errors
The remote server might not want to tell why it doesn't like us for
security reasons, but let's make the client report such error in a bit
less confusing way.  The remote failure remains a mystery, but the local
message might be a bit less so.

[jc: with a gentle wording updates from Andy Parkins]

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-18 15:31:28 -08:00
Junio C Hamano
ed9f7c954c git-fetch: Avoid reading packed refs over and over again
When checking which tags to fetch, the old code used to call
git-show-ref --verify for each remote tag. Since reading even
packed refs is not a cheap operation when there are a lot of
local refs, the code became quite slow.

This fixes it by teaching git-show-ref to filter out existing
refs using a new mode of operation of git-show-ref.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-17 17:57:19 -08:00
Junio C Hamano
4da9028578 git-fetch: make it work from within a subdirectory.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-14 02:45:51 -08:00
Junio C Hamano
cadd8a7d4d Merge branch 'master' into jc/globfetch
This is to pick up the fix made on master:

  git-fetch: exit with non-zero status when fast-forward check fails
2006-11-25 01:07:15 -08:00
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
Alexandre Julliard
d158631549 git-fetch: Reset shallow_depth before auto-following tags.
Otherwise fetching the tags could also fetch commits up to the
specified depth, which isn't the expected behavior.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:50 -08:00
Johannes Schindelin
f53514bc2d allow deepening of a shallow repository
Now, by saying "git fetch -depth <n> <repo>" you can deepen
a shallow repository.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-24 15:42:49 -08:00
Junio C Hamano
2986c02217 git-fetch: fix dumb protocol transport to fetch from pack-pruned ref
Earlier, commit walkers downloaded loose refs from refs/ hierarchy
of the remote side to find where to start walking; this would
not work for a repository whose refs are packed and then pruned.

With the previous change, we have ls-remote output from the
remote in-core; we can use the value from there without
requiring loose refs anymore.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 16:54:54 -08:00
Junio C Hamano
28b8e61fc6 git-fetch: reuse ls-remote result.
This will become necessary to update the dumb protocol
transports to fetch from a repository with packed and then
pruned tags.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-23 16:54:54 -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