summaryrefslogtreecommitdiff
path: root/git-clone.sh
Commit message (Collapse)AuthorAgeFilesLines
* Shell utilities: Guard against expr' magic tokens.Mark Wooding2006-04-131-3/+3
| | | | | | | | | 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>
* git-clone: fix handling of upsteram whose HEAD does not point at master.Junio C Hamano2006-04-021-19/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When cloning from a remote repository that has master, main, and origin branches _and_ with the HEAD pointing at main branch, we did quite confused things during clone. So this cleans things up. The behaviour is a bit different between separate remotes/ layout and the mixed branches layout. The newer layout with $GIT_DIR/refs/remotes/$origin/, things are simpler and more transparent: - remote branches are copied to refs/remotes/$origin/. - HEAD points at the branch with the same name as the remote HEAD points at, and starts at where the remote HEAD points at. - $GIT_DIR/remotes/$origin file is set up to fetch all remote branches, and merge the branch HEAD pointed at at the time of the cloning. Everything-in-refs/heads layout was the more confused one, but cleaned up like this: - remote branches are copied to refs/heads, but the branch "$origin" is not copied, instead a copy of the branch the remote HEAD points at is created there. - HEAD points at the branch with the same name as the remote HEAD points at, and starts at where the remote HEAD points at. - $GIT_DIR/remotes/$origin file is set up to fetch all remote branches except "$origin", and merge the branch HEAD pointed at at the time of the cloning. With this, the remote has master, main and origin, and its HEAD points at main, you could: git clone $URL --origin upstream to use refs/heads/upstream as the tracking branch for remote "main", and your primary working branch will also be "main". "master" and "origin" are used to track the corresponding remote branches and with this setup they do not have any special meaning. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: exit early if repo isn't specifiedYasushi SHOJI2006-03-301-2/+8
| | | | | | | | | | | git-clone without a repo isn't useful at all. print message and get out asap. This patch also move the variable 'local' to where other variables are initialized. Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make git-clone to take long double-dashed origin option (--origin)Yasushi SHOJI2006-03-301-5/+6
| | | | | | | | | | | git-clone currently take option '-o' to specify origin. this patch makes git-clone to take double-dashed option '--origin' and other abbreviations in addtion to the current single-dashed option. [jc: with minor fixups] Signed-off-by: Yasushi SHOJI <yashi@atmark-techno.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: typofix.Junio C Hamano2006-03-221-2/+2
| | | | | | | | The traditional one created refs/origin by mistake, not refs/heads/origin. Also it mistakenly failed to prevent $origin from being listed twice in remotes/origin file. Signed-off-by: Junio C Hamano <junkio@cox.net>
* clone: record the remote primary branch with remotes/$origin/HEADJunio C Hamano2006-03-211-3/+9
| | | | | | | | | This matches c51d13692d4e451c755dd7da3521c5db395df192 commit to record the primary branch of the remote with a symbolic ref remotes/$origin/HEAD. The user can later change it to point at different branch to change the meaning of "$origin" shorthand. Signed-off-by: Junio C Hamano <junkio@cox.net>
* revamp git-clone (take #2).Junio C Hamano2006-03-211-19/+31
| | | | | | | | | | | | | | | | | | This builds on top of the previous one. * --use-separate-remote uses .git/refs/remotes/$origin/ directory to keep track of the upstream branches. * The $origin above defaults to "origin" as usual, but the existing "-o $origin" option can be used to override it. I am not yet convinced if we should make "$origin" the synonym to "refs/remotes/$origin/$name" where $name is the primary branch name of $origin upstream, nor if so how we should decide which upstream branch is the primary one, but that is more or less orthogonal to what the clone does here. Signed-off-by: Junio C Hamano <junkio@cox.net>
* revamp git-clone.Junio C Hamano2006-03-201-32/+152
| | | | | | | | | | | | | | | | | | | | | | | | This does two things. * A new flag --reference can be used to name a local repository that is to be used as an alternate. This is in response to an inquiry by James Cloos in the message on the list <m3r74ykue7.fsf@lugabout.cloos.reno.nv.us>. * A new flag --use-separate-remote stops contaminating local branch namespace by upstream branch names. The upstream branch heads are copied in .git/refs/remotes/ instead of .git/refs/heads/ and .git/remotes/origin file is set up to reflect this as well. It requires to have fetch/pull update to understand .git/refs/remotes by Eric Wong to further update the repository cloned this way. For the former change, git-fetch-pack is taught a new flag --all to fetch from all the remote heads. Nobody uses the git-clone-pack with this change, so we could deprecate the command, but removal of the command will be left to a separate round. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge fixes early for next maint series.Junio C Hamano2006-02-231-2/+2
|\
| *-. Merge branches 'jc/fix-co-candy', 'jc/fix-rename-leak' and 'ar/fix-win' into ↵Junio C Hamano2006-02-231-2/+2
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | maint * jc/fix-co-candy: checkout - eye candy. * jc/fix-rename-leak: diffcore-rename: plug memory leak. * ar/fix-win: fix t5600-clone-fail-cleanup.sh on windows
| | | * fix t5600-clone-fail-cleanup.sh on windowsAlex Riesen2006-02-231-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | In windows you cannot remove current or opened directory, an opened file, a running program, a loaded library, etc... [jc: signoffs? With a minor quoting fix.] Signed-off-by: Junio C Hamano <junkio@cox.net>
| | * checkout - eye candy.Junio C Hamano2006-02-221-1/+1
| |/ | | | | | | | | | | | | | | This implements "eye candy" similar to the pack-object/unpack-object to entertain users while a large tree is being checked out after a clone or a pull. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Merge part of jc/portable branchJunio C Hamano2006-02-211-1/+1
|\ \ | |/ |/|
| * Fix cpio callJohannes Schindelin2006-02-171-1/+1
| | | | | | | | | | | | | | To some cpio's, -a and -m options are mutually exclusive. Use only -m. Signed-off-by: Johannes E. Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Trap exit to clean up created directory if clone fails.Carl Worth2006-02-171-0/+4
|/ | | | | Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Print an error if cloning a http repo and NO_CURL is setFernando J. Pereda2006-02-151-1/+7
| | | | | | | | | | If Git is compiled with NO_CURL=YesPlease and one tries to clone a http repository, git-clone tries to call the curl binary. This trivial patch prints an error instead in such situation. Signed-off-by: Fernando J. Pereda <ferdy@gentoo.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* clone: do not accept more than one -o option.Junio C Hamano2006-01-241-1/+15
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* clone: do not create remotes/origin nor origin branch in a bare repository.Junio C Hamano2006-01-241-1/+1
| | | | | | | It is simply pointless, since no merges will ever happen in such a repository. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: PG13 --naked option to --bare.Junio C Hamano2006-01-241-7/+8
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fix generation of "humanish" part of source repoUwe Zeisberger2006-01-191-1/+1
| | | | | | | | If repo has the form <host>:<path> and <path> doesn't contain a slash, the cloned repository is named "<host>:<path>", instead of "<path>" only. Signed-off-by: Uwe Zeisberger <zeisberg@informatik.uni-freiburg.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* clone: --naked option.Junio C Hamano2006-01-141-26/+40
| | | | | | | | | | | | | | | | The new option --naked is to help creating a naked repository for public consumption. $ git clone -l -s --naked \ /pub/scm/.../torvalds/linux-2.6.git subproj-2.6.git is equivalent to this sequence: $ git clone -l -s -n /pub/scm/.../torvalds/linux-2.6.git temp $ mv temp/.git subproj-2.6.git $ rmdir temp Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: do not special case dumb http.Junio C Hamano2005-12-231-15/+1
| | | | | | | | Underlying http-fetch is supposed to be capable of handling packed repositories just fine, so no need to special case it in the wrapper script. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: Support changing the origin branch with -oJohannes Schindelin2005-12-221-4/+13
| | | | | | | | | | | | | Earlier, git-clone stored upstream's master in the branch named 'origin', possibly overwriting an existing such branch. Now you can change it by calling git-clone with '-o <other_name>'. [jc: added ref format check, subdirectory safety, documentation and usage string.] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Trivial usage string clean-upfreku045@student.liu.se2005-12-141-1/+1
| | | | | Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: tell the user a bit more about clone-pack failure.Junio C Hamano2005-12-131-1/+4
| | | | | | | | | | | | | | | | | When clone-pack has trouble with the remote, it dies unfriendly "EOF" error message. We cannot tell the reason why it failed from the local end; it could be that the repository did not exist, or configured not to serve over git-daemon, or a network failure. At least, saying clone-pack failed makes it a bit more meaningful. I am not convinced yet that removing the newly created directory is the right thing to do, so this commit leaves the new directory behind. Reported by Sam Ravnborg. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone --shared should imply --localPavel Roskin2005-11-281-1/+1
| | | | | | | | | The "--shared" option to git-clone is silently ignored if "--local" is not specified. The manual doesn't mention such dependency. Make "--shared" imply "--local". Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Bugfix: stop if directory already existsJosef Weidendorfer2005-11-141-2/+2
| | | | | | | | | Fix a typo: We do not want to run the directory as command, and want to terminate if the directory exists Additionally, update the usage message Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: Allow cloning into directories other than child of current dir.Andreas Ericsson2005-11-111-1/+2
| | | | | | | | This patch adds -p to mkdir and an explicit check to see if the target directory exists (since mkdir -p doesn't throw an error if it does). Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: Keep remote names when cloning unless explicitly told not to.Andreas Ericsson2005-11-111-0/+2
| | | | | | | | | | | | | | | With this patch the following commands all clone into the local directory "repo". If repo exists, it will still barf. git-clone git://host.xz/repo.git git-clone /path/to/repo/.git git-clone host.xz:repo.git I ended up doing the same source-to-target sed'ing for all our company projects, so it was easier to add it directly to git-clone. Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: quote destination directory namePavel Roskin2005-11-111-2/+2
| | | | | | | | | | | git-clone doesn't quote the full path to the destination directory, which causes it to fail if the path contains spaces or other characters interpreted by the shell. [jc: obviously I was not careful enough. Pavel, thanks for catching.] Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Let git-clone/git-fetch follow HTTP redirectionsJosef Weidendorfer2005-11-101-1/+1
| | | | | | | | | | | 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>
* Set up remotes/origin to track all remote branches.Junio C Hamano2005-11-061-2/+10
| | | | | | | | | | | | | This implements the idea Daniel Barkalow came up with, to match the remotes/origin created by clone by default to the workflow I use myself in my guinea pig repository, to have me eat my own dog food. We probably would want to use either .git/refs/local/heads/* (idea by Linus) or .git/refs/heads/origin/* instead to reduce the local ref namespace pollution. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: fix local cloneJunio C Hamano2005-11-051-2/+1
| | | | | | | | If we let cpio to create the leading directories implicitly, it ends up having funny perm bits (GNU cpio 2.5 and 2.6, at least). This leaves .git/object/?? directories readable only by the owner. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-clone: do not forget to create origin branch.Junio C Hamano2005-11-011-4/+11
| | | | | | | | | | The newly cloned repository by default had .git/remotes/origin set up to track the remote master to origin, but forgot to create the origin branch ourselves. Also it hardcoded the assumption that the remote HEAD points at "master", which may not always be true. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Forward port the "funny ref avoidance" in clone and fetch from maint branch.Junio C Hamano2005-10-171-1/+5
| | | | | | | | 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>
* git-clone: check out "master" by default.Junio C Hamano2005-09-261-6/+15
| | | | | | And with -n flag you can tell it not to. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Solaris: give a bit more built-in defaults.Junio C Hamano2005-09-241-1/+2
| | | | | | | Taking the make command line Peter Eriksen uses, give defaults to SHELL_PATH, TAR, CURLDIR, NO_STRCASESTR, and INSTALL. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Do not give alarming error message from rsync in fetch and clone.Junio C Hamano2005-09-201-1/+2
| | | | | | | | | When we check the optional objects/info/alternates file at the remote repository, we forgot to really squelch error message from rsync. Not having that file is not a crime. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Teach rsync transport about alternates.Junio C Hamano2005-09-171-2/+26
| | | | | | | | | | | | | | For local operations and downloading and uploading via git aware protocols, use of $GIT_OBJECT_DIRECTORY/info/alternates is recommended on the server side for big projects that are derived from another one (like Linux kernel). However, dumb protocols and rsync transport needs to resolve this on the client end, which we did not bother doing until this week. I noticed we use "rsync -z" but most of our payload is already compressed, which was not quite right. This commit also fixes it. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fix CDPATH problem.Junio C Hamano2005-09-121-0/+3
| | | | | | | | | | | | | | | | | | | CDPATH has two problems: * It takes scripts to unexpected places (somebody had CDPATH=..:../..:$HOME and the "cd" in git-clone.sh:get_repo_base took him to $HOME/.git when he said "clone foo bar" to clone a repository in "foo" which had "foo/.git"). CDPATH mechanism does not implicitly give "." at the beginning of CDPATH, which is the most irritating part. * The extra echo when it does its thing confuses scripts further. Most of our scripts that use "cd" includes git-sh-setup so the problem is primarily fixed there. git-clone starts without a repository, and it needs its own fix. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Big tool rename.Junio C Hamano2005-09-071-0/+165
As promised, this is the "big tool rename" patch. The primary differences since 0.99.6 are: (1) git-*-script are no more. The commands installed do not have any such suffix so users do not have to remember if something is implemented as a shell script or not. (2) Many command names with 'cache' in them are renamed with 'index' if that is what they mean. There are backward compatibility symblic links so that you and Porcelains can keep using the old names, but the backward compatibility support is expected to be removed in the near future. Signed-off-by: Junio C Hamano <junkio@cox.net>